(assoc schema & kvs)
Assoc[iate]s key & vals into Schema.
Assoc[iate]s key & vals into Schema.
(assoc-in schema [k & ks] v)
Associates a value in a nested associative Schema, where ks
is a
sequence of keys and v
is the new value and returns a new nested Schema.
If any levels do not exist, hash-maps will be created.
Associates a value in a nested associative Schema, where `ks` is a sequence of keys and `v` is the new value and returns a new nested Schema. If any levels do not exist, hash-maps will be created.
(dissoc schema & ks)
Dissoc[iate]s keys from Schema.
Dissoc[iate]s keys from Schema.
(dissoc-in schema [k & ks])
Dissociates an entry from a nested associative Schema returning a new nested structure. keys is a sequence of keys. Any empty maps that result will not be present in the new Schema.
Dissociates an entry from a nested associative Schema returning a new nested structure. keys is a sequence of keys. Any empty maps that result will not be present in the new Schema.
(get-in m ks)
(get-in m ks not-found)
Returns the value in a nested associative Schema,
where ks
is a sequence of keys. Returns nil
if the key
is not present, or the not-found
value if supplied.
Returns the value in a nested associative Schema, where `ks` is a sequence of keys. Returns `nil` if the key is not present, or the `not-found` value if supplied.
(merge & schemas)
Returns a Schema that consists of the rest of the Schemas conj-ed onto the first. If a schema key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result. Works only with Map schemas.
Returns a Schema that consists of the rest of the Schemas conj-ed onto the first. If a schema key occurs in more than one map, the mapping from the latter (left-to-right) will be the mapping in the result. Works only with Map schemas.
(open-schema schema)
Walks a schema adding [s/Any
s/Any
] entry to all Map Schemas, removing any
existing extra keys if defined.
Walks a schema adding [`s/Any` `s/Any`] entry to all Map Schemas, removing any existing extra keys if defined.
(optional-keys m)
(optional-keys m ks)
Makes given map keys optional. Defaults to all keys.
Makes given map keys optional. Defaults to all keys.
(optional-keys-schema schema)
Walks a schema making all keys optional in Map Schemas.
Walks a schema making all keys optional in Map Schemas.
(required-keys m)
(required-keys m ks)
Makes given map keys required. Defaults to all keys.
Makes given map keys required. Defaults to all keys.
(resolve-schema schema)
Returns the schema var if the schema contains the :name
and :ns
definitions (set by schema.core/defschema
).
Returns the schema var if the schema contains the `:name` and `:ns` definitions (set by `schema.core/defschema`).
(resolve-schema-description schema)
Returns the schema description, in this lookup order: a) schema meta :description b) schema var meta :doc if not "" c) nil
Returns the schema description, in this lookup order: a) schema meta :description b) schema var meta :doc if not "" c) nil
(schema-description schema)
Returns the description of a schema attached via schema-with-description.
Returns the description of a schema attached via schema-with-description.
(schema-value s)
Returns the sub-schema or sub-schemas of given schema.
Returns the sub-schema or sub-schemas of given schema.
(schema-with-description schema description)
Records description in schema's metadata.
Records description in schema's metadata.
(select-keys schema ks)
Like clojure.core/select-keys
but handles boths optional-keys and required-keys.
Like `clojure.core/select-keys` but handles boths optional-keys and required-keys.
(select-schema value schema)
(select-schema value schema matcher)
Strips all disallowed keys from nested Map schemas via coercion. Takes an optional
coercion matcher for extra coercing the selected value(s) on a single sweep. If a value
can't be coerced to match the schema ExceptionInfo
is thrown (like schema.core/validate
).
Strips all disallowed keys from nested Map schemas via coercion. Takes an optional coercion matcher for extra coercing the selected value(s) on a single sweep. If a value can't be coerced to match the schema `ExceptionInfo` is thrown (like `schema.core/validate`).
(update schema k f & args)
Updates a value in a map with a function.
Updates a value in a map with a function.
(update-in schema [k & ks] f & args)
'Updates' a value in a nested associative Schema, where ks
is a
sequence of keys and f
is a function that will take the old value
and any supplied args and return the new value, and returns a new
nested Schema. If any levels do not exist, hash-maps will be
created.
'Updates' a value in a nested associative Schema, where `ks` is a sequence of keys and `f` is a function that will take the old value and any supplied args and return the new value, and returns a new nested Schema. If any levels do not exist, hash-maps will be created.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close