Liking cljdoc? Tell your friends :D

urpx.coerce

Coerce raw URPX parser output into typed Clojure values.

The parser (urpx.core/load-rate-plan) produces a Clojure map with namespaced keys but all-string leaf values. This namespace applies the :decode/urpx-jsonld decoders attached to urpx.schema schemas to convert those strings into BigDecimals, LocalDates, LocalTimes, LocalDateTimes, Durations, and integer month numbers — and to normalize fields that URPX permits as either a single map or a vector of maps.

Coerce raw URPX parser output into typed Clojure values.

The parser (`urpx.core/load-rate-plan`) produces a Clojure map with
namespaced keys but all-string leaf values. This namespace applies the
`:decode/urpx-jsonld` decoders attached to `urpx.schema` schemas to convert
those strings into BigDecimals, LocalDates, LocalTimes, LocalDateTimes,
Durations, and integer month numbers — and to normalize fields that URPX
permits as either a single map or a vector of maps.
raw docstring

coerceclj

(coerce schema raw)

Decode a raw value against schema using the URPX JSON-LD transformer. Returns the typed value. Use validate afterwards if you want a strict check.

Decode a raw value against `schema` using the URPX JSON-LD transformer.
Returns the typed value. Use `validate` afterwards if you want a strict check.
raw docstring

coerce-docclj

(coerce-doc raw)

Dispatch on the document's :jsonld/type and coerce as a RatePlan, RatePlanModifier, or URPXDocument wrapper. Returns nil for unknown types.

Dispatch on the document's :jsonld/type and coerce as a RatePlan,
RatePlanModifier, or URPXDocument wrapper. Returns nil for unknown types.
raw docstring

coerce-rate-planclj

(coerce-rate-plan raw)

Coerce a raw parsed URPX rate plan into the typed shape described by urpx.schema/RatePlan.

Coerce a raw parsed URPX rate plan into the typed shape described by
`urpx.schema/RatePlan`.
raw docstring

coerce-rate-plan-modifierclj

(coerce-rate-plan-modifier raw)

Coerce a raw parsed URPX rate plan modifier into the typed shape described by urpx.schema/RatePlanModifier. Modifier docs (EEC, NSE, HRA fixtures) augment or override parts of an existing RatePlan; price resolution against a modifier alone is not (yet) supported.

Coerce a raw parsed URPX rate plan modifier into the typed shape described
by `urpx.schema/RatePlanModifier`. Modifier docs (EEC, NSE, HRA fixtures)
augment or override parts of an existing RatePlan; price resolution against
a modifier alone is not (yet) supported.
raw docstring

coerce-urpx-documentclj

(coerce-urpx-document raw)

Coerce a raw parsed URPX document wrapper into the typed shape described by urpx.schema/URPXDocument. Validates the document-level metadata (urpx:targetURPXVersion, dates, version, …) — inner urpx:hasRatePlan / urpx:hasRatePlanModifier payloads are passed through as raw maps and should be coerced + validated against their own schemas separately.

Coerce a raw parsed URPX document wrapper into the typed shape described
by `urpx.schema/URPXDocument`. Validates the document-level metadata
(urpx:targetURPXVersion, dates, version, …) — inner urpx:hasRatePlan /
urpx:hasRatePlanModifier payloads are passed through as raw maps and
should be coerced + validated against their own schemas separately.
raw docstring

encodeclj

(encode schema typed)

Encode a typed value against schema using the URPX JSON-LD transformer. Inverse of coerce — turns BigDecimal/LocalDate/etc. back into the JSON-LD string forms (URPX-nvo write-side). Schemas without an :encode/urpx-jsonld property pass values through unchanged (:default-encoder identity).

Encode a typed value against `schema` using the URPX JSON-LD transformer.
Inverse of `coerce` — turns BigDecimal/LocalDate/etc. back into the JSON-LD
string forms (URPX-nvo write-side). Schemas without an :encode/urpx-jsonld
property pass values through unchanged (`:default-encoder identity`).
raw docstring

explainclj

(explain schema value)

Return a Malli explanation for why value does not validate against schema, or nil if it does.

Return a Malli explanation for why `value` does not validate against `schema`,
or nil if it does.
raw docstring

validateclj

(validate schema value)

Validate value against schema. Returns true on success.

Validate `value` against `schema`. Returns true on success.
raw 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