Users can bind this to a custom function, e.g. a ring handler for 400 error responses.
Users can bind this to a custom function, e.g. a ring handler for 400 error responses.
If *strip-unknown-keys* is truthy (default), unknown keys are
silently dropped. This prevents interning or processing any
unwanted input.
If *strip-unknown-keys* is falsey, unknown keys are kept in the
map, but are left as strings. This enables closed schemas to fail
validation, while still avoiding interning arbitrary user input.
If `*strip-unknown-keys*` is truthy (default), unknown keys are silently dropped. This prevents interning or processing any unwanted input. If `*strip-unknown-keys*` is falsey, unknown keys are kept in the map, but are left as strings. This enables closed schemas to fail validation, while still avoiding interning arbitrary user input.
(format-schema-error details)Format a structured error response as a simple string, for handlers which do not support structured logging.
Format a structured error response as a simple string, for handlers which do not support structured logging.
(with-schema schema request & body)Coerces and validates request params against schema.
On success: Updates :params in the request with coerced values and executes body. On failure: Short-circuits and returns a 400 Bad Request via bad-request-response.
Uses the dynamic variables bad-request-handler to format 400 responses strip-unknown-keys to control behavior for unknown keys See the docstrings for these symbols for more information.
Usage: (with-schema schema/LoginRequest request (handler request))
Coerces and validates request params against schema.
On success: Updates :params in the request with coerced values
and executes body.
On failure: Short-circuits and returns a 400 Bad Request via
bad-request-response.
Uses the dynamic variables
*bad-request-handler* to format 400 responses
*strip-unknown-keys* to control behavior for unknown keys
See the docstrings for these symbols for more information.
Usage:
(with-schema schema/LoginRequest request
(handler request))cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |