Spikard.RouteBuilder (spikard v0.17.0)

Copy Markdown

Builder for defining a route.

Summary

Types

t()

Builder for defining a route.

Functions

Require API key authentication for this route.

Attach a roles/scopes/permissions authorization requirement for this route.

Attach a per-route maximum request body size in bytes, overriding the server-global default.

Attach a compression configuration for this route.

Attach a CORS configuration for this route.

Provide multipart file parameter configuration.

Declare the dependency keys that must be resolved before this handler runs.

Assign an explicit handler name.

Expose this route as a JSON-RPC method.

Require JWT authentication for this route.

Select registered lifecycle hooks to run for this route.

Create a new builder for the provided HTTP method and path.

Attach a literal OpenRPC method spec document for this route, overriding

Provide a raw JSON schema for request parameters.

Attach a per-route rate limiting configuration, overriding the server-global default.

Force per-route request-id generation on or off, overriding the server-global default.

Provide a raw JSON schema for the request body.

Attach a per-route request timeout in seconds, overriding the server-global default.

Provide a raw JSON schema for the response body.

Mark the route as synchronous.

Types

t()

@type t() :: %Spikard.RouteBuilder{ref: reference()}

Builder for defining a route.

Functions

api_key_auth(obj, config)

Require API key authentication for this route.

authorization(obj, config)

Attach a roles/scopes/permissions authorization requirement for this route.

body_limit(obj, max_bytes)

Attach a per-route maximum request body size in bytes, overriding the server-global default.

compression(obj, compression)

Attach a compression configuration for this route.

cors(obj, cors)

Attach a CORS configuration for this route.

file_params_json(obj, schema)

Provide multipart file parameter configuration.

handler_dependencies(obj, dependencies)

Declare the dependency keys that must be resolved before this handler runs.

handler_name(obj, name)

Assign an explicit handler name.

jsonrpc_method(obj, info)

Expose this route as a JSON-RPC method.

jwt_auth(obj, config)

Require JWT authentication for this route.

lifecycle_hooks(obj, hooks)

Select registered lifecycle hooks to run for this route.

new(method, path)

Create a new builder for the provided HTTP method and path.

openrpc_spec(obj, spec)

Attach a literal OpenRPC method spec document for this route, overriding

params_schema_json(obj, schema)

Provide a raw JSON schema for request parameters.

rate_limit(obj, rate_limit)

Attach a per-route rate limiting configuration, overriding the server-global default.

request_id(obj, enabled)

Force per-route request-id generation on or off, overriding the server-global default.

request_schema_json(obj, schema)

Provide a raw JSON schema for the request body.

request_timeout(obj, seconds)

Attach a per-route request timeout in seconds, overriding the server-global default.

response_schema_json(obj, schema)

Provide a raw JSON schema for the response body.

sync(obj)

Mark the route as synchronous.