Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module allows you to serve a Mu Server
as an OpenAPI Swagger REST end-point.
In particular, it translates to the kind of
type-level APIs used by Servant.
Synopsis
- servantServerHandlers :: forall pname m chn ss handlers. (ServantServiceHandlers ('Package pname ss) m chn ss handlers, ExtraFor ('Package pname ss) ~ EmptyAPI) => (forall a. m a -> Handler a) -> ServerT chn () ('Package pname ss) m handlers -> Server (PackageAPI ('Package pname ss) handlers)
- servantServerHandlersExtra :: forall pname m chn ss handlers. ServantServiceHandlers ('Package pname ss) m chn ss handlers => (forall a. m a -> Handler a) -> Server (ExtraFor ('Package pname ss)) -> ServerT chn () ('Package pname ss) m handlers -> Server (PackageAPI ('Package pname ss) handlers)
- toHandler :: ServerErrorIO a -> Handler a
- packageAPI :: ServerT chn t pkg s handlers -> Proxy (PackageAPI pkg handlers)
- swagger :: forall pname ss handlers chn m. HasSwagger (ServicesAPI ('Package pname ss) ss handlers) => ServerT chn () ('Package pname ss) m handlers -> Swagger
- data ServantRoute
- type DefaultServantContentTypes = 'ServantContentTypes '[JSON] ('Just ('ServantStreamContentType NewlineFraming JSON))
- data ServantContentTypes = ServantContentTypes {
- unary :: [Type]
- stream :: Maybe ServantStreamContentType
- data ServantStreamContentType = ServantStreamContentType {
- framing :: Type
- streamContentType :: Type
- data StdMethod
- module Servant.API
Convert Mu to Servant
servantServerHandlers Source #
:: forall pname m chn ss handlers. (ServantServiceHandlers ('Package pname ss) m chn ss handlers, ExtraFor ('Package pname ss) ~ EmptyAPI) | |
=> (forall a. m a -> Handler a) | how to turn the inner Mu monad into |
-> ServerT chn () ('Package pname ss) m handlers | server to be converted |
-> Server (PackageAPI ('Package pname ss) handlers) |
Converts a Mu server into Servant server
by running all Mu handler actions in the Handler
type.
This version assumes no additional routes
in the Servant server when compared to Mu's.
servantServerHandlersExtra Source #
:: forall pname m chn ss handlers. ServantServiceHandlers ('Package pname ss) m chn ss handlers | |
=> (forall a. m a -> Handler a) | how to turn the inner Mu monad into |
-> Server (ExtraFor ('Package pname ss)) | additional handler for the extra route |
-> ServerT chn () ('Package pname ss) m handlers | server to be converted |
-> Server (PackageAPI ('Package pname ss) handlers) |
Converts a Mu server into Servant server
by running all Mu handler actions in the Handler
type.
This version should be used when additional
routes have been added in the Servant version.
toHandler :: ServerErrorIO a -> Handler a Source #
Reinterprets a Mu server action as a Servant handler.
packageAPI :: ServerT chn t pkg s handlers -> Proxy (PackageAPI pkg handlers) Source #
swagger :: forall pname ss handlers chn m. HasSwagger (ServicesAPI ('Package pname ss) ss handlers) => ServerT chn () ('Package pname ss) m handlers -> Swagger Source #
Converts the information from a Mu server
into a Swagger
document.
Required annotations
data ServantRoute Source #
ServantRoute represents the URL path components of a route. It is used as an AnnotatedPackage
domain to override the default path for a Method
. When used in an AnnService
, the specified TopLevelRoute
is used as a prefix for all Method
s in that Service
.
1. List of components for the route,
2. HTTP method which must be used,
3. HTTP status code of a successful HTTP response from a specific Method
. Use 200 for the usual status code.
type DefaultServantContentTypes = 'ServantContentTypes '[JSON] ('Just ('ServantStreamContentType NewlineFraming JSON)) Source #
data ServantContentTypes Source #
ServantContentTypes represents that acceptable content types that can be used when a message in encoded:
1. in a unary (non-streaming) HTTP request/response body,
2. encoded in a streaming HTTP request/response body.
It is used as an AnnotatedSchema
domain.
HTTP standard method (as defined by RFC 2616, and PATCH which is defined by RFC 5789).
Instances
module Servant.API