Liking cljdoc? Tell your friends :D

sturdy.malli-firewall.core


assert-valid!clj

(assert-valid! schema params & [opts])

Ensures input is valid or terminates execution.

Returns coerced data on success.

Throws an ex-info with type :bad-request on failure, containing humanized error details in the exception data. Ideal for use in request-handling macros.

See coerce for documentation on the options and coercion.

Ensures input is valid or terminates execution.

Returns coerced data on success.

Throws an ex-info with type :bad-request on failure, containing
humanized error details in the exception data.  Ideal for use in
request-handling macros.

See `coerce` for documentation on the options and coercion.
sourceraw docstring

coerceclj

(coerce schema
        params
        &
        [{:keys [strip-unknown-keys?] :or {strip-unknown-keys? true}}])

Transforms raw input (e.g., Ring params) into internal Clojure data.

Converts string keys to keywords and coerces string values to their schema-defined types. By default, uses smart-key-transformer to silently drop unknown keys to prevent arbitrary keyword interning (DoS). 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.

Returns coerced data map (unvalidated).

Transforms raw input (e.g., Ring params) into internal Clojure data.

Converts string keys to keywords and coerces string values to their
schema-defined types. By default, uses smart-key-transformer to
silently drop unknown keys to prevent arbitrary keyword
interning (DoS).  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.

Returns coerced data map (unvalidated).
sourceraw docstring

validateclj

(validate schema params & [opts])

Coerces and validates input against a Malli schema.

Returns a map with either:

  • :ok The coerced data map.
  • :error A map containing a human-readable :message and a :problems map (humanized Malli errors with spell-checking).

See coerce for documentation on the options and coercion.

Coerces and validates input against a Malli schema.

Returns a map with either:
- :ok     The coerced data map.
- :error  A map containing a human-readable :message and a
          :problems map (humanized Malli errors with spell-checking).

See `coerce` for documentation on the options and coercion.
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