Yoga.Fastify.Om.Route
- Package
- purescript-yoga-fastify-om
- Repository
- rowtype-yoga/purescript-yoga-fastify-om
Re-exports from Data.Variant
#Variant Source
data Variant :: Row Type -> Typedata Variant t0
Instances
(RowToList r rl, VariantTags rl, VariantEqs rl) => Eq (Variant r)(RowToList r rl, VariantTags rl, VariantEqs rl, VariantOrds rl, VariantBounded rl) => Bounded (Variant r)(RowToList r rl, VariantTags rl, VariantEqs rl, VariantOrds rl, VariantBoundedEnums rl) => Enum (Variant r)(RowToList r rl, VariantTags rl, VariantEqs rl, VariantOrds rl, VariantBoundedEnums rl) => BoundedEnum (Variant r)(RowToList r rl, VariantTags rl, VariantEqs rl, VariantOrds rl) => Ord (Variant r)(RowToList r rl, VariantTags rl, VariantShows rl) => Show (Variant r)
Re-exports from Yoga.Fastify.Om.Route.OmHandler
#Handler Source
#BuildErrorHandlers Source
class BuildErrorHandlers :: RowList Type -> Row Type -> Row Type -> Constraintclass BuildErrorHandlers (rl :: RowList Type) (respVariant :: Row Type) (handlers :: Row Type) | rl respVariant -> handlers where
Build a record of handlers for Variant.onMatch that convert each
error variant label into the full response variant.
Members
Instances
BuildErrorHandlers Nil respVariant ()(IsSymbol label, Cons label ty _r1 respVariant, BuildErrorHandlers tail respVariant tailHandlers, Cons label (ty -> Om ctx () (Variant respVariant)) tailHandlers handlers, Lacks label tailHandlers) => BuildErrorHandlers (Cons label ty tail) respVariant handlers
#Is2xxStatus Source
class Is2xxStatus :: Symbol -> Boolean -> Constraintclass Is2xxStatus (label :: Symbol) (is2xx :: Boolean) | label -> is2xx
Determine whether a variant label corresponds to a 2xx HTTP status code.
Instances
Is2xxStatus "ok" TrueIs2xxStatus "created" TrueIs2xxStatus "accepted" TrueIs2xxStatus "noContent" TrueIs2xxStatus label False
#RouteResponseVariant Source
class RouteResponseVariant :: Type -> Row Type -> Constraintclass RouteResponseVariant (route :: Type) (respVariant :: Row Type) | route -> respVariant
Instances
(ConvertResponseVariant userResp respVariant) => RouteResponseVariant (Route method segments request userResp) respVariant
#SplitResponse Source
class SplitResponse :: Row Type -> Row Type -> Row Type -> Constraintclass SplitResponse (respVariant :: Row Type) (successRow :: Row Type) (errorRow :: Row Type) | respVariant -> successRow errorRow
Split a response variant row into success (2xx) and error (non-2xx) sub-rows.
Instances
(RowToList respVariant rl, SplitResponseRL rl successRow errorRow) => SplitResponse respVariant successRow errorRow
#SplitResponseEntry Source
class SplitResponseEntry :: Boolean -> Symbol -> Type -> RowList Type -> Row Type -> Row Type -> Constraintclass SplitResponseEntry (is2xx :: Boolean) (label :: Symbol) (ty :: Type) (tail :: RowList Type) (successRow :: Row Type) (errorRow :: Row Type) | is2xx label ty tail -> successRow errorRow
Dispatch based on Is2xxStatus result.
Instances
(SplitResponseRL tail successTail errorRow, Cons label ty successTail successRow, Lacks label successTail) => SplitResponseEntry True label ty tail successRow errorRow(SplitResponseRL tail successRow errorTail, Cons label ty errorTail errorRow, Lacks label errorTail) => SplitResponseEntry False label ty tail successRow errorRow
#SplitResponseRL Source
class SplitResponseRL :: RowList Type -> Row Type -> Row Type -> Constraintclass SplitResponseRL (rl :: RowList Type) (successRow :: Row Type) (errorRow :: Row Type) | rl -> successRow errorRow
Instances
SplitResponseRL Nil () ()(Is2xxStatus label is2xx, SplitResponseEntry is2xx label ty tail successRow errorRow) => SplitResponseRL (Cons label ty tail) successRow errorRow
#ToLabel Source
class ToLabel :: Type -> Symbol -> Constraintclass ToLabel labelOrCode label | labelOrCode -> label
Convert either a status code (Int) or label (Symbol) to a label (Symbol). This allows functions to accept both @404 and @"notFound" polymorphically.
Instances
(StatusCodeToLabel code label) => ToLabel (Proxy code) labelToLabel (Proxy label) label
#respondWith Source
respondWith :: forall @labelOrCode label headers body r1 r2 ctx err. ToLabel (Proxy labelOrCode) label => IsSymbol label => Cons label (Response headers body) r1 r2 => Record headers -> body -> Om ctx err (Variant r2)Return a response with a specific reason label or status code and custom headers
Example:
respondWith @"created" { "Location": "/users/123" } user
respondWith @201 { "Location": "/users/123" } user
#respondNotModified Source
respondNotModified :: forall ctx err r. Om ctx err (Variant (notModified :: Response () Unit | r))Return a 304 Not Modified response (no headers, no body).
Example:
respondNotModified
#respondNoContent Source
respondNoContent :: forall ctx err r. Om ctx err (Variant (noContent :: Response () Unit | r))Return a 204 No Content response (no headers, no body).
Example:
respondNoContent
#respond Source
respond :: forall @labelOrCode label body r1 r2 ctx err. ToLabel (Proxy labelOrCode) label => IsSymbol label => Cons label (Response () body) r1 r2 => body -> Om ctx err (Variant r2)Return a response with a specific reason label or status code
Example:
respond @"ok" { id: 1, name: "Alice" }
respond @200 { id: 1, name: "Alice" }
respond @"created" newUser
respond @201 newUser
#rejectWith Source
rejectWith :: forall @labelOrCode label headers body _r1 err _r2 ctx a. ToLabel (Proxy labelOrCode) label => IsSymbol label => Cons label (Response headers body) _r1 err => Cons label (Response headers body) _r2 (exception :: Error | err) => Record headers -> body -> Om ctx err aThrow a non-2xx error response with custom headers (short-circuits)
Example:
rejectWith @"unauthorized" { "WWW-Authenticate": "Bearer" } { error: "Invalid token" }
rejectWith @401 { "WWW-Authenticate": "Bearer" } { error: "Invalid token" }
#reject Source
reject :: forall @labelOrCode label body _r1 err _r2 ctx a. ToLabel (Proxy labelOrCode) label => IsSymbol label => Cons label (Response () body) _r1 err => Cons label (Response () body) _r2 (exception :: Error | err) => body -> Om ctx err aThrow a non-2xx error response (short-circuits the handler)
Example:
reject @"notFound" { error: "User not found" }
reject @404 { error: "User not found" }
reject @"badRequest" { error: "Invalid input" }
reject @400 { error: "Invalid input" }
#mapReject Source
mapReject :: forall @from @toLabelOrCode toLabel tyIn body ctx errIn errMid errOut a. IsSymbol from => ToLabel (Proxy toLabelOrCode) toLabel => IsSymbol toLabel => Cons from tyIn (exception :: Error | errMid) (exception :: Error | errIn) => Cons toLabel (Response () body) (exception :: Error | errMid) (exception :: Error | errOut) => (tyIn -> body) -> Om ctx errIn a -> Om ctx errOut a#handle Source
handle :: forall @route pathParams queryParams reqHeaders body respVariant successRow errorRow extraCtx. RouteHandler route pathParams queryParams reqHeaders body respVariant => SplitResponse respVariant successRow errorRow => Lacks "_respondNow" errorRow => Lacks "path" extraCtx => Lacks "query" extraCtx => Lacks "headers" extraCtx => Lacks "body" extraCtx => Om { body :: body, headers :: Record reqHeaders, path :: Record pathParams, query :: Record queryParams | extraCtx } (_respondNow :: Variant successRow | errorRow) (Variant successRow) -> Handler route extraCtxCreate a Handler from an Om computation.
The Om computation receives the request context (path, query, headers, body)
plus any extra dependencies via ask. Request field types are verified
against the route at compile time.
Example:
putUserHandler :: Handler PutUser (userRepo :: UserRepo)
putUserHandler = handle do
{ path, body, userRepo } <- ask
existing <- userRepo.findByName path.name # liftAff
case existing of
Just user -> respond @"ok" user
Nothing -> do
user <- userRepo.create path.name body.email # liftAff
respond @"created" user
Re-exports from Yoga.Fastify.Route.HandleResponse
#HandleResponse Source
class HandleResponse :: Row Type -> Constraintclass HandleResponse (respVariant :: Row Type) where
Members
handleResponse :: Proxy respVariant -> Variant respVariant -> FastifyReply -> Aff Unit
Instances
(RowToList respVariant rl, HandleResponseRL rl respVariant) => HandleResponse respVariant
Re-exports from Yoga.Fastify.Route.HandleRoute
#handleRoute Source
handleRoute :: forall method segments partialRequest o_ fullHeaders fullCookies fullEncoding userResp respVariant pathParams queryParams body. Union partialRequest o_ (body :: fullEncoding, cookies :: Record fullCookies, headers :: Record fullHeaders) => DefaultRequestFields partialRequest fullHeaders fullCookies fullEncoding => RenderMethod method => PathPattern segments => SegmentPathParams segments pathParams => SegmentQueryParams segments queryParams => EncodingBody fullEncoding body => ParsePathParams pathParams => ParseQueryParamsFromObject queryParams => ParseHeaders fullHeaders => ParseBody fullEncoding body => ConvertResponseVariant userResp respVariant => HandleResponse respVariant => RouteHandler (Route method segments (Request (Record partialRequest)) userResp) pathParams queryParams fullHeaders body respVariant => Handler (Route method segments (Request (Record partialRequest)) userResp) -> Fastify -> Effect UnitRe-exports from Yoga.Fastify.Route.ParseBody
#ParseBody Source
Re-exports from Yoga.Fastify.Route.ParseHeaders
#ParseHeaders Source
class ParseHeaders :: Row Type -> Constraintclass ParseHeaders (headers :: Row Type) where
Parse a record of headers from an Object, accumulating all errors
Returns Either (NonEmptyArray HeaderError) (Record headers) to collect all parsing errors
Examples: parseHeaders (Proxy :: Proxy (auth :: String)) obj -- Left (NEA.singleton (MissingHeader "auth")) if missing -- Right { auth: "Bearer token" } if present
Members
parseHeaders :: Proxy headers -> Object String -> Either (NonEmptyArray HeaderError) (Record headers)
Instances
(RowToList headers rl, ParseHeadersRL rl headers) => ParseHeaders headers
#ParseHeadersRL Source
class ParseHeadersRL :: RowList Type -> Row Type -> Constraintclass ParseHeadersRL (rl :: RowList Type) (headers :: Row Type) | rl -> headers where
Helper class using RowList to accumulate errors
Members
parseHeadersRL :: Proxy rl -> Object String -> Either (NonEmptyArray HeaderError) (Record headers)
Instances
ParseHeadersRL Nil ()(IsSymbol name, HeaderValue ty, ParseHeadersRL tail tailRow, Cons name ty tailRow headers, Lacks name tailRow) => ParseHeadersRL (Cons name ty tail) headers
Re-exports from Yoga.Fastify.Route.ParsePathParams
#ParsePathParams Source
class ParsePathParams :: Row Type -> Constraintclass ParsePathParams (params :: Row Type) where
Members
Instances
(RowToList params rl, ParsePathParamsRL rl params) => ParsePathParams params
Re-exports from Yoga.Fastify.Route.ParseQueryParams
#ParseQueryParamsFromObject Source
class ParseQueryParamsFromObject :: Row Type -> Constraintclass ParseQueryParamsFromObject (query :: Row Type) where
Members
Instances
(RowToList query rl, ParseQueryParamsFromObjectRL rl query) => ParseQueryParamsFromObject query
Re-exports from Yoga.Fastify.Route.SetHeaders
#SetHeaders Source
class SetHeaders :: Row Type -> Constraintclass SetHeaders (headers :: Row Type) where
Members
setHeaders :: Record headers -> FastifyReply -> Effect FastifyReply
Instances
(RowToList headers rl, SetHeadersRL rl headers) => SetHeaders headers
Re-exports from Yoga.HTTP.API.Route.BearerToken
#BearerToken Source
newtype BearerTokenBearer token newtype that validates the "Bearer " prefix
Example: parseHeader "Bearer abc123" :: Either String BearerToken = Right (BearerToken "abc123") parseHeader "abc123" :: Either String BearerToken = Left "missing 'Bearer ' prefix"
Constructors
Instances
Re-exports from Yoga.HTTP.API.Route.Encoding
#NoBody Source
data NoBodyNo request body (for GET, DELETE, etc.)
Example: Request {} -- NoBody is the default when body is omitted
#FormData Source
data FormData aForm data encoded request body (application/x-www-form-urlencoded)
Example: Request { body :: FormData { username :: String, password :: String } }
Re-exports from Yoga.HTTP.API.Route.Handler
#HandlerFn Source
type HandlerFn :: Row Type -> Row Type -> Row Type -> Type -> Row Type -> Typetype HandlerFn pathParams queryParams reqHeaders body respVariant = { body :: body, headers :: Record reqHeaders, path :: Record pathParams, query :: Record queryParams } -> Aff (Variant respVariant)
Type-safe handler tied to a route's computed types.
Usage: myHandler :: Handler (id :: Int) (limit :: Maybe Int) (authorization :: BearerToken) User (ok :: ResponseData () (Array Post), notFound :: ResponseData () ErrorMessage) myHandler { path, query, headers, body } = do -- path :: { id :: Int } -- query :: { limit :: Maybe Int } -- headers :: { authorization :: BearerToken } -- body :: User pure $ respondNoHeaders (Proxy :: _ "ok") []
#CaptureParams Source
class CaptureParams :: forall k. k -> Row Type -> Constraintclass CaptureParams segs (params :: Row Type) | segs -> params
Walk the path segments and collect all Capture/Param entries into a row.
Instances
(CaptureParams left leftParams, CaptureParams right rightParams, Union leftParams rightParams params, Nub params params) => CaptureParams (PathCons left right) params(Cons name ty () params, Lacks name ()) => CaptureParams (Capture name ty) params(Cons name ty () params, Lacks name ()) => CaptureParams (Param name ty) params(CaptureParams segs params) => CaptureParams (Path segs) paramsCaptureParams s ()
#EncodingBody Source
class EncodingBody (encoding :: Type) (body :: Type) | encoding -> bodyMap encoding phantom types to the runtime body type the handler receives.
Instances
EncodingBody (JSON a) aEncodingBody NoBody UnitEncodingBody (Record row) (Record row)
#RequestBody Source
class RequestBody (request :: Type) (encoding :: Type) | request -> encodingExtract the body encoding type from a request record type.
The request is expected to have a body field.
Instances
(Cons "body" encoding _rest requestRow) => RequestBody (Record requestRow) encoding
#RequestHeaders Source
class RequestHeaders :: Type -> Row Type -> Constraintclass RequestHeaders (request :: Type) (headers :: Row Type) | request -> headers
Extract the headers row from a request record type.
The request is expected to have a headers field.
Instances
(Cons "headers" (Record headers) _rest requestRow) => RequestHeaders (Record requestRow) headers
#SegmentPathParams Source
class SegmentPathParams :: forall k. k -> Row Type -> Constraintclass SegmentPathParams segments params | segments -> params
Extract the row of typed path parameters from a path segments type.
Instances
(CaptureParams path params) => SegmentPathParams (QueryParams path (Record q)) params(CaptureParams segs params) => SegmentPathParams segs params
#SegmentQueryParams Source
class SegmentQueryParams :: forall k. k -> Row Type -> Constraintclass SegmentQueryParams segments query | segments -> query
Extract the row of typed query parameters from a path segments type.
Instances
(RowToList params rl, SegmentQueryParamsRL rl query) => SegmentQueryParams (QueryParams path (Record params)) querySegmentQueryParams segs ()
#SegmentQueryParamsRL Source
class SegmentQueryParamsRL :: RowList Type -> Row Type -> Constraintclass SegmentQueryParamsRL (rl :: RowList Type) (query :: Row Type) | rl -> query
RowList-based processing of query param rows. Required ty → ty (plain), otherwise → Maybe ty
Instances
SegmentQueryParamsRL Nil ()(SegmentQueryParamsRL tail tailQuery, Cons name ty tailQuery query, Lacks name tailQuery) => SegmentQueryParamsRL (Cons name (Required ty) tail) query(SegmentQueryParamsRL tail tailQuery, Cons name (Maybe ty) tailQuery query, Lacks name tailQuery) => SegmentQueryParamsRL (Cons name ty tail) query
Re-exports from Yoga.HTTP.API.Route.HeaderError
#HeaderError Source
Re-exports from Yoga.HTTP.API.Route.HeaderValue
#HeaderValue Source
class HeaderValue a whereTypeclass for values that can be parsed from and printed to HTTP header strings
This mirrors the ParseParam pattern from path parsing and allows headers
to be typed beyond just strings.
Returns Either String for detailed error messages (the string is the reason, not the header name).
Examples: parseHeader "42" :: Either String Int = Right 42 parseHeader "bad" :: Either String Int = Left "not a valid integer" printHeader 42 = "42" parseHeader "hello" :: Either String String = Right "hello"
Members
parseHeader :: String -> Either String aprintHeader :: a -> String
Instances
HeaderValue StringHeaderValue IntInteger headers are parsed from strings
(HeaderValue a) => HeaderValue (Maybe a)Optional headers (Maybe a) where a has HeaderValue This instance allows headers to be optional Note: parseHeader always succeeds for Maybe types (returns Just or Nothing)
#HeaderValueType Source
class HeaderValueType (ty :: Type) whereGet OpenAPI type string for a HeaderValue type
Members
headerValueType :: Proxy ty -> String
Instances
Re-exports from Yoga.HTTP.API.Route.Method
Re-exports from Yoga.HTTP.API.Route.OpenAPI
#ServerObject Source
type ServerObject = { description :: Maybe String, url :: String }Type for OpenAPI server object
#OpenAPISpec Source
#CollectOperations Source
class CollectOperations (routes :: Type) whereCollect OpenAPI operations from a type-level structure of routes. Use a Record to combine multiple named routes: CollectOperations { getUser :: RouteA, createUser :: RouteB }
Members
collectOperations :: Proxy routes -> Array OperationEntry
Instances
(RowToList row rl, CollectNamedOperationsRL rl) => CollectOperations (Record row)
#RenderHeadersSchema Source
class RenderHeadersSchema :: Row Type -> Constraintclass RenderHeadersSchema (headers :: Row Type) where
Render headers row as OpenAPI parameter array
Members
renderHeadersSchema :: Proxy headers -> Array Foreign
Instances
(RowToList headers rl, RenderHeadersSchemaRL rl headers) => RenderHeadersSchema headers
#RenderHeadersSchemaRL Source
class RenderHeadersSchemaRL :: RowList Type -> Row Type -> Constraintclass RenderHeadersSchemaRL (rl :: RowList Type) (headers :: Row Type) | rl -> headers where
Helper class using RowList
Members
renderHeadersSchemaRL :: Proxy rl -> Array Foreign
Instances
RenderHeadersSchemaRL Nil ()(RenderHeadersSchemaRL tail tailRow, Cons name BearerToken tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name BearerToken tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Description desc BearerToken) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Description desc BearerToken) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Example ex BearerToken) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Example ex BearerToken) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Deprecated BearerToken) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Deprecated BearerToken) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name BasicAuth tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name BasicAuth tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Description desc BasicAuth) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Description desc BasicAuth) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Example ex BasicAuth) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Example ex BasicAuth) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Deprecated BasicAuth) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Deprecated BasicAuth) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name ApiKeyHeader tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name ApiKeyHeader tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Description desc ApiKeyHeader) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Description desc ApiKeyHeader) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Example ex ApiKeyHeader) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Example ex ApiKeyHeader) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Deprecated ApiKeyHeader) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Deprecated ApiKeyHeader) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name DigestAuth tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name DigestAuth tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Description desc DigestAuth) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Description desc DigestAuth) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Example ex DigestAuth) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Example ex DigestAuth) tail) headers(RenderHeadersSchemaRL tail tailRow, Cons name (Deprecated DigestAuth) tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name (Deprecated DigestAuth) tail) headers(IsSymbol name, HeaderValueType ty, HasDescription ty, HasExample ty, HasFormat ty, HasMinimum ty, HasMaximum ty, HasPattern ty, HasMinLength ty, HasMaxLength ty, HasTitle ty, HasNullable ty, HasDefault ty, HasDeprecated ty, HasEnum ty, HasExamples ty, RenderHeadersSchemaRL tail tailRow, Cons name ty tailRow headers, Lacks name tailRow) => RenderHeadersSchemaRL (Cons name ty tail) headers
#RenderJSONSchema Source
class RenderJSONSchema :: forall k. k -> Constraintclass RenderJSONSchema ty where
Render a PureScript type as an OpenAPI JSON schema
Members
renderJSONSchema :: Proxy ty -> Foreign
Instances
RenderJSONSchema StringRenderJSONSchema IntRenderJSONSchema NumberRenderJSONSchema BooleanRenderJSONSchema Unit(RenderJSONSchema a) => RenderJSONSchema (Array a)(RenderJSONSchema a) => RenderJSONSchema (Maybe a)(RowToList row rl, RenderRecordSchemaRL rl row) => RenderJSONSchema (Record row)(RenderJSONSchema a) => RenderJSONSchema (JSON a)(RenderJSONSchema a) => RenderJSONSchema (FormData a)(RenderJSONSchema a) => RenderJSONSchema (MultipartFormData a)RenderJSONSchema PlainText(RenderJSONSchema a) => RenderJSONSchema (XML a)(RenderJSONSchema a) => RenderJSONSchema (CustomContentType mime a)RenderJSONSchema NoBody(RenderJSONSchema a, IsSymbol desc) => RenderJSONSchema (Description desc a)(RenderJSONSchema a, IsSymbol ex) => RenderJSONSchema (Example ex a)(RenderJSONSchema a, IsSymbol fmt) => RenderJSONSchema (Format fmt a)(RenderJSONSchema a) => RenderJSONSchema (Nullable a)(RenderJSONSchema a) => RenderJSONSchema (Deprecated a)(RenderJSONSchema a, HasEnum (Enum a)) => RenderJSONSchema (Enum a)(RenderJSONSchema a) => RenderJSONSchema (Examples examplesRow a)(IsSymbol name, RenderJSONSchema a) => RenderJSONSchema (Schema name a)(RenderJSONSchema a, Reflectable v Int) => RenderJSONSchema (MinLength v a)(RenderJSONSchema a, Reflectable v Int) => RenderJSONSchema (MaxLength v a)(RenderJSONSchema a, Reflectable v Int) => RenderJSONSchema (Minimum v a)(RenderJSONSchema a, Reflectable v Int) => RenderJSONSchema (Maximum v a)(RenderJSONSchema a, IsSymbol pat) => RenderJSONSchema (Pattern pat a)(RenderJSONSchema a, IsSymbol t) => RenderJSONSchema (Title t a)(RenderJSONSchema a, IsSymbol val) => RenderJSONSchema (Default val a)
#RenderPathParamsSchema Source
class RenderPathParamsSchema :: Row Type -> Constraintclass RenderPathParamsSchema (params :: Row Type) where
Render path parameters row as OpenAPI parameter array
Members
renderPathParamsSchema :: Proxy params -> Array Foreign
Instances
(RowToList params rl, RenderPathParamsSchemaRL rl params) => RenderPathParamsSchema params
#RenderPathParamsSchemaRL Source
class RenderPathParamsSchemaRL :: RowList Type -> Row Type -> Constraintclass RenderPathParamsSchemaRL (rl :: RowList Type) (params :: Row Type) | rl -> params where
Helper class using RowList
Members
renderPathParamsSchemaRL :: Proxy rl -> Array Foreign
Instances
RenderPathParamsSchemaRL Nil ()(IsSymbol name, HeaderValueType ty, HasDescription ty, HasExample ty, HasFormat ty, HasMinimum ty, HasMaximum ty, HasPattern ty, HasMinLength ty, HasMaxLength ty, HasTitle ty, HasNullable ty, HasDefault ty, HasDeprecated ty, HasEnum ty, HasExamples ty, RenderPathParamsSchemaRL tail tailRow, Cons name ty tailRow params, Lacks name tailRow) => RenderPathParamsSchemaRL (Cons name ty tail) params
#RenderQueryParamsSchema Source
class RenderQueryParamsSchema :: Row Type -> Constraintclass RenderQueryParamsSchema (params :: Row Type) where
Render query parameters row as OpenAPI parameter array
Members
renderQueryParamsSchema :: Proxy params -> Array Foreign
Instances
(RowToList params rl, RenderQueryParamsSchemaRL rl params) => RenderQueryParamsSchema params
#RenderQueryParamsSchemaRL Source
class RenderQueryParamsSchemaRL :: RowList Type -> Row Type -> Constraintclass RenderQueryParamsSchemaRL (rl :: RowList Type) (params :: Row Type) | rl -> params where
Helper class using RowList
Members
renderQueryParamsSchemaRL :: Proxy rl -> Array Foreign
Instances
RenderQueryParamsSchemaRL Nil ()(IsSymbol name, HeaderValueType ty, HasDescription ty, HasExample ty, HasFormat ty, HasMinimum ty, HasMaximum ty, HasPattern ty, HasMinLength ty, HasMaxLength ty, HasTitle ty, HasNullable ty, HasDefault ty, HasDeprecated ty, HasEnum ty, HasExamples ty, RenderQueryParamsSchemaRL tail tailRow, Cons name ty tailRow params, Lacks name tailRow) => RenderQueryParamsSchemaRL (Cons name ty tail) params
#RenderRequestBodySchema Source
class RenderRequestBodySchema (encoding :: Type) whereRender request body schema for OpenAPI requestBody section Returns Nothing for NoBody, Just requestBody object for JSON/FormData
Members
renderRequestBodySchema :: Proxy encoding -> Maybe { content :: Foreign, required :: Boolean }
Instances
RenderRequestBodySchema NoBody(RenderJSONSchema a) => RenderRequestBodySchema (JSON a)(RenderJSONSchema a) => RenderRequestBodySchema (FormData a)(RenderJSONSchema a) => RenderRequestBodySchema (MultipartFormData a)RenderRequestBodySchema PlainText(RenderJSONSchema a) => RenderRequestBodySchema (XML a)(IsSymbol mime, RenderJSONSchema a) => RenderRequestBodySchema (CustomContentType mime a)(RenderJSONSchema (Record row)) => RenderRequestBodySchema (Record row)
#RenderResponseHeadersSchema Source
class RenderResponseHeadersSchema :: Row Type -> Constraintclass RenderResponseHeadersSchema (headers :: Row Type) where
Render response headers row as OpenAPI header object (for responses section)
Members
renderResponseHeadersSchema :: Proxy headers -> Object ResponseHeaderObject
Instances
(RowToList headers rl, RenderResponseHeadersSchemaRL rl headers) => RenderResponseHeadersSchema headers
#RenderResponseHeadersSchemaRL Source
class RenderResponseHeadersSchemaRL :: RowList Type -> Row Type -> Constraintclass RenderResponseHeadersSchemaRL (rl :: RowList Type) (headers :: Row Type) | rl -> headers where
Helper class using RowList
Members
Instances
RenderResponseHeadersSchemaRL Nil ()(IsSymbol name, HeaderValueType ty, HasDescription ty, HasExample ty, HasDeprecated ty, HasFormat ty, HasEnum ty, RenderResponseHeadersSchemaRL tail tailRow, Cons name ty tailRow headers, Lacks name tailRow) => RenderResponseHeadersSchemaRL (Cons name ty tail) headers
#RenderResponseSchema Source
class RenderResponseSchema :: Row Type -> Type -> Constraintclass RenderResponseSchema (headers :: Row Type) (body :: Type) where
Render complete response object for OpenAPI (status 200 with headers and body)
Members
renderResponseSchema :: Proxy headers -> Proxy body -> { "200" :: { content :: Foreign, description :: String, headers :: Object ResponseHeaderObject } }
Instances
(RenderResponseHeadersSchema headers, RenderJSONSchema body, GetContentType body) => RenderResponseSchema headers body
#RenderVariantResponseSchemaRL Source
class RenderVariantResponseSchemaRL :: RowList Type -> Constraintclass RenderVariantResponseSchemaRL (rl :: RowList Type) where
Helper class that processes RowList for variant responses
Members
Instances
RenderVariantResponseSchemaRL Nil(IsSymbol label, StatusCodeMap label, ToResponse recordType headers body, IsUnitBody body isUnit, RenderResponseContent isUnit headers body, RenderResponseHeadersSchema headers, RenderVariantResponseSchemaRL tail) => RenderVariantResponseSchemaRL (Cons label recordType tail)
#buildOpenAPISpec' Source
buildOpenAPISpec' :: forall @routes. CollectOperations routes => CollectRouteSchemas routes => ValidateSchemaNames routes => OpenAPIInfoUor -> { servers :: Opt (Array ServerObject) } -> OpenAPISpecBuild a complete OpenAPI 3.0 spec with optional servers configuration.
#buildOpenAPISpec Source
buildOpenAPISpec :: forall @routes r. CollectOperations routes => CollectRouteSchemas routes => ValidateSchemaNames routes => Options r (OpenAPIInfoR UndefinedOr) => Record r -> OpenAPISpecRe-exports from Yoga.HTTP.API.Route.OpenAPIMetadata
#Title Source
data Title :: Symbol -> Type -> Typedata Title t a
Attach a title to a type. Example: String # Title "UserName"
Instances
(HasDescription a) => HasDescription (Title t a)(HasExample a) => HasExample (Title t a)(HasFormat a) => HasFormat (Title t a)(HasMinimum a) => HasMinimum (Title t a)(HasMaximum a) => HasMaximum (Title t a)(HasPattern a) => HasPattern (Title t a)(HasMinLength a) => HasMinLength (Title t a)(HasMaxLength a) => HasMaxLength (Title t a)(IsSymbol t) => HasTitle (Title t a)(HasNullable a) => HasNullable (Title t a)(HasDefault a) => HasDefault (Title t a)(HasDeprecated a) => HasDeprecated (Title t a)(HasEnum a) => HasEnum (Title t a)(HasExamples a) => HasExamples (Title t a)(HasLinks a) => HasLinks (Title t a)(HeaderValue a) => HeaderValue (Title t a)(HeaderValueType a) => HeaderValueType (Title t a)(ParseParam a) => ParseParam (Title t a)(WriteForeign a) => WriteForeign (Title t a)(ReadForeign a) => ReadForeign (Title t a)
#Pattern Source
data Pattern :: Symbol -> Type -> Typedata Pattern pat a
Set a regex pattern constraint. Example: String # Pattern "^[a-z]+$"
Instances
(HasDescription a) => HasDescription (Pattern pat a)(HasExample a) => HasExample (Pattern pat a)(HasFormat a) => HasFormat (Pattern pat a)(HasMinimum a) => HasMinimum (Pattern pat a)(HasMaximum a) => HasMaximum (Pattern pat a)(IsSymbol pat) => HasPattern (Pattern pat a)(HasMinLength a) => HasMinLength (Pattern pat a)(HasMaxLength a) => HasMaxLength (Pattern pat a)(HasTitle a) => HasTitle (Pattern pat a)(HasNullable a) => HasNullable (Pattern pat a)(HasDefault a) => HasDefault (Pattern pat a)(HasDeprecated a) => HasDeprecated (Pattern pat a)(HasEnum a) => HasEnum (Pattern pat a)(HasExamples a) => HasExamples (Pattern pat a)(HasLinks a) => HasLinks (Pattern pat a)(IsSymbol pat, HeaderValue a) => HeaderValue (Pattern pat a)(HeaderValueType a) => HeaderValueType (Pattern pat a)(IsSymbol pat, ParseParam a) => ParseParam (Pattern pat a)(WriteForeign a) => WriteForeign (Pattern pat a)(ReadForeign a) => ReadForeign (Pattern pat a)
#Nullable Source
data Nullable aMark a type as nullable. Example: String # Nullable
Instances
(HasDescription a) => HasDescription (Nullable a)(HasExample a) => HasExample (Nullable a)(HasFormat a) => HasFormat (Nullable a)(HasMinimum a) => HasMinimum (Nullable a)(HasMaximum a) => HasMaximum (Nullable a)(HasPattern a) => HasPattern (Nullable a)(HasMinLength a) => HasMinLength (Nullable a)(HasMaxLength a) => HasMaxLength (Nullable a)(HasTitle a) => HasTitle (Nullable a)HasNullable (Nullable a)(HasDefault a) => HasDefault (Nullable a)(HasDeprecated a) => HasDeprecated (Nullable a)(HasEnum a) => HasEnum (Nullable a)(HasExamples a) => HasExamples (Nullable a)(HasLinks a) => HasLinks (Nullable a)(HeaderValue a) => HeaderValue (Nullable a)(HeaderValueType a) => HeaderValueType (Nullable a)(ParseParam a) => ParseParam (Nullable a)(WriteForeign a) => WriteForeign (Nullable a)(ReadForeign a) => ReadForeign (Nullable a)
#Minimum Source
data Minimum :: Int -> Type -> Typedata Minimum minVal a
Set a minimum value constraint. Example: Int # Minimum 1
Instances
(HasDescription a) => HasDescription (Minimum v a)(HasExample a) => HasExample (Minimum v a)(HasFormat a) => HasFormat (Minimum v a)(Reflectable v Int) => HasMinimum (Minimum v a)(HasMaximum a) => HasMaximum (Minimum v a)(HasPattern a) => HasPattern (Minimum v a)(HasMinLength a) => HasMinLength (Minimum v a)(HasMaxLength a) => HasMaxLength (Minimum v a)(HasTitle a) => HasTitle (Minimum v a)(HasNullable a) => HasNullable (Minimum v a)(HasDefault a) => HasDefault (Minimum v a)(HasDeprecated a) => HasDeprecated (Minimum v a)(HasEnum a) => HasEnum (Minimum v a)(HasExamples a) => HasExamples (Minimum v a)(HasLinks a) => HasLinks (Minimum v a)(Reflectable v Int, HeaderValue a) => HeaderValue (Minimum v a)(HeaderValueType a) => HeaderValueType (Minimum v a)(Reflectable v Int, ParseParam a) => ParseParam (Minimum v a)(WriteForeign a) => WriteForeign (Minimum v a)(ReadForeign a) => ReadForeign (Minimum v a)
#MinLength Source
data MinLength :: Int -> Type -> Typedata MinLength minLen a
Set a minimum string length constraint. Example: String # MinLength 1
Instances
(HasDescription a) => HasDescription (MinLength v a)(HasExample a) => HasExample (MinLength v a)(HasFormat a) => HasFormat (MinLength v a)(HasMinimum a) => HasMinimum (MinLength v a)(HasMaximum a) => HasMaximum (MinLength v a)(HasPattern a) => HasPattern (MinLength v a)(Reflectable v Int) => HasMinLength (MinLength v a)(HasMaxLength a) => HasMaxLength (MinLength v a)(HasTitle a) => HasTitle (MinLength v a)(HasNullable a) => HasNullable (MinLength v a)(HasDefault a) => HasDefault (MinLength v a)(HasDeprecated a) => HasDeprecated (MinLength v a)(HasEnum a) => HasEnum (MinLength v a)(HasExamples a) => HasExamples (MinLength v a)(HasLinks a) => HasLinks (MinLength v a)(Reflectable v Int, HeaderValue a) => HeaderValue (MinLength v a)(HeaderValueType a) => HeaderValueType (MinLength v a)(Reflectable v Int, ParseParam a) => ParseParam (MinLength v a)(WriteForeign a) => WriteForeign (MinLength v a)(ReadForeign a) => ReadForeign (MinLength v a)
#Maximum Source
data Maximum :: Int -> Type -> Typedata Maximum maxVal a
Set a maximum value constraint. Example: Int # Maximum 100
Instances
(HasDescription a) => HasDescription (Maximum v a)(HasExample a) => HasExample (Maximum v a)(HasFormat a) => HasFormat (Maximum v a)(HasMinimum a) => HasMinimum (Maximum v a)(Reflectable v Int) => HasMaximum (Maximum v a)(HasPattern a) => HasPattern (Maximum v a)(HasMinLength a) => HasMinLength (Maximum v a)(HasMaxLength a) => HasMaxLength (Maximum v a)(HasTitle a) => HasTitle (Maximum v a)(HasNullable a) => HasNullable (Maximum v a)(HasDefault a) => HasDefault (Maximum v a)(HasDeprecated a) => HasDeprecated (Maximum v a)(HasEnum a) => HasEnum (Maximum v a)(HasExamples a) => HasExamples (Maximum v a)(HasLinks a) => HasLinks (Maximum v a)(Reflectable v Int, HeaderValue a) => HeaderValue (Maximum v a)(HeaderValueType a) => HeaderValueType (Maximum v a)(Reflectable v Int, ParseParam a) => ParseParam (Maximum v a)(WriteForeign a) => WriteForeign (Maximum v a)(ReadForeign a) => ReadForeign (Maximum v a)
#MaxLength Source
data MaxLength :: Int -> Type -> Typedata MaxLength maxLen a
Set a maximum string length constraint. Example: String # MaxLength 255
Instances
(HasDescription a) => HasDescription (MaxLength v a)(HasExample a) => HasExample (MaxLength v a)(HasFormat a) => HasFormat (MaxLength v a)(HasMinimum a) => HasMinimum (MaxLength v a)(HasMaximum a) => HasMaximum (MaxLength v a)(HasPattern a) => HasPattern (MaxLength v a)(HasMinLength a) => HasMinLength (MaxLength v a)(Reflectable v Int) => HasMaxLength (MaxLength v a)(HasTitle a) => HasTitle (MaxLength v a)(HasNullable a) => HasNullable (MaxLength v a)(HasDefault a) => HasDefault (MaxLength v a)(HasDeprecated a) => HasDeprecated (MaxLength v a)(HasEnum a) => HasEnum (MaxLength v a)(HasExamples a) => HasExamples (MaxLength v a)(HasLinks a) => HasLinks (MaxLength v a)(Reflectable v Int, HeaderValue a) => HeaderValue (MaxLength v a)(HeaderValueType a) => HeaderValueType (MaxLength v a)(Reflectable v Int, ParseParam a) => ParseParam (MaxLength v a)(WriteForeign a) => WriteForeign (MaxLength v a)(ReadForeign a) => ReadForeign (MaxLength v a)
#Format Source
data Format :: Symbol -> Type -> Typedata Format formatStr a
Attach a format annotation to a type. Example: String # Format "email"
Instances
(HasDescription a) => HasDescription (Format fmt a)(HasExample a) => HasExample (Format fmt a)(IsSymbol fmt) => HasFormat (Format fmt a)(HasMinimum a) => HasMinimum (Format fmt a)(HasMaximum a) => HasMaximum (Format fmt a)(HasPattern a) => HasPattern (Format fmt a)(HasMinLength a) => HasMinLength (Format fmt a)(HasMaxLength a) => HasMaxLength (Format fmt a)(HasTitle a) => HasTitle (Format fmt a)(HasNullable a) => HasNullable (Format fmt a)(HasDefault a) => HasDefault (Format fmt a)(HasDeprecated a) => HasDeprecated (Format fmt a)(HasEnum a) => HasEnum (Format fmt a)(HasExamples a) => HasExamples (Format fmt a)(HasLinks a) => HasLinks (Format fmt a)(HeaderValue a) => HeaderValue (Format fmt a)(HeaderValueType a) => HeaderValueType (Format fmt a)(ParseParam a) => ParseParam (Format fmt a)(WriteForeign a) => WriteForeign (Format fmt a)(ReadForeign a) => ReadForeign (Format fmt a)
#Example Source
data Example :: Symbol -> Type -> Typedata Example exampleValue a
Attach an example value to a type. Example: Int # Example "123"
Instances
(HasDescription a) => HasDescription (Example ex a)(IsSymbol ex) => HasExample (Example ex a)(HasFormat a) => HasFormat (Example ex a)(HasMinimum a) => HasMinimum (Example ex a)(HasMaximum a) => HasMaximum (Example ex a)(HasPattern a) => HasPattern (Example ex a)(HasMinLength a) => HasMinLength (Example ex a)(HasMaxLength a) => HasMaxLength (Example ex a)(HasTitle a) => HasTitle (Example ex a)(HasNullable a) => HasNullable (Example ex a)(HasDefault a) => HasDefault (Example ex a)(HasDeprecated a) => HasDeprecated (Example ex a)(HasEnum a) => HasEnum (Example ex a)(HasExamples a) => HasExamples (Example ex a)(HasLinks a) => HasLinks (Example ex a)(HeaderValue a) => HeaderValue (Example ex a)(HeaderValueType a) => HeaderValueType (Example ex a)(ParseParam a) => ParseParam (Example ex a)(WriteForeign a) => WriteForeign (Example ex a)(ReadForeign a) => ReadForeign (Example ex a)
#Enum Source
data Enum aWrapper to use an enum type (sum type with no-argument constructors) in routes. The type parameter should be a Generic sum type, and enum values will be automatically extracted from its constructor names.
Example: data Status = Pending | Active | Completed derive instance Generic Status _
type StatusParam = Enum Status
Instances
(HasDescription a) => HasDescription (Enum a)(HasExample a) => HasExample (Enum a)(HasFormat a) => HasFormat (Enum a)(HasMinimum a) => HasMinimum (Enum a)(HasMaximum a) => HasMaximum (Enum a)(HasPattern a) => HasPattern (Enum a)(HasMinLength a) => HasMinLength (Enum a)(HasMaxLength a) => HasMaxLength (Enum a)(HasTitle a) => HasTitle (Enum a)(HasNullable a) => HasNullable (Enum a)(HasDefault a) => HasDefault (Enum a)(HasDeprecated a) => HasDeprecated (Enum a)(Generic a rep, GenericEnumValues rep) => HasEnum (Enum a)(HasExamples a) => HasExamples (Enum a)(HasLinks a) => HasLinks (Enum a)(HeaderValue a) => HeaderValue (Enum a)(HeaderValueType a) => HeaderValueType (Enum a)(ParseParam a) => ParseParam (Enum a)(WriteForeign a) => WriteForeign (Enum a)(ReadForeign a) => ReadForeign (Enum a)
#Description Source
data Description :: Symbol -> Type -> Typedata Description desc a
Attach a description to a type. Example: Int # Description "The unique identifier for a user"
Instances
(IsSymbol desc) => HasDescription (Description desc a)(HasExample a) => HasExample (Description desc a)(HasFormat a) => HasFormat (Description desc a)(HasMinimum a) => HasMinimum (Description desc a)(HasMaximum a) => HasMaximum (Description desc a)(HasPattern a) => HasPattern (Description desc a)(HasMinLength a) => HasMinLength (Description desc a)(HasMaxLength a) => HasMaxLength (Description desc a)(HasTitle a) => HasTitle (Description desc a)(HasNullable a) => HasNullable (Description desc a)(HasDefault a) => HasDefault (Description desc a)(HasDeprecated a) => HasDeprecated (Description desc a)(HasEnum a) => HasEnum (Description desc a)(HasExamples a) => HasExamples (Description desc a)(HasLinks a) => HasLinks (Description desc a)(HeaderValue a) => HeaderValue (Description desc a)(HeaderValueType a) => HeaderValueType (Description desc a)(ParseParam a) => ParseParam (Description desc a)(WriteForeign a) => WriteForeign (Description desc a)(ReadForeign a) => ReadForeign (Description desc a)
#Deprecated Source
data Deprecated aMark a type as deprecated. Example: Int # Deprecated
Instances
(HasDescription a) => HasDescription (Deprecated a)(HasExample a) => HasExample (Deprecated a)(HasFormat a) => HasFormat (Deprecated a)(HasMinimum a) => HasMinimum (Deprecated a)(HasMaximum a) => HasMaximum (Deprecated a)(HasPattern a) => HasPattern (Deprecated a)(HasMinLength a) => HasMinLength (Deprecated a)(HasMaxLength a) => HasMaxLength (Deprecated a)(HasTitle a) => HasTitle (Deprecated a)(HasNullable a) => HasNullable (Deprecated a)(HasDefault a) => HasDefault (Deprecated a)HasDeprecated (Deprecated a)(HasEnum a) => HasEnum (Deprecated a)(HasExamples a) => HasExamples (Deprecated a)(HasLinks a) => HasLinks (Deprecated a)(HeaderValue a) => HeaderValue (Deprecated a)(HeaderValueType a) => HeaderValueType (Deprecated a)(ParseParam a) => ParseParam (Deprecated a)(WriteForeign a) => WriteForeign (Deprecated a)(ReadForeign a) => ReadForeign (Deprecated a)
#Default Source
data Default :: Symbol -> Type -> Typedata Default val a
Set a default value. Example: Int # Default "10"
Instances
(HasDescription a) => HasDescription (Default val a)(HasExample a) => HasExample (Default val a)(HasFormat a) => HasFormat (Default val a)(HasMinimum a) => HasMinimum (Default val a)(HasMaximum a) => HasMaximum (Default val a)(HasPattern a) => HasPattern (Default val a)(HasMinLength a) => HasMinLength (Default val a)(HasMaxLength a) => HasMaxLength (Default val a)(HasTitle a) => HasTitle (Default val a)(HasNullable a) => HasNullable (Default val a)(IsSymbol val) => HasDefault (Default val a)(HasDeprecated a) => HasDeprecated (Default val a)(HasEnum a) => HasEnum (Default val a)(HasExamples a) => HasExamples (Default val a)(HasLinks a) => HasLinks (Default val a)(HeaderValue a) => HeaderValue (Default val a)(HeaderValueType a) => HeaderValueType (Default val a)(ParseParam a) => ParseParam (Default val a)(WriteForeign a) => WriteForeign (Default val a)(ReadForeign a) => ReadForeign (Default val a)
#GenericEnumValues Source
class GenericEnumValues rep whereExtract enum values from a Generic sum type representation. Walks through GR.Sum constructors and collects constructor names.
Members
genericEnumValues :: Proxy rep -> Array String
Instances
(GenericEnumValues a, GenericEnumValues b) => GenericEnumValues (Sum a b)(IsSymbol name) => GenericEnumValues (Constructor name NoArguments)
#HasDefault Source
class HasDefault ty whereMembers
Instances
(IsSymbol val) => HasDefault (Default val a)(HasDefault a) => HasDefault (Description desc a)(HasDefault a) => HasDefault (Example ex a)(HasDefault a) => HasDefault (Format fmt a)(HasDefault a) => HasDefault (Minimum v a)(HasDefault a) => HasDefault (Maximum v a)(HasDefault a) => HasDefault (Pattern pat a)(HasDefault a) => HasDefault (MinLength v a)(HasDefault a) => HasDefault (MaxLength v a)(HasDefault a) => HasDefault (Title t a)(HasDefault a) => HasDefault (Nullable a)(HasDefault a) => HasDefault (Deprecated a)(HasDefault a) => HasDefault (Enum a)(HasDefault a) => HasDefault (Schema name a)HasDefault ty
#HasDeprecated Source
class HasDeprecated ty whereMembers
deprecated :: Proxy ty -> Boolean
Instances
HasDeprecated (Deprecated a)(HasDeprecated a) => HasDeprecated (Description desc a)(HasDeprecated a) => HasDeprecated (Example ex a)(HasDeprecated a) => HasDeprecated (Format fmt a)(HasDeprecated a) => HasDeprecated (Minimum v a)(HasDeprecated a) => HasDeprecated (Maximum v a)(HasDeprecated a) => HasDeprecated (Pattern pat a)(HasDeprecated a) => HasDeprecated (MinLength v a)(HasDeprecated a) => HasDeprecated (MaxLength v a)(HasDeprecated a) => HasDeprecated (Title t a)(HasDeprecated a) => HasDeprecated (Nullable a)(HasDeprecated a) => HasDeprecated (Default val a)(HasDeprecated a) => HasDeprecated (Enum a)(HasDeprecated a) => HasDeprecated (Schema name a)HasDeprecated ty
#HasDescription Source
class HasDescription ty whereMembers
description :: Proxy ty -> Maybe String
Instances
(IsSymbol desc) => HasDescription (Description desc a)(HasDescription a) => HasDescription (Example ex a)(HasDescription a) => HasDescription (Format fmt a)(HasDescription a) => HasDescription (Minimum v a)(HasDescription a) => HasDescription (Maximum v a)(HasDescription a) => HasDescription (Pattern pat a)(HasDescription a) => HasDescription (MinLength v a)(HasDescription a) => HasDescription (MaxLength v a)(HasDescription a) => HasDescription (Title t a)(HasDescription a) => HasDescription (Nullable a)(HasDescription a) => HasDescription (Default val a)(HasDescription a) => HasDescription (Deprecated a)(HasDescription a) => HasDescription (Enum a)(HasDescription a) => HasDescription (Schema name a)HasDescription ty
#HasEnum Source
class HasEnum ty whereMembers
Instances
(Generic a rep, GenericEnumValues rep) => HasEnum (Enum a)(HasEnum a) => HasEnum (Description desc a)(HasEnum a) => HasEnum (Example ex a)(HasEnum a) => HasEnum (Format fmt a)(HasEnum a) => HasEnum (Minimum v a)(HasEnum a) => HasEnum (Maximum v a)(HasEnum a) => HasEnum (Pattern pat a)(HasEnum a) => HasEnum (MinLength v a)(HasEnum a) => HasEnum (MaxLength v a)(HasEnum a) => HasEnum (Title t a)(HasEnum a) => HasEnum (Nullable a)(HasEnum a) => HasEnum (Default val a)(HasEnum a) => HasEnum (Deprecated a)(HasEnum a) => HasEnum (Schema name a)HasEnum ty
#HasExample Source
class HasExample ty whereMembers
Instances
(IsSymbol ex) => HasExample (Example ex a)(HasExample a) => HasExample (Examples examplesRow a)(HasExample a) => HasExample (Description desc a)(HasExample a) => HasExample (Format fmt a)(HasExample a) => HasExample (Minimum v a)(HasExample a) => HasExample (Maximum v a)(HasExample a) => HasExample (Pattern pat a)(HasExample a) => HasExample (MinLength v a)(HasExample a) => HasExample (MaxLength v a)(HasExample a) => HasExample (Title t a)(HasExample a) => HasExample (Nullable a)(HasExample a) => HasExample (Default val a)(HasExample a) => HasExample (Deprecated a)(HasExample a) => HasExample (Enum a)(HasExample a) => HasExample (Schema name a)HasExample ty
#HasFormat Source
class HasFormat ty whereMembers
Instances
(IsSymbol fmt) => HasFormat (Format fmt a)(HasFormat a) => HasFormat (Description desc a)(HasFormat a) => HasFormat (Example ex a)(HasFormat a) => HasFormat (Minimum v a)(HasFormat a) => HasFormat (Maximum v a)(HasFormat a) => HasFormat (Pattern pat a)(HasFormat a) => HasFormat (MinLength v a)(HasFormat a) => HasFormat (MaxLength v a)(HasFormat a) => HasFormat (Title t a)(HasFormat a) => HasFormat (Nullable a)(HasFormat a) => HasFormat (Default val a)(HasFormat a) => HasFormat (Deprecated a)(HasFormat a) => HasFormat (Enum a)(HasFormat a) => HasFormat (Schema name a)HasFormat ty
#HasMaxLength Source
class HasMaxLength ty whereMembers
Instances
(Reflectable v Int) => HasMaxLength (MaxLength v a)(HasMaxLength a) => HasMaxLength (Description desc a)(HasMaxLength a) => HasMaxLength (Example ex a)(HasMaxLength a) => HasMaxLength (Format fmt a)(HasMaxLength a) => HasMaxLength (Minimum v a)(HasMaxLength a) => HasMaxLength (Maximum v a)(HasMaxLength a) => HasMaxLength (Pattern pat a)(HasMaxLength a) => HasMaxLength (MinLength v a)(HasMaxLength a) => HasMaxLength (Title t a)(HasMaxLength a) => HasMaxLength (Nullable a)(HasMaxLength a) => HasMaxLength (Default val a)(HasMaxLength a) => HasMaxLength (Deprecated a)(HasMaxLength a) => HasMaxLength (Enum a)(HasMaxLength a) => HasMaxLength (Schema name a)HasMaxLength ty
#HasMaximum Source
class HasMaximum ty whereMembers
Instances
(Reflectable v Int) => HasMaximum (Maximum v a)(HasMaximum a) => HasMaximum (Description desc a)(HasMaximum a) => HasMaximum (Example ex a)(HasMaximum a) => HasMaximum (Format fmt a)(HasMaximum a) => HasMaximum (Minimum v a)(HasMaximum a) => HasMaximum (Pattern pat a)(HasMaximum a) => HasMaximum (MinLength v a)(HasMaximum a) => HasMaximum (MaxLength v a)(HasMaximum a) => HasMaximum (Title t a)(HasMaximum a) => HasMaximum (Nullable a)(HasMaximum a) => HasMaximum (Default val a)(HasMaximum a) => HasMaximum (Deprecated a)(HasMaximum a) => HasMaximum (Enum a)(HasMaximum a) => HasMaximum (Schema name a)HasMaximum ty
#HasMinLength Source
class HasMinLength ty whereMembers
Instances
(Reflectable v Int) => HasMinLength (MinLength v a)(HasMinLength a) => HasMinLength (Description desc a)(HasMinLength a) => HasMinLength (Example ex a)(HasMinLength a) => HasMinLength (Format fmt a)(HasMinLength a) => HasMinLength (Minimum v a)(HasMinLength a) => HasMinLength (Maximum v a)(HasMinLength a) => HasMinLength (Pattern pat a)(HasMinLength a) => HasMinLength (MaxLength v a)(HasMinLength a) => HasMinLength (Title t a)(HasMinLength a) => HasMinLength (Nullable a)(HasMinLength a) => HasMinLength (Default val a)(HasMinLength a) => HasMinLength (Deprecated a)(HasMinLength a) => HasMinLength (Enum a)(HasMinLength a) => HasMinLength (Schema name a)HasMinLength ty
#HasMinimum Source
class HasMinimum ty whereMembers
Instances
(Reflectable v Int) => HasMinimum (Minimum v a)(HasMinimum a) => HasMinimum (Description desc a)(HasMinimum a) => HasMinimum (Example ex a)(HasMinimum a) => HasMinimum (Format fmt a)(HasMinimum a) => HasMinimum (Maximum v a)(HasMinimum a) => HasMinimum (Pattern pat a)(HasMinimum a) => HasMinimum (MinLength v a)(HasMinimum a) => HasMinimum (MaxLength v a)(HasMinimum a) => HasMinimum (Title t a)(HasMinimum a) => HasMinimum (Nullable a)(HasMinimum a) => HasMinimum (Default val a)(HasMinimum a) => HasMinimum (Deprecated a)(HasMinimum a) => HasMinimum (Enum a)(HasMinimum a) => HasMinimum (Schema name a)HasMinimum ty
#HasNullable Source
class HasNullable ty whereMembers
Instances
HasNullable (Nullable a)(HasNullable a) => HasNullable (Description desc a)(HasNullable a) => HasNullable (Example ex a)(HasNullable a) => HasNullable (Format fmt a)(HasNullable a) => HasNullable (Minimum v a)(HasNullable a) => HasNullable (Maximum v a)(HasNullable a) => HasNullable (Pattern pat a)(HasNullable a) => HasNullable (MinLength v a)(HasNullable a) => HasNullable (MaxLength v a)(HasNullable a) => HasNullable (Title t a)(HasNullable a) => HasNullable (Default val a)(HasNullable a) => HasNullable (Deprecated a)(HasNullable a) => HasNullable (Enum a)(HasNullable a) => HasNullable (Schema name a)HasNullable ty
#HasOperationMetadata Source
class HasOperationMetadata route whereMembers
operationMetadata :: Proxy route -> OperationMetadata
Instances
HasOperationMetadata route
#HasPattern Source
class HasPattern ty whereMembers
Instances
(IsSymbol pat) => HasPattern (Pattern pat a)(HasPattern a) => HasPattern (Description desc a)(HasPattern a) => HasPattern (Example ex a)(HasPattern a) => HasPattern (Format fmt a)(HasPattern a) => HasPattern (Minimum v a)(HasPattern a) => HasPattern (Maximum v a)(HasPattern a) => HasPattern (MinLength v a)(HasPattern a) => HasPattern (MaxLength v a)(HasPattern a) => HasPattern (Title t a)(HasPattern a) => HasPattern (Nullable a)(HasPattern a) => HasPattern (Default val a)(HasPattern a) => HasPattern (Deprecated a)(HasPattern a) => HasPattern (Enum a)(HasPattern a) => HasPattern (Schema name a)HasPattern ty
#HasTitle Source
class HasTitle ty whereMembers
Instances
(IsSymbol t) => HasTitle (Title t a)(HasTitle a) => HasTitle (Description desc a)(HasTitle a) => HasTitle (Example ex a)(HasTitle a) => HasTitle (Format fmt a)(HasTitle a) => HasTitle (Minimum v a)(HasTitle a) => HasTitle (Maximum v a)(HasTitle a) => HasTitle (Pattern pat a)(HasTitle a) => HasTitle (MinLength v a)(HasTitle a) => HasTitle (MaxLength v a)(HasTitle a) => HasTitle (Nullable a)(HasTitle a) => HasTitle (Default val a)(HasTitle a) => HasTitle (Deprecated a)(HasTitle a) => HasTitle (Enum a)(HasTitle a) => HasTitle (Schema name a)HasTitle ty
Re-exports from Yoga.HTTP.API.Route.RenderMethod
#RenderMethod Source
class RenderMethod (method :: Type) whereRender HTTP method to lowercase string (OpenAPI format)
Members
renderMethod :: Proxy method -> String
Instances
Re-exports from Yoga.HTTP.API.Route.Response
#ResponseData Source
type ResponseData :: Row Type -> Type -> Typetype ResponseData headers body = Response headers body
Deprecated alias for backwards compatibility
#respondNoHeaders Source
respondNoHeaders :: forall @label body r1 r2. IsSymbol label => Cons label (Response () body) r1 r2 => body -> Variant r2Construct a variant response with no custom headers (most common case)
Example: respondNoHeaders (Proxy :: _ "ok") user respondNoHeaders (Proxy :: _ "notFound") { error: "Not found" }
Re-exports from Yoga.HTTP.API.Route.Route
#Route Source
data Route :: forall k. Type -> k -> Type -> Row Type -> Typedata Route method segments request respVariant
Constructors
Instances
(RenderMethod method, PathPattern segments, DefaultRequestFields partialRequest reqHeaders reqCookies encoding, RenderHeadersSchema reqHeaders, RenderCookieParamsSchema reqCookies, DetectSecurity reqHeaders, DetectCookieSecurity reqCookies, SegmentPathParams segments pathParams, RenderPathParamsSchema pathParams, SegmentQueryParams segments queryParams, RenderQueryParamsSchema queryParams, RenderRequestBodySchema encoding, RowToList userResp rl, RenderVariantResponseSchemaRL rl, HasOperationMetadata (Route method segments (Record partialRequest) userResp)) => ToOpenAPI (Route method segments (Record partialRequest) userResp)(ToOpenAPI (Route method segments (Record partialRequest) userResp)) => ToOpenAPI (Route method segments (Request (Record partialRequest)) userResp)(RenderMethod method, PathPattern segments, ToOpenAPI (Route method segments request resp)) => CollectOperations (Route method segments request resp)(DefaultRequestFields partialRequest reqHeaders reqCookies encoding, CollectSchemas encoding, RowToList userResp rl, CollectVariantSchemasRL rl) => CollectRouteSchemas (Route method segments (Record partialRequest) userResp)(CollectRouteSchemas (Route method segments (Record partialRequest) userResp)) => CollectRouteSchemas (Route method segments (Request (Record partialRequest)) userResp)(DefaultRequestFields partialRequest reqHeaders reqCookies encoding, CollectSchemaNames encoding reqNames, RowToList userResp rl, CollectVariantSchemaNames rl respNames, Union reqNames respNames names) => CollectRouteSchemaNames (Route method segments (Record partialRequest) userResp) names(CollectRouteSchemaNames (Route method segments (Record partialRequest) userResp) names) => CollectRouteSchemaNames (Route method segments (Request (Record partialRequest)) userResp) names
#ConvertResponseVariant Source
class ConvertResponseVariant :: Row Type -> Row Type -> Constraintclass ConvertResponseVariant (userRow :: Row Type) (internalRow :: Row Type) | userRow -> internalRow
Convert a variant row with record syntax to Response types. Input: ( ok :: { body :: User }, notFound :: { body :: ErrorMsg } ) Output: ( ok :: Response () User, notFound :: Response () ErrorMsg )
Instances
(RowToList userRow rl, ConvertResponseVariantRL rl () internalRow) => ConvertResponseVariant userRow internalRow
#ConvertResponseVariantRL Source
class ConvertResponseVariantRL :: RowList Type -> Row Type -> Row Type -> Constraintclass ConvertResponseVariantRL (rl :: RowList Type) (acc :: Row Type) (out :: Row Type) | rl acc -> out
Instances
ConvertResponseVariantRL Nil acc acc(ToResponse recordType headers body, ConvertResponseVariantRL tail acc1 acc2, Cons label (Response headers body) acc2 out, Lacks label acc2) => ConvertResponseVariantRL (Cons label recordType tail) acc1 out
Re-exports from Yoga.HTTP.API.Route.StatusCode
#StatusCodeMap Source
class StatusCodeMap :: Symbol -> Constraintclass StatusCodeMap (sym :: Symbol) where
Map variant constructor names (Symbols) to HTTP status codes
Members
statusCodeFor :: Proxy sym -> StatusCode
Instances
(StatusCodeMapImpl (Proxy sym)) => StatusCodeMap sym
#statusCodeToString Source
statusCodeToString :: StatusCode -> StringConvert StatusCode to String for OpenAPI generation
Re-exports from Yoga.Om
#mapError Source
mapError :: forall @from @to tyIn tyOut ctx errIn errMid errOut a. IsSymbol from => IsSymbol to => Cons from tyIn (exception :: Error | errMid) (exception :: Error | errIn) => Cons to tyOut (exception :: Error | errMid) (exception :: Error | errOut) => (tyIn -> tyOut) -> Om ctx errIn a -> Om ctx errOut a
String headers are pass-through (identity)