servant-swagger: add HasSwagger instance for NamedRoutes

This commit is contained in:
Isaac Elliott 2022-04-29 14:50:08 +10:00
parent 5e1569e9e2
commit cb310b8294

View file

@ -35,6 +35,7 @@ import Network.HTTP.Media (MediaType)
import Servant.API
import Servant.API.Description (FoldDescription,
reflectDescription)
import Servant.API.Generic (ToServantApi)
import Servant.API.Modifiers (FoldRequired)
import Servant.Swagger.Internal.TypeLevel.API
@ -439,6 +440,9 @@ instance (ToSchema a, Accept ct, HasSwagger sub, KnownSymbol (FoldDescription mo
& required ?~ True
& schema .~ ParamBody ref
instance HasSwagger (ToServantApi routes) => HasSwagger (NamedRoutes routes) where
toSwagger _ = toSwagger (Proxy :: Proxy (ToServantApi routes))
-- =======================================================================
-- Below are the definitions that should be in Servant.API.ContentTypes
-- =======================================================================