Safe Haskell | None |
---|---|
Language | Haskell2010 |
Servant.Docs.Simple.Parse
Description
Parse Servant API into documentation
Example script
Generating the intermediate documentation structure
Parsing custom API type combinators
Example of parsing an API
API type
type API = "hello" :> "world" :> Request :> Response type Request = ReqBody '[()] () type Response = Post '[()] ()
Intermediate structure
ApiDocs ( fromList [( "/hello/world", , Details (fromList ([ ( "RequestBody" , Details (fromList ([ ( "Format" , Detail "': * () ('[] *)" ) , ( "ContentType" , Detail "()" ) ])) ) , ( "RequestType" , Detail "'POST" ) , ( "Response" , Details (fromList ([ ( "Format" , Detail "': * () ('[] *)" ) , ( "ContentType" , Detail "()" ) ])) ) ])) )])
Synopsis
- class HasParsableEndpoint e where
- class HasParsableApi api where
- symbolVal' :: forall n. KnownSymbol n => Text
- toDetails :: [(Text, Details)] -> Details
- typeText :: forall a. Typeable a => Text
Documentation
class HasParsableEndpoint e where Source #
Folds an api endpoint into documentation
Methods
Arguments
:: Route | Route documentation |
-> [(Parameter, Details)] | Everything else documentation |
-> (Route, OMap Parameter Details) | Generated documentation for the route |
We use this to destructure the API type and convert it into documentation
Instances
class HasParsableApi api where Source #
Flattens API into type level list of Endpoints
Instances
HasCollatable (Endpoints a) => HasParsableApi (a :: Type) Source # | If the flattened API can be collated into documentation, it is parsable |
Defined in Servant.Docs.Simple.Parse | |
HasParsableApi EmptyAPI Source # | Empty APIs should have no documentation |
Defined in Servant.Docs.Simple.Parse |
symbolVal' :: forall n. KnownSymbol n => Text Source #
Convert symbol to Text