(-->-schema _)
Experimental simple schema for :=> schema. AST and explain results subject to change.
Experimental simple schema for :=> schema. AST and explain results subject to change.
(-check-children! type properties children props)
(-check-children! type properties children min max)
(-comp)
(-comp f)
(-comp f g)
(-comp f g h)
(-comp f1 f2 f3 f4)
(-comp f1 f2 f3 f4 f5)
(-comp f1 f2 f3 f4 f5 f6)
(-comp f1 f2 f3 f4 f5 f6 f7)
(-comp f1 f2 f3 f4 f5 f6 f7 f8)
(-comp f1 f2 f3 f4 f5 f6 f7 f8 & fs)
(-comp)
(-comp f)
(-comp f g)
(-comp f g h)
(-comp f1 f2 f3 & fs)
(-instrument props)
(-instrument props f)
(-instrument props f options)
Takes an instrumentation properties map and a function and returns a wrapped function, which will validate function arguments and return values based on the function schema definition. The following properties are used:
key | description |
---|---|
:schema | function schema |
:scope | optional set of scope definitions, defaults to #{:input :output :guard} |
:report | optional side-effecting function of key data -> any to report problems, defaults to m/-fail! |
:gen | optional function of schema -> schema -> value to be invoked on the args to get the return value |
Takes an instrumentation properties map and a function and returns a wrapped function, which will validate function arguments and return values based on the function schema definition. The following properties are used: | key | description | | ----------|-------------| | `:schema` | function schema | `:scope` | optional set of scope definitions, defaults to `#{:input :output :guard}` | `:report` | optional side-effecting function of `key data -> any` to report problems, defaults to `m/-fail!` | `:gen` | optional function of `schema -> schema -> value` to be invoked on the args to get the return value
(-parent-children-transformer parent children transformer method options)
(-register-function-schema! ns name ?schema data)
(-register-function-schema! ns name ?schema data key f)
(-sequence-entry-schema {:keys [type re-validator re-explainer re-parser
re-unparser re-transformer re-min-max]
{:keys [min max keep]} :child-bounds
:as opts})
(-sequence-schema {:keys [type re-validator re-explainer re-parser re-unparser
re-transformer re-min-max]
{:keys [min max]} :child-bounds})
(assert ?schema value)
(assert ?schema value options)
Assert that value
validates against schema ?schema
, or throws ExceptionInfo.
The var clojure.core/assert determines whether assertion are checked.
Assert that `value` validates against schema `?schema`, or throws ExceptionInfo. The var clojure.core/*assert* determines whether assertion are checked.
(-from-ast this ast options)
ast to schema
ast to schema
(-to-ast this options)
schema to ast
schema to ast
(ast ?schema)
(ast ?schema options)
Returns the Schema AST
Returns the Schema AST
(children ?schema)
(children ?schema options)
Returns the Schema children with all Child Schemas resolved. For
MapEntry
Schemas, returns a always tuple3 of key ?properties child
Returns the Schema children with all Child Schemas resolved. For `MapEntry` Schemas, returns a always tuple3 of `key ?properties child`
(children-schema ?schema)
(children-schema ?schema options)
Returns children schema for Schema or IntoSchema.
Returns children schema for Schema or IntoSchema.
(coerce ?schema value)
(coerce ?schema value transformer)
(coerce ?schema value transformer options)
(coerce ?schema value transformer respond raise)
(coerce ?schema value transformer respond raise options)
Decode and validate a value, throws on validation error.
Decode and validate a value, throws on validation error.
(coercer ?schema)
(coercer ?schema transformer)
(coercer ?schema transformer options)
(coercer ?schema transformer respond raise)
(coercer ?schema transformer respond raise options)
Creates a function to decode and validate a value, throws on validation error.
Creates a function to decode and validate a value, throws on validation error.
(decode ?schema value t)
(decode ?schema value options t)
Transforms a value with a given decoding transformer against a schema.
Transforms a value with a given decoding transformer against a schema.
(decoder ?schema t)
(decoder ?schema options t)
Creates a value decoding function given a transformer and a schema.
Creates a value decoding function given a transformer and a schema.
(default-schema ?schema)
(default-schema ?schema options)
Returns the default (::m/default) schema from EntrySchema
Returns the default (::m/default) schema from EntrySchema
(deref ?schema)
(deref ?schema options)
Derefs top-level RefSchema
s or returns original Schema.
Derefs top-level `RefSchema`s or returns original Schema.
(deref-all ?schema)
(deref-all ?schema options)
Derefs top-level RefSchema
s recursively or returns original Schema.
Derefs top-level `RefSchema`s recursively or returns original Schema.
(deref-recursive ?schema)
(deref-recursive ?schema {:malli.core/keys [ref-key] :as options})
Derefs all schemas at all levels. Does not walk over :ref
s.
Derefs all schemas at all levels. Does not walk over `:ref`s.
(encode ?schema value t)
(encode ?schema value options t)
Transforms a value with a given encoding transformer against a schema.
Transforms a value with a given encoding transformer against a schema.
(encoder ?schema t)
(encoder ?schema options t)
Creates a value encoding transformer given a transformer and a schema.
Creates a value encoding transformer given a transformer and a schema.
(entries ?schema)
(entries ?schema options)
Returns EntrySchema
children as a sequence of clojure.lang/MapEntry
s
where the values child schemas wrapped in :malli.core/val
Schemas,
with the entry properties as properties.
Using entries
enable usage of entry properties in walking and value
transformation.
(def schema [:map [:x int?] [:y {:optional true} int?]])
(m/children schema) ; [[:x nil int?] ; [:y {:optional true} int?]]
(m/entries schema) ; [[:x [:malli.core/val int?]] ; [:y [:malli.core/val {:optional true} int?]]]
(map key (m/entries schema)) ; (:x :y)
Returns `EntrySchema` children as a sequence of `clojure.lang/MapEntry`s where the values child schemas wrapped in `:malli.core/val` Schemas, with the entry properties as properties. Using `entries` enable usage of entry properties in walking and value transformation. (def schema [:map [:x int?] [:y {:optional true} int?]]) (m/children schema) ; [[:x nil int?] ; [:y {:optional true} int?]] (m/entries schema) ; [[:x [:malli.core/val int?]] ; [:y [:malli.core/val {:optional true} int?]]] (map key (m/entries schema)) ; (:x :y)
(-entry-children this)
(-entry-entries this)
(-entry-forms this)
(-entry-keyset this)
(-entries this)
returns sequence of key -val-schema
entries
returns sequence of `key -val-schema` entries
(-entry-parser this)
(explain ?schema value)
(explain ?schema value options)
Explains a value against a given schema. Creates the explainer
for every call.
When performance matters, (re-)use explainer
instead.
Explains a value against a given schema. Creates the `explainer` for every call. When performance matters, (re-)use `explainer` instead.
(explainer ?schema)
(explainer ?schema options)
Returns an pure explainer function of type x -> explanation
for a given Schema.
Caches the result for Cached
Schemas with key :explainer
.
Returns an pure explainer function of type `x -> explanation` for a given Schema. Caches the result for [[Cached]] Schemas with key `:explainer`.
(explicit-keys ?schema)
(explicit-keys ?schema options)
Returns a vector of explicit (not ::m/default) keys from EntrySchema
Returns a vector of explicit (not ::m/default) keys from EntrySchema
(form ?schema)
(form ?schema options)
Returns the Schema form
Returns the Schema form
(from-ast ?ast)
(from-ast ?ast options)
Creates a Schema from AST
Creates a Schema from AST
(-function-info this)
(-function-schema-arities this)
(-function-schema? this)
(-instrument-f schema props f options)
(into-schema type properties children)
(into-schema type properties children options)
Creates a Schema instance out of type, optional properties map and children
Creates a Schema instance out of type, optional properties map and children
(into-schema? x)
Checks if x is a IntoSchema instance
Checks if x is a IntoSchema instance
(-children-schema this options)
maybe returns sequence schema describing schema children
maybe returns sequence schema describing schema children
(-into-schema this properties children options)
creates a new schema instance
creates a new schema instance
(-properties-schema this options)
maybe returns :map schema describing schema properties
maybe returns :map schema describing schema properties
(-type this)
returns type of the schema
returns type of the schema
(-type-properties this)
returns schema type properties
returns schema type properties
(-get this key default)
returns schema at key
returns schema at key
(-keep this)
returns truthy if schema contributes to value path
returns truthy if schema contributes to value path
(-set this key value)
returns a copy with key having new value
returns a copy with key having new value
(options ?schema)
(options ?schema options)
Returns options used in creating the Schema
Returns options used in creating the Schema
(parent ?schema)
(parent ?schema options)
Returns the IntoSchema instance that created the Schema
Returns the IntoSchema instance that created the Schema
(parse ?schema value)
(parse ?schema value options)
parses a value against a given schema. Creates the parser
for every call.
When performance matters, (re-)use parser
instead.
parses a value against a given schema. Creates the `parser` for every call. When performance matters, (re-)use `parser` instead.
(parser ?schema)
(parser ?schema options)
Returns an pure parser function of type x -> either parsed-x ::invalid
for a given Schema.
Caches the result for Cached
Schemas with key :parser
.
Returns an pure parser function of type `x -> either parsed-x ::invalid` for a given Schema. Caches the result for [[Cached]] Schemas with key `:parser`.
(properties ?schema)
(properties ?schema options)
Returns the Schema properties
Returns the Schema properties
(properties-schema ?schema)
(properties-schema ?schema options)
Returns properties schema for Schema or IntoSchema.
Returns properties schema for Schema or IntoSchema.
(-deref this)
returns the referenced schema
returns the referenced schema
(-ref this)
returns the reference name
returns the reference name
(-regex-explainer this path)
returns the raw internal regex explainer implementation
returns the raw internal regex explainer implementation
(-regex-min-max this nested?)
returns size of the sequence as {:min min :max max}. nil max means unbounded. nested? is true when this schema is nested inside an outer regex schema.
returns size of the sequence as {:min min :max max}. nil max means unbounded. nested? is true when this schema is nested inside an outer regex schema.
(-regex-op? this)
is this a regex operator (e.g. :cat, :*...)
is this a regex operator (e.g. :cat, :*...)
(-regex-parser this)
returns the raw internal regex parser implementation
returns the raw internal regex parser implementation
(-regex-transformer this transformer method options)
returns the raw internal regex transformer implementation
returns the raw internal regex transformer implementation
(-regex-unparser this)
returns the raw internal regex unparser implementation
returns the raw internal regex unparser implementation
(-regex-validator this)
returns the raw internal regex validator implementation
returns the raw internal regex validator implementation
(-validator this)
returns a predicate function that checks if the schema is valid
returns a predicate function that checks if the schema is valid
(-options this)
returns original options
returns original options
(-transformer this transformer method options)
returns a function to transform the value for the given schema and method.
Can also return nil instead of identity
so that more no-op transforms can be elided.
returns a function to transform the value for the given schema and method. Can also return nil instead of `identity` so that more no-op transforms can be elided.
(-walk this walker path options)
walks the schema and it's children, ::m/walk-entry-vals, ::m/walk-refs, ::m/walk-schema-refs options effect how walking is done.
walks the schema and it's children, ::m/walk-entry-vals, ::m/walk-refs, ::m/walk-schema-refs options effect how walking is done.
(-parser this)
return a function of x -> parsed-x | ::m/invalid
to explain how schema is valid.
return a function of `x -> parsed-x | ::m/invalid` to explain how schema is valid.
(-properties this)
returns original schema properties
returns original schema properties
(-children this)
returns schema children
returns schema children
(-form this)
returns original form of the schema
returns original form of the schema
(-explainer this path)
returns a function of x in acc -> maybe errors
to explain the errors for invalid values
returns a function of `x in acc -> maybe errors` to explain the errors for invalid values
(-unparser this)
return the inverse (partial) function wrt. -parser
; parsed-x -> x | ::m/invalid
return the inverse (partial) function wrt. `-parser`; `parsed-x -> x | ::m/invalid`
(-parent this)
returns the IntoSchema instance
returns the IntoSchema instance
(schema ?schema)
(schema ?schema options)
Creates a Schema object from any of the following:
Creates a Schema object from any of the following: - Schema instance (just returns it) - IntoSchema instance - Schema vector syntax, e.g. [:string {:min 1}] - Qualified Keyword or String, using a registry lookup
(schema? x)
Checks if x is a Schema instance
Checks if x is a Schema instance
(-transformer-chain this)
returns transformer chain as a vector of maps with :name, :encoders, :decoders and :options
returns transformer chain as a vector of maps with :name, :encoders, :decoders and :options
(-value-transformer this schema method options)
returns a value transforming interceptor for the given schema and method
returns a value transforming interceptor for the given schema and method
(type ?schema)
(type ?schema options)
Returns the Schema type.
Returns the Schema type.
(type-properties ?schema)
(type-properties ?schema options)
Returns the Schema type properties
Returns the Schema type properties
(unparse ?schema value)
(unparse ?schema value options)
Unparses a value against a given schema. Creates the unparser
for every call.
When performance matters, (re-)use unparser
instead.
Unparses a value against a given schema. Creates the `unparser` for every call. When performance matters, (re-)use `unparser` instead.
(unparser ?schema)
(unparser ?schema options)
Returns an pure unparser function of type parsed-x -> either x ::invalid
for a given Schema.
Caches the result for Cached
Schemas with key :unparser
.
Returns an pure unparser function of type `parsed-x -> either x ::invalid` for a given Schema. Caches the result for [[Cached]] Schemas with key `:unparser`.
(validate ?schema value)
(validate ?schema value options)
Returns true if value is valid according to given schema. Creates the validator
for every call. When performance matters, (re-)use validator
instead.
Returns true if value is valid according to given schema. Creates the `validator` for every call. When performance matters, (re-)use `validator` instead.
(validator ?schema)
(validator ?schema options)
Returns an pure validation function of type x -> boolean
for a given Schema.
Caches the result for Cached
Schemas with key :validator
.
Returns an pure validation function of type `x -> boolean` for a given Schema. Caches the result for [[Cached]] Schemas with key `:validator`.
(walk ?schema f)
(walk ?schema f options)
Postwalks recursively over the Schema and it's children. The walker callback is a arity4 function with the following arguments: schema, path, (walked) children and options.
Postwalks recursively over the Schema and it's children. The walker callback is a arity4 function with the following arguments: schema, path, (walked) children and options.
(-accept this schema path options)
(-inner this schema path options)
(-outer this schema path children options)
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close