Skip to content

Commit cb310b8

Browse files
committed
servant-swagger: add HasSwagger instance for NamedRoutes
1 parent 5e1569e commit cb310b8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

servant-swagger/src/Servant/Swagger/Internal.hs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ import Network.HTTP.Media (MediaType)
3535
import Servant.API
3636
import Servant.API.Description (FoldDescription,
3737
reflectDescription)
38+
import Servant.API.Generic (ToServantApi)
3839
import Servant.API.Modifiers (FoldRequired)
3940

4041
import Servant.Swagger.Internal.TypeLevel.API
@@ -439,6 +440,9 @@ instance (ToSchema a, Accept ct, HasSwagger sub, KnownSymbol (FoldDescription mo
439440
& required ?~ True
440441
& schema .~ ParamBody ref
441442

443+
instance HasSwagger (ToServantApi routes) => HasSwagger (NamedRoutes routes) where
444+
toSwagger _ = toSwagger (Proxy :: Proxy (ToServantApi routes))
445+
442446
-- =======================================================================
443447
-- Below are the definitions that should be in Servant.API.ContentTypes
444448
-- =======================================================================

0 commit comments

Comments
 (0)