Add support for NamedRoutes in servant-docs

This commit is contained in:
Gaël Deest 2022-04-17 19:06:45 +02:00
parent 117a2cc5e1
commit 9c81b4927a

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