Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class HasSwagger api where
- subOperations :: forall sub api. (IsSubAPI sub api, HasSwagger sub) => Proxy sub -> Proxy api -> Traversal' Swagger Operation
- addTag :: TagName -> Operation -> Operation
- setResponse :: HttpStatusCode -> Response -> Operation -> Operation
- (</>) :: FilePath -> FilePath -> FilePath
- mkEndpoint :: forall a cs hs proxy _verb. (ToSchema a, AllAccept cs, AllToResponseHeader hs) => FilePath -> Lens' PathItem (Maybe Operation) -> HttpStatusCode -> proxy (_verb cs (Headers hs a)) -> Swagger
- noContentEndpoint :: forall cs proxy verb. AllAccept cs => FilePath -> Lens' PathItem (Maybe Operation) -> proxy (verb cs ()) -> Swagger
- mkEndpointWithSchemaRef :: forall cs hs proxy verb a. (AllAccept cs, AllToResponseHeader hs) => Maybe (Referenced Schema) -> FilePath -> Lens' PathItem (Maybe Operation) -> HttpStatusCode -> proxy (verb cs (Headers hs a)) -> Swagger
- prependPath :: FilePath -> Swagger -> Swagger
- addParam :: Param -> Swagger -> Swagger
- addConsumes :: [MediaType] -> Swagger -> Swagger
- addResponseWith :: (Response -> Response -> Response) -> HttpStatusCode -> Response -> Swagger -> Swagger
- addResponse :: HttpStatusCode -> Response -> Swagger -> Swagger
- addDefaultResponse404 :: ParamName -> Swagger -> Swagger
- addDefaultResponse400 :: ParamName -> Swagger -> Swagger
- class AllAccept cs where
- allContentType :: Proxy cs -> [MediaType]
- class ToResponseHeader h where
- toResponseHeader :: Proxy h -> (HeaderName, Header)
- class AllToResponseHeader hs where
- toAllResponseHeaders :: Proxy hs -> HashMap HeaderName Header
- type family AllIsElem xs api :: Constraint
- type family MapSub e xs
- type family AppendList xs ys
- type family EndpointsList api
- type family IsSubAPI sub api :: Constraint
- type family Or a b :: Constraint
- type family IsIn sub api :: Constraint
Documentation
class HasSwagger api where Source
subOperations :: forall sub api. (IsSubAPI sub api, HasSwagger sub) => Proxy sub -> Proxy api -> Traversal' Swagger Operation Source
All operations of sub API.
setResponse :: HttpStatusCode -> Response -> Operation -> Operation Source
Set a response for an operation.
mkEndpoint :: forall a cs hs proxy _verb. (ToSchema a, AllAccept cs, AllToResponseHeader hs) => FilePath -> Lens' PathItem (Maybe Operation) -> HttpStatusCode -> proxy (_verb cs (Headers hs a)) -> Swagger Source
noContentEndpoint :: forall cs proxy verb. AllAccept cs => FilePath -> Lens' PathItem (Maybe Operation) -> proxy (verb cs ()) -> Swagger Source
mkEndpointWithSchemaRef :: forall cs hs proxy verb a. (AllAccept cs, AllToResponseHeader hs) => Maybe (Referenced Schema) -> FilePath -> Lens' PathItem (Maybe Operation) -> HttpStatusCode -> proxy (verb cs (Headers hs a)) -> Swagger Source
prependPath :: FilePath -> Swagger -> Swagger Source
Prepend path to all API endpoints.
addConsumes :: [MediaType] -> Swagger -> Swagger Source
Add accepted content types to every operation in the spec.
addResponseWith :: (Response -> Response -> Response) -> HttpStatusCode -> Response -> Swagger -> Swagger Source
Add/modify response for every operation in the spec.
addResponse :: HttpStatusCode -> Response -> Swagger -> Swagger Source
Add/overwrite response for every operation in the spec.
addDefaultResponse404 :: ParamName -> Swagger -> Swagger Source
addDefaultResponse400 :: ParamName -> Swagger -> Swagger Source
class ToResponseHeader h where Source
toResponseHeader :: Proxy h -> (HeaderName, Header) Source
(KnownSymbol sym, ToParamSchema a) => ToResponseHeader * (Header sym a) Source |
class AllToResponseHeader hs where Source
toAllResponseHeaders :: Proxy hs -> HashMap HeaderName Header Source
AllToResponseHeader [*] hs => AllToResponseHeader * (HList hs) Source | |
AllToResponseHeader [k] ([] k) Source | |
(ToResponseHeader k h, AllToResponseHeader [k] hs) => AllToResponseHeader [k] ((:) k h hs) Source |
type family AllIsElem xs api :: Constraint Source
Check that every element of xs
is an endpoint of api
.
type family AppendList xs ys Source
Append two type-level lists.
AppendList `[]` ys = ys | |
AppendList (x : xs) ys = x : AppendList xs ys |
type family EndpointsList api Source
Build a list of endpoints from an API.
EndpointsList (a :<|> b) = AppendList (EndpointsList a) (EndpointsList b) | |
EndpointsList (e :> a) = MapSub e (EndpointsList a) | |
EndpointsList a = `[a]` |
type family IsSubAPI sub api :: Constraint Source
Check whether sub
is a sub API of api
.
IsSubAPI sub api = AllIsElem (EndpointsList sub) api |
type family Or a b :: Constraint Source