Yoga.HTTP.API.Route
- Package
- purescript-yoga-http-api
- Repository
- rowtype-yoga/purescript-yoga-http-api
Re-exports from Yoga.HTTP.API.Path
#Required Source
data Required aMarker for required query parameters (default is optional → Maybe)
Example: Path ("users") :? (limit :: Int, offset :: Required Int) -- limit parses as Maybe Int, offset parses as Int (fails if missing)
#QueryParams Source
data QueryParams :: forall k. k -> Type -> Typedata QueryParams path params
Attach query parameters to a path
Example: Path ("users" / "id" : Int) :? { limit :: Int, offset :: Required Int }
Instances
(PathPattern path) => PathPattern (QueryParams path params)
#PathCons Source
data PathCons :: forall k1 k2. k1 -> k2 -> Typedata PathCons left right
Instances
(IsSymbol s, PathPatternSegs rest) => PathPatternSegs (PathCons (Lit s) rest)(IsSymbol name, PathPatternSegs rest) => PathPatternSegs (PathCons (Capture name ty) rest)(IsSymbol name, PathPatternSegs rest) => PathPatternSegs (PathCons (Param name ty) rest)(IsSymbol s, PathPatternSegs rest) => PathPatternSegs (PathCons s rest)(IsSymbol s, ParsePath (Path rest) params) => ParsePath (Path (PathCons (Lit s) rest)) params(IsSymbol name, ParseParam ty, ParsePath (Path rest) restParams, Cons name ty restParams fullParams, Lacks name restParams) => ParsePath (Path (PathCons (Capture name ty) rest)) fullParams
#Path Source
data Path :: forall k. k -> Typedata Path segments
Type-level path representation
Examples: Path Root -- / Path (Lit "users") -- /users Path (Lit "users" / Capture "id" Int) -- /users/:id Path (Lit "users" / Capture "id" Int / Lit "posts") -- /users/:id/posts
Instances
(PathPatternSegs segs) => PathPattern (Path segs)(PathPatternSegs segs) => PathPatternSegs (Path segs)ParsePath (Path Root) ()(IsSymbol s) => ParsePath (Path (Lit s)) ()(IsSymbol name, ParseParam ty) => ParsePath (Path (Capture name ty)) (name :: ty)(IsSymbol s, ParsePath (Path rest) params) => ParsePath (Path (PathCons (Lit s) rest)) params(IsSymbol name, ParseParam ty, ParsePath (Path rest) restParams, Cons name ty restParams fullParams, Lacks name restParams) => ParsePath (Path (PathCons (Capture name ty) rest)) fullParams
#Param Source
data Param :: Symbol -> Type -> Typedata Param (name :: Symbol) (ty :: Type)
Sugar for Capture — use with bare Symbols in the path DSL
Example: Path ("users" / "id" : Int / "posts") -- equivalent to: Path (Lit "users" / Capture "id" Int / Lit "posts")
Instances
(IsSymbol name) => PathPatternSegs (Param name ty)(IsSymbol name, PathPatternSegs rest) => PathPatternSegs (PathCons (Param name ty) rest)
#Lit Source
data Lit :: Symbol -> Typedata Lit (segment :: Symbol)
Literal path segment (wrapper for Symbol to work around PureScript 0.15 limitations)
In PureScript 0.15, we can't use bare Symbols like Path "users" due to kind inference. Instead, use: Path (Lit "users")
Example: Path (Lit "users") -- /users Path (Lit "users" / Capture "id" Int) -- /users/:id
Instances
#Capture Source
data Capture :: Symbol -> Type -> Typedata Capture (name :: Symbol) (ty :: Type)
Capture a path parameter with a name and type
Example: Capture "id" Int -- captures :id as an Int Capture "name" String -- captures :name as a String
Instances
(IsSymbol name) => PathPatternSegs (Capture name ty)(IsSymbol name, PathPatternSegs rest) => PathPatternSegs (PathCons (Capture name ty) rest)(IsSymbol name, ParseParam ty) => ParsePath (Path (Capture name ty)) (name :: ty)(IsSymbol name, ParseParam ty, ParsePath (Path rest) restParams, Cons name ty restParams fullParams, Lacks name restParams) => ParsePath (Path (PathCons (Capture name ty) rest)) fullParams
#ParseParam Source
class ParseParam (ty :: Type) whereParse a value from a String (used for path captures)
Members
parseParam :: String -> Either String ty
Instances
#ParsePath Source
class ParsePath :: Type -> Row Type -> Constraintclass ParsePath (path :: Type) (params :: Row Type) | path -> params where
Parse a URL string into a record of typed path parameters
Examples: parsePath @(Path Root) "/" = Just {} parsePath @(Path (Lit "users")) "/users" = Just {} parsePath @(Path (Lit "users" / Capture "id" Int)) "/users/123" = Just { id: 123 }
Members
Instances
ParsePath (Path Root) ()(IsSymbol s) => ParsePath (Path (Lit s)) ()(IsSymbol name, ParseParam ty) => ParsePath (Path (Capture name ty)) (name :: ty)(IsSymbol s, ParsePath (Path rest) params) => ParsePath (Path (PathCons (Lit s) rest)) params(IsSymbol name, ParseParam ty, ParsePath (Path rest) restParams, Cons name ty restParams fullParams, Lacks name restParams) => ParsePath (Path (PathCons (Capture name ty) rest)) fullParams
#PathPattern Source
class PathPattern :: forall k. k -> Constraintclass PathPattern path where
Generate a Fastify-compatible URL pattern from a path type
Examples: pathPattern (Proxy :: _ (Path Root)) = "/" pathPattern (Proxy :: _ (Path (Lit "users"))) = "/users" pathPattern (Proxy :: _ (Path (Lit "users" / Capture "id" Int))) = "/users/:id" pathPattern (Proxy :: _ ("users" / "id" : Int)) = "/users/:id"
Members
pathPattern :: Proxy path -> String
Instances
(PathPattern path) => PathPattern (QueryParams path params)(PathPatternSegs segs) => PathPattern (Path segs)(PathPatternSegs segs) => PathPattern segs
#type (:?) Source
Operator alias for Yoga.HTTP.API.Path.QueryParams (left-associative / precedence 1)
#type (/) Source
Operator alias for Yoga.HTTP.API.Path.PathCons (right-associative / precedence 6)
Infix operator for building paths
Example: Lit "users" / Capture "id" Int / Lit "posts"
Re-exports from Yoga.HTTP.API.Route.Auth
#DigestAuth Source
newtype DigestAuthDigest authentication header value
Example: parseHeader "Digest username="user", realm="api", ..." :: Either String DigestAuth = Right (DigestAuth "Digest username="user", realm="api", ...")
Constructors
Instances
#BasicAuth Source
newtype BasicAuthBasic authentication header value (Base64-encoded credentials)
Example: parseHeader "Basic dXNlcjpwYXNz" :: Either String BasicAuth = Right (BasicAuth "dXNlcjpwYXNz")
The raw Base64-encoded credentials are preserved for server-side verification
Constructors
Instances
#ApiKeyHeader Source
newtype ApiKeyHeaderAPI Key passed in a custom header
Example: parseHeader "abc123" :: Either String ApiKeyHeader = Right (ApiKeyHeader "abc123")
Constructors
Instances
#ApiKeyCookie Source
newtype ApiKeyCookieAPI Key passed in a cookie (for authentication purposes) This is a marker type that indicates the cookie should be treated as an authentication mechanism in OpenAPI (securitySchemes) rather than a regular cookie parameter.
Example: Request { cookies :: { sessionId :: ApiKeyCookie } }
Constructors
Instances
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
#XML Source
data XML aXML encoded request/response body (application/xml)
Example: Request { body :: XML XmlDocument }
#Streaming Source
data Streaming aStreaming response body (returns a Strom of decoded chunks)
Example: { body :: Streaming Uint8Array } -- raw binary { body :: Streaming String } -- text
#NoBody Source
data NoBodyNo request body (for GET, DELETE, etc.)
Example: Request {} -- NoBody is the default when body is omitted
#MultipartFormData Source
data MultipartFormData aMultipart form data encoded request body (multipart/form-data)
Example: Request { body :: MultipartFormData { file :: FileUpload } }
#FormData Source
data FormData aForm data encoded request body (application/x-www-form-urlencoded)
Example: Request { body :: FormData { username :: String, password :: String } }
#CustomContentType Source
data CustomContentType :: Symbol -> Type -> Typedata CustomContentType mime a
Custom content type with explicit MIME type
Example: Request { body :: CustomContentType "application/vnd.api+json" User }
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") []
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)
#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)
#Schema Source
data Schema :: Symbol -> Type -> Typedata Schema name a
Mark a type to be extracted as an OpenAPI component schema with $ref. When used in request/response bodies, generates a reference instead of inline schema.
Example: type User = { id :: Int, name :: String } Route POST path (Request { body :: JSON (Schema "User" User) }) (ok :: { body :: Schema "User" User })
Instances
(HasDescription a) => HasDescription (Schema name a)(HasExample a) => HasExample (Schema name a)(HasFormat a) => HasFormat (Schema name a)(HasMinimum a) => HasMinimum (Schema name a)(HasMaximum a) => HasMaximum (Schema name a)(HasPattern a) => HasPattern (Schema name a)(HasMinLength a) => HasMinLength (Schema name a)(HasMaxLength a) => HasMaxLength (Schema name a)(HasTitle a) => HasTitle (Schema name a)(HasNullable a) => HasNullable (Schema name a)(HasDefault a) => HasDefault (Schema name a)(HasDeprecated a) => HasDeprecated (Schema name a)(HasEnum a) => HasEnum (Schema name a)(HasExamples a) => HasExamples (Schema name a)(HasLinks a) => HasLinks (Schema name a)(HeaderValue a) => HeaderValue (Schema name a)(HeaderValueType a) => HeaderValueType (Schema name a)(ParseParam a) => ParseParam (Schema name a)(WriteForeign a) => WriteForeign (Schema name a)(ReadForeign a) => ReadForeign (Schema name 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)
#Link Source
data Link :: Type -> Symbol -> Symbol -> Row Type -> Typedata Link inner linkName operationId parametersRow
Define an OpenAPI link to express relationships between operations. Links allow you to indicate how values from one operation's response can be used as parameters in another operation.
Parameters: inner - The wrapped type (transparent wrapper) linkName - The link identifier (e.g., "getUser") operationId - The target operation ID to link to parametersRow - A row of parameter mappings with runtime expressions (as Symbol types)
Example: ok :: { body :: User } # Link "deleteUser" "deleteUserById" ( userId :: "$response.body#/id" )
Instances
(HeaderValue a) => HeaderValue (Link a linkName operationId parametersRowRow)(HeaderValueType a) => HeaderValueType (Link a linkName operationId parametersRow)(ParseParam a) => ParseParam (Link a linkName operationId parametersRow)(WriteForeign a) => WriteForeign (Link a linkName operationId parametersRow)(ReadForeign a) => ReadForeign (Link a linkName operationId parametersRow)
#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)
#Examples Source
data Examples :: Row Type -> Type -> Typedata Examples examplesRow a
Attach multiple named examples to a type for OpenAPI documentation. This allows you to provide several example values that will appear in the generated OpenAPI spec.
Example: Int # Examples (basic :: ExampleValue "42", advanced :: ExampleValue "100")
Instances
(HasExample a) => HasExample (Examples examplesRow a)HasExamples (Examples examplesRow a)(HasLinks a) => HasLinks (Examples examplesRow a)(HeaderValueType a) => HeaderValueType (Examples examplesRow a)
#ExampleWithSummary Source
data ExampleWithSummary :: Symbol -> Symbol -> Typedata ExampleWithSummary value summary
An example with a summary (used in Examples row).
Example: premium :: ExampleWithSummary "456" "Premium user"
#ExampleValue Source
data ExampleValue :: Symbol -> Typedata ExampleValue value
A simple example with just a value (used in Examples row).
Example: basic :: ExampleValue "42"
#ExampleObject Source
data ExampleObject :: Symbol -> Symbol -> Symbol -> Symbol -> Typedata ExampleObject value summary description externalValue
A complete example object with value, summary, description, and optional externalValue.
Example: external :: ExampleObject "" "External example" "An example from URL" "https://example.com/data.json"
#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)
#Callback Source
data Callback :: Type -> Symbol -> Symbol -> Type -> Type -> Row Type -> Typedata Callback inner name expression method requestBody responseRow
Define an OpenAPI callback for webhook/asynchronous API patterns. Callbacks allow you to define outgoing requests that your API will make to the client.
Parameters: inner - The wrapped type (transparent wrapper) name - The callback identifier (e.g., "onPaymentComplete") expression - The URL with runtime expressions (e.g., "{$request.body#/callbackUrl}") method - The HTTP method type for the callback (GET, POST, etc.) requestBody - The request body type for the callback responseRow - The response variants row for the callback
Example: type PaymentRoute = Route POST (Path (Lit "payment")) (Request { body :: JSON PaymentRequest }) ( ok :: { body :: PaymentResponse } ) # Callback "onPaymentComplete" "{$request.body#/callbackUrl}" POST (JSON { status :: String, transactionId :: String }) ( ok :: { body :: { received :: Boolean } } )
#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
#HasExamples Source
class HasExamples ty whereMembers
Instances
HasExamples (Examples examplesRow a)(HasExamples a) => HasExamples (Description desc a)(HasExamples a) => HasExamples (Example ex a)(HasExamples a) => HasExamples (Format fmt a)(HasExamples a) => HasExamples (Minimum v a)(HasExamples a) => HasExamples (Maximum v a)(HasExamples a) => HasExamples (Pattern pat a)(HasExamples a) => HasExamples (MinLength v a)(HasExamples a) => HasExamples (MaxLength v a)(HasExamples a) => HasExamples (Title t a)(HasExamples a) => HasExamples (Nullable a)(HasExamples a) => HasExamples (Default val a)(HasExamples a) => HasExamples (Deprecated a)(HasExamples a) => HasExamples (Enum a)(HasExamples a) => HasExamples (Schema name a)HasExamples 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.Response
#ResponseData Source
type ResponseData :: Row Type -> Type -> Typetype ResponseData headers body = Response headers body
Deprecated alias for backwards compatibility
#respondWith Source
respondWith :: forall label headers body r1 r2. IsSymbol label => Cons label (Response headers body) r1 r2 => Proxy label -> Record headers -> body -> Variant r2Construct a variant response with separate headers and body arguments
Example: respondWith (Proxy :: _ "created") { "Location": "/users/123" } user
#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.RouteHandler
#Handler Source
data Handler t0A handler tied to a specific route type.
Usage: userHandler :: Handler UserRoute userHandler = mkHandler { path } -> ...
#APIHandlers Source
class APIHandlers :: RowList Type -> Row Type -> Constraintclass APIHandlers (rl :: RowList Type) (handlerRow :: Row Type) | rl -> handlerRow
Instances
APIHandlers Nil ()(APIHandlers tail tailRow, Cons label (Handler (Route method segments request resp)) tailRow handlerRow, Lacks label tailRow) => APIHandlers (Cons label (Route method segments request resp) tail) handlerRow
#RouteHandler Source
class RouteHandler :: Type -> Row Type -> Row Type -> Row Type -> Type -> Row Type -> Constraintclass RouteHandler (route :: Type) (pathParams :: Row Type) (queryParams :: Row Type) (reqHeaders :: Row Type) (body :: Type) (respVariant :: Row Type) | route -> pathParams queryParams reqHeaders body respVariant
Type class that computes the handler function type from a Route type.
Instances
(Union partialRequest o_ (body :: fullEncoding, cookies :: Record fullCookies, headers :: Record fullHeaders), DefaultRequestFields partialRequest fullHeaders fullCookies fullEncoding, SegmentPathParams segments pathParams, SegmentQueryParams segments queryParams, EncodingBody fullEncoding body, ConvertResponseVariant userResp respVariant) => RouteHandler (Route method segments (Record partialRequest) userResp) pathParams queryParams fullHeaders body respVariant(Union partialRequest o_ (body :: fullEncoding, cookies :: Record fullCookies, headers :: Record fullHeaders), DefaultRequestFields partialRequest fullHeaders fullCookies fullEncoding, SegmentPathParams segments pathParams, SegmentQueryParams segments queryParams, EncodingBody fullEncoding body, ConvertResponseVariant userResp respVariant) => RouteHandler (Route method segments (Request (Record partialRequest)) userResp) pathParams queryParams fullHeaders body respVariant
#runHandler Source
runHandler :: forall route pathParams queryParams reqHeaders body respVariant. RouteHandler route pathParams queryParams reqHeaders body respVariant => Handler route -> HandlerFn pathParams queryParams reqHeaders body respVariantExtract the handler function from a Handler.
#mkHandler Source
mkHandler :: forall route pathParams queryParams reqHeaders body respVariant. RouteHandler route pathParams queryParams reqHeaders body respVariant => HandlerFn pathParams queryParams reqHeaders body respVariant -> Handler routeCreate a Handler from a function matching the route's type.
#apiHandlers Source
apiHandlers :: forall @api apiRow rl handlerRow. ApiRecord api apiRow => RowToList apiRow rl => APIHandlers rl handlerRow => Record handlerRow -> Record handlerRowRe-exports from Yoga.HTTP.API.Route.StatusCode
#StatusCode Source
#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.Options
#UndefinedOr Source
type UndefinedOr a = OneOf Undefined a#withUor Source
withUor :: forall a b. (a -> b) -> UndefinedOr a -> UndefinedOr b#uorToMaybe Source
uorToMaybe :: forall a. UndefinedOr a -> Maybe a#nullishCoalesce Source
nullishCoalesce :: forall a. UndefinedOr a -> a -> a#fromUndefinedOr Source
fromUndefinedOr :: forall a. a -> UndefinedOr a -> a#defined Source
defined :: forall a. a -> UndefinedOr a- Modules
- Yoga.
HTTP. API. Path - Yoga.
HTTP. API. Route - Yoga.
HTTP. API. Route. Auth - Yoga.
HTTP. API. Route. BearerToken - Yoga.
HTTP. API. Route. Encoding - Yoga.
HTTP. API. Route. Handler - Yoga.
HTTP. API. Route. HeaderError - Yoga.
HTTP. API. Route. HeaderValue - Yoga.
HTTP. API. Route. Method - Yoga.
HTTP. API. Route. OpenAPI - Yoga.
HTTP. API. Route. OpenAPIMetadata - Yoga.
HTTP. API. Route. RenderMethod - Yoga.
HTTP. API. Route. Response - Yoga.
HTTP. API. Route. Route - Yoga.
HTTP. API. Route. RouteHandler - Yoga.
HTTP. API. Route. StatusCode
String headers are pass-through (identity)