Merge pull request #1582 from haskell-servant/named-routes-servant-docs

Add support for NamedRoutes in servant-docs
This commit is contained in:
Gaël Deest 2022-04-19 13:13:50 +02:00 committed by GitHub
commit c48a6702b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -62,6 +62,7 @@ import GHC.TypeLits
import Servant.API import Servant.API
import Servant.API.ContentTypes import Servant.API.ContentTypes
import Servant.API.TypeLevel import Servant.API.TypeLevel
import Servant.API.Generic
import qualified Data.Universe.Helpers as U import qualified Data.Universe.Helpers as U
@ -1150,6 +1151,9 @@ instance (ToAuthInfo (BasicAuth realm usr), HasDocs api) => HasDocs (BasicAuth r
authProxy = Proxy :: Proxy (BasicAuth realm usr) authProxy = Proxy :: Proxy (BasicAuth realm usr)
action' = over authInfo (|> toAuthInfo authProxy) action action' = over authInfo (|> toAuthInfo authProxy) action
instance HasDocs (ToServantApi api) => HasDocs (NamedRoutes api) where
docsFor Proxy = docsFor (Proxy :: Proxy (ToServantApi api))
-- ToSample instances for simple types -- ToSample instances for simple types
instance ToSample NoContent instance ToSample NoContent
instance ToSample Bool instance ToSample Bool