Liking cljdoc? Tell your friends :D

ehr-adapter.reference.core


checkclj

(check x)

Validates that all references in data structure x have unique referents.

Throws :invalid/reference if the same referent appears with different specifications (e.g., :ref/id and :ref?/id, or :ref#int/x and :ref#string/x).

Returns x unchanged if validation passes.

Example: (check {:path [:ref/id] :query {:name :ref?/name}}) ;; => {:path [:ref/id] :query {:name :ref?/name}}

(check {:path [:ref/id] :query {:id :ref?/id}}) ;; => throws ExceptionInfo

Validates that all references in data structure x have unique referents.

Throws :invalid/reference if the same referent appears with different 
specifications (e.g., :ref/id and :ref?/id, or :ref#int/x and :ref#string/x).

Returns x unchanged if validation passes.

Example:
  (check {:path [:ref/id] :query {:name :ref?/name}})
  ;; => {:path [:ref/id] :query {:name :ref?/name}}
  
  (check {:path [:ref/id] :query {:id :ref?/id}})
  ;; => throws ExceptionInfo
sourceraw docstring

extractclj

(extract x)

Recursively traverses the given data structure x and collects all unique reference keywords (e.g., :ref/variable or :ref?/variable).

Returns a set containing all the encountered reference keywords intact, preserving their original namespaces so they can be classified later.

Example: (extract {:path [:room :ref/id] :request {:name :ref?/name}}) ;; => #{:ref/id :ref?/name}

Recursively traverses the given data structure `x` and collects all unique 
reference keywords (e.g., :ref/variable or :ref?/variable).

Returns a set containing all the encountered reference keywords intact, 
preserving their original namespaces so they can be classified later.

Example:
  (extract {:path [:room :ref/id] :request {:name :ref?/name}})
  ;; => #{:ref/id :ref?/name}
sourceraw docstring

get-refclj

(get-ref ref-bindings ref)
source

optional-reference?clj

(optional-reference? x)

Returns true if x is an optional reference keyword (e.g., :ref?/filter, :ref?#string/term). Otherwise, returns false.

Returns true if x is an optional reference keyword (e.g., :ref?/filter, :ref?#string/term). 
Otherwise, returns false.
sourceraw docstring

parseclj

(parse k)

Parses a reference keyword into a map with :kind (:required or :optional), :referent (keyword), and optionally :type (keyword). Returns nil if k is not a valid reference.

Parses a reference keyword into a map with :kind (:required or :optional), :referent (keyword), and optionally :type (keyword).
Returns nil if k is not a valid reference.
sourceraw docstring

partial-resolveclj

(partial-resolve ref-bindings x)
source

reference?clj

(reference? x)

Returns true if x is a reference keyword (e.g., :ref/id, :ref?/opt, :ref#int/num). Returns false otherwise.

Returns true if x is a reference keyword (e.g., :ref/id, :ref?/opt, :ref#int/num). Returns false otherwise.
sourceraw docstring

referentclj

(referent ref)

Returns the underlying target keyword (the referent) of a given reference by stripping away its 'ref' or 'ref?' namespace.

Example: (referent :ref/patientId) ;; => :patientId (referent :ref?/patientId) ;; => :patientId (referent :plain-keyword) ;; => nil

Returns the underlying target keyword (the referent) of a given reference 
by stripping away its 'ref' or 'ref?' namespace.

Example:
  (referent :ref/patientId)  ;; => :patientId
  (referent :ref?/patientId) ;; => :patientId
  (referent :plain-keyword)  ;; => nil
sourceraw docstring

required-reference?clj

(required-reference? x)

Returns true if x is a required reference keyword (e.g., :ref/patientId, :ref#int/limit). Otherwise, returns false.

Returns true if x is a required reference keyword (e.g., :ref/patientId, :ref#int/limit).
Otherwise, returns false.
sourceraw docstring

resolveclj

(resolve ref-bindings x)

Recursively traverses the given form (maps, vectors, lists, etc.) and replaces any placeholder keyword matching the format :ref/variable-name with its corresponding runtime value extracted from ref-bindings.

Arguments:

  • ref-bindings: A map containing runtime dynamic data (e.g., {:patientId "123"}).
  • form: Any Clojure data structure or template that contains :ref/... keywords.

Returns: The deeply transformed data structure with all references resolved.

Throws: clojure.lang.ExceptionInfo if a required :ref/... keyword found in the form cannot be resolved within the provided ref-bindings map. The exception includes the full original context for deep production debugging.

Recursively traverses the given `form` (maps, vectors, lists, etc.) 
and replaces any placeholder keyword matching the format :ref/variable-name 
with its corresponding runtime value extracted from `ref-bindings`.

Arguments:
  - `ref-bindings`: A map containing runtime dynamic data (e.g., {:patientId "123"}).
  - `form`: Any Clojure data structure or template that contains :ref/... keywords.

Returns:
  The deeply transformed data structure with all references resolved.

Throws:
  clojure.lang.ExceptionInfo if a required :ref/... keyword found in the form 
  cannot be resolved within the provided `ref-bindings` map. The exception 
  includes the full original context for deep production debugging.
sourceraw docstring

validate-ref-bindingsclj

(validate-ref-bindings ref-bindings)

Returns true when ref-bindings is a Clojure map, else throws :invalid/type error

Returns true when ref-bindings is a Clojure map, else throws :invalid/type error
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