schema-tools.core
assoc-in
(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.
dissoc-in
(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.
get-in
(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.
merge
(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.
optional-keys
(optional-keys m)(optional-keys m ks)Makes given map keys optional. Defaults to all keys.
required-keys
(required-keys m)(required-keys m ks)Makes given map keys required. Defaults to all keys.
resolve-schema
(resolve-schema schema)Returns the schema var if the schema contains the :name and :ns definitions (set by schema.core/defschema).
resolve-schema-description
(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
schema-description
(schema-description schema)Returns the description of a schema attached via schema-with-description.
schema-with-description
(schema-with-description schema description)Records description in schema’s metadata.
select-keys
(select-keys schema ks)Like clojure.core/select-keys but handles boths optional-keys and required-keys.
select-schema
(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).
update-in
(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.