Schema helpers for D-core.
This module is intentionally small:
temporal) that make the expected
date/time domain and wire dialect an explicit, declarative per-field choice
(roadmap 02, B6).Schema helpers for D-core. This module is intentionally small: - Applies strictness (:strict/:lax) to Malli map schemas (:closed true/false) - Validates values and throws typed, non-retriable exceptions for poison handling - Provides temporal schema constructors (`temporal`) that make the expected date/time domain *and* wire dialect an explicit, declarative per-field choice (roadmap 02, B6).
(apply-strictness schema strictness)Applies :strict/:lax strictness to all Malli :map schemas by setting :closed.
Applies :strict/:lax strictness to all Malli :map schemas by setting :closed.
(explain schema value)Returns a compact explain payload safe to include in ex-data / DLQ. Includes both raw explain and humanized errors.
Returns a compact explain payload safe to include in ex-data / DLQ. Includes both raw explain and humanized errors.
(json-schema schema)Returns the JSON Schema fragment for a temporal schema, as consumed by OpenAPI
generators. Keeps {} out of the generated spec.
Returns the JSON Schema fragment for a temporal schema, as consumed by OpenAPI
generators. Keeps `{}` out of the generated spec.(openapi-schema schema)Alias for json-schema — the OpenAPI definition emitted for a temporal schema.
Alias for `json-schema` — the OpenAPI definition emitted for a temporal schema.
(temporal domain)(temporal domain dialect)Declares the expected date/time domain (and optionally its wire dialect) for a field.
(temporal :instant) ;; defaults to the platform dialect, :epoch-ms
(temporal :instant :rfc3339) ;; explicit encoding for interop
(temporal :local-date) ;; a civil date that never becomes an instant
Validates internal java.time values: encoding is the boundary codec's job, not
the schema's. Returns a malli schema, so it composes inside :map schemas and is
enforced by reitit's request coercion and rendered into OpenAPI automatically.
Throws at declaration time when the pairing is impossible — a boundary-only domain, an unknown domain, or a dialect that cannot carry the domain (§4.1).
Declares the expected date/time domain (and optionally its wire dialect) for a field. ```clojure (temporal :instant) ;; defaults to the platform dialect, :epoch-ms (temporal :instant :rfc3339) ;; explicit encoding for interop (temporal :local-date) ;; a civil date that never becomes an instant ``` Validates internal `java.time` values: encoding is the boundary codec's job, not the schema's. Returns a malli schema, so it composes inside `:map` schemas and is enforced by reitit's request coercion and rendered into OpenAPI automatically. Throws at *declaration* time when the pairing is impossible — a boundary-only domain, an unknown domain, or a dialect that cannot carry the domain (§4.1).
(temporal-dialect schema)Returns the declared wire dialect of a schema produced by temporal.
Returns the declared wire dialect of a schema produced by `temporal`.
(temporal-domain schema)Returns the declared temporal domain of a schema produced by temporal.
Returns the declared temporal domain of a schema produced by `temporal`.
(valid? schema value)Returns true when value satisfies schema. A thin, total counterpart to
validate! for callers that want a boolean rather than an exception.
Returns true when `value` satisfies `schema`. A thin, total counterpart to `validate!` for callers that want a boolean rather than an exception.
(validate! schema value)(validate! schema value {:keys [schema-id strictness]})Validates value against schema (optionally applying strictness).
On failure, throws ex-info with:
Validates `value` against `schema` (optionally applying `strictness`). On failure, throws ex-info with: - :failure/type :schema-invalid - :retriable? false - :schema/id (optional) - :schema/explain (compact explain payload)
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 |