Liking cljdoc? Tell your friends :D

martian.schema-tools


*max-recursions-per-target*clj/s

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.
sourceraw docstring

*seen-recursion*clj/s

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.
sourceraw docstring

->idiomaticclj/s

(->idiomatic k)
source

child-by-idiomaticclj/s

(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`.
sourceraw docstring

combine-aliases-atclj/s

(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.
sourceraw docstring

compute-aliases-atclj/s

(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.

  • 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.
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`.
sourceraw docstring

concrete-key?clj/s

(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.).
sourceraw docstring

explicit-keyclj/s

(explicit-key k)
source

key-seqsclj/s

(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.
sourceraw docstring

map-entry-aliasesclj/s

(map-entry-aliases ms)

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.
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.
sourceraw docstring

PathAliasesclj/sprotocol

Internal traversal API used to locate alias maps inside Prismatic schemas.

Internal traversal API used to locate alias maps inside Prismatic schemas.

-aliases-atclj/s

(-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.

-pathsclj/s

(-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.
sourceraw docstring

postwalk-with-pathclj/s

(postwalk-with-path f form)
(postwalk-with-path f path form)
source

prewalk-with-pathclj/s

(prewalk-with-path f form)
(prewalk-with-path f path form)
source

walk-with-pathclj/s

(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.
sourceraw docstring

with-recursion-guardclj/smacro

(with-recursion-guard rec-target form)
source

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