Maximum number of times the same recursive schema target may be expanded along a single path.
Maximum number of times the same recursive schema target may be expanded along a single path.
Cycle/budget guard for s/recursive schema targets. Bound in key-seqs fn.
Cycle/budget guard for `s/recursive` schema targets. Bound in `key-seqs` fn.
(child-by-idiomatic ms seg)Finds the child schema addressed by the next path segment seg in the map
schema ms.
The seg is one idiomatic path segment (a kebab-case, unqualified keyword
or string). The function scans entries of ms and returns the value whose
key, after being idiomatized, equals seg.
Finds the child schema addressed by the next path segment `seg` in the map schema `ms`. The `seg` is one idiomatic path segment (a kebab-case, unqualified keyword or string). The function scans entries of `ms` and returns the value whose key, after being idiomatized, equals `seg`.
(combine-aliases-at path inner-schemas)Collects and merges alias maps from multiple inner-schemas at the single
idiomatic path.
Calls (-aliases-at s path) for each inner schema, discards nil results,
and merges the remaining maps left-to-right with merge semantics. Returns
nil when nothing contributes, i.e. the merged result would be empty.
Collects and merges alias maps from multiple `inner-schemas` at the single idiomatic `path`. Calls `(-aliases-at s path)` for each inner schema, discards `nil` results, and merges the remaining maps left-to-right with `merge` semantics. Returns `nil` when nothing contributes, i.e. the merged result would be empty.
(compute-aliases-at schema idiomatic-path)Given a schema and an idiomatic-path (a vector of kebab-case, unqualified
segments), returns a map which describes how the idiomatic keys at that exact
map level are translated back to the schema's original keys.
:foo-bar. Qualified keywords/symbols
are ignored; generic map keys (e.g. s/Any, s/Keyword) do not produce
aliases.:schema, :schemas, etc.).nil. If the idiomatic-path doesn't land on a
map (or there are no aliasable keys), the function returns nil.Given a `schema` and an `idiomatic-path` (a vector of kebab-case, unqualified segments), returns a map which describes how the idiomatic keys at that exact map level are translated back to the schema's original keys. - Segments and keys are considered idiomatic when they are unqualified and kebab-case keywords/strings, e.g. `:foo-bar`. Qualified keywords/symbols are ignored; generic map keys (e.g. `s/Any`, `s/Keyword`) do not produce aliases. - Only the addressed level. The result contains aliases for the entries of that map, not for ancestors or nested child maps. - Vectors are transparent. If the path walks through a vector, aliases are merged from its element schemas. - Inner schemas hops are understood. Structural hops introduced by wrapper or union schemas are recognized (e.g. `:schema`, `:schemas`, etc.). - Non-map endpoints yield `nil`. If the `idiomatic-path` doesn't land on a map (or there are no aliasable keys), the function returns `nil`.
(concrete-key? k)Checks if the schema key k is not generic (s/Any, s/Keyword, etc.).
Checks if the schema key `k` is not generic (`s/Any`, `s/Keyword`, etc.).
(key-seqs schema)Returns a vec of unique key paths (key seqs) for schema and all subschemas
that will cover all possible entries in a data described by schema as well
as the schema itself.
Returns a vec of unique key paths (key seqs) for `schema` and all subschemas that will cover all possible entries in a data described by `schema` as well as the `schema` itself.
(map-entry-aliases ms)Returns a map of idiomatic keys to original explicit keys for the immediate
entries of the given map schema ms.
explicit-key helper function to unwrap required/optional keys;nil when there are no aliasable entries at this level.Returns a map of idiomatic keys to original explicit keys for the immediate entries of the given map schema `ms`. - Considers only keys that can be renamed: unqualified keywords or strings; - Uses the `explicit-key` helper function to unwrap required/optional keys; - Includes an entry only when the idiomatic form differs from the original; - Returns `nil` when there are no aliasable entries at this level.
Internal traversal API used to locate alias maps inside Prismatic schemas.
Internal traversal API used to locate alias maps inside Prismatic schemas.
(-aliases-at schema idiomatic-path)Returns the alias map available at idiomatic-path inside the schema,
or nil if that location is not a map level or has no aliasable keys.
Implementations should walk schema along an idiomatic-path (a vector of
kebab-case, unqualified segments) and, when the path lands on a map schema,
return an alias map for that level; otherwise return nil. Do not traverse
past the target level or build whole-tree results.
Returns the alias map available at `idiomatic-path` inside the `schema`, or `nil` if that location is not a map level or has no aliasable keys. Implementations should walk `schema` along an `idiomatic-path` (a vector of kebab-case, unqualified segments) and, when the path lands on a map schema, return an alias map for that level; otherwise return `nil`. Do not traverse past the target level or build whole-tree results.
(-paths schema path include-self?)Returns a sequence of path vectors found within the given prefix path.
If include-self? is true, includes path itself as the first element.
Returns a sequence of path vectors found within the given prefix `path`. If `include-self?` is true, includes `path` itself as the first element.
(walk-with-path inner outer form)(walk-with-path inner outer path form)Similar to the schema-tools.walk/walk except it keeps track of the path
through the data structure as it goes, calling inner and outer with two
args: the path and the form. It also does not preserve any metadata.
Similar to the `schema-tools.walk/walk` except it keeps track of the `path` through the data structure as it goes, calling `inner` and `outer` with two args: the `path` and the `form`. It also does not preserve any metadata.
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 |