Liking cljdoc? Tell your friends :D

sturdy.malli-firewall.web


*bad-request-handler*clj

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.
sourceraw docstring

*strip-unknown-keys*clj

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.
sourceraw docstring

bad-request-responseclj

(bad-request-response request details)
source

format-schema-errorclj

(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.
sourceraw docstring

with-schemacljmacro

(with-schema schema request & body)

Convenience wrapper for with-schemas when only validating :params.

Usage: (with-schema schema/LoginRequest request (handler request))

Convenience wrapper for `with-schemas` when only validating `:params`.

Usage:
    (with-schema schema/LoginRequest request
      (handler request))
sourceraw docstring

with-schemascljmacro

(with-schemas schema-map request & body)

Coerces and validates multiple request maps against their respective schemas.

Accepts a map of request keys to schemas (e.g., {:params LoginRequest, :path-params UserPath}).

On success: Merges coerced maps back into the request and executes body. On failure: Short-circuits on the first failure and returns a 400 Bad Request via bad-request-response. Includes an :in key in the error details indicating which request key failed validation.

Uses the dynamic variables bad-request-handler to format 400 responses strip-unknown-keys to control behavior for unknown keys

Usage: (with-schemas {:params schema/LoginRequest :path-params schema/UserPath} request (handler request))

Coerces and validates multiple request maps against their respective schemas.

Accepts a map of request keys to schemas (e.g., {:params LoginRequest, :path-params UserPath}).

On success: Merges coerced maps back into the request and executes body.
On failure: Short-circuits on the first failure and returns a 400 Bad Request via
bad-request-response. Includes an `:in` key in the error details indicating which
request key failed validation.

Uses the dynamic variables
  *bad-request-handler* to format 400 responses
  *strip-unknown-keys* to control behavior for unknown keys

Usage:
    (with-schemas {:params      schema/LoginRequest
                   :path-params schema/UserPath}
      request
      (handler request))
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close