Defines data structure, coerces, validates.
Defines data structure, coerces, validates.
(->bigdec v)
(->boolean value)
(->date v)
(->float v)
(->int v)
(->keyword value)
(->seq v)
(->sql-date v)
(->string value)
(->timestamp v)
(->uri v)
(->uuid v)
(bigdec? v)
(coerce schema entity)
Returns coerced entity or SchemaError if any coercion failed. Use error? to check result. Use Case: 'I want to change my data into the types specified by the schema.'
Returns coerced entity or SchemaError if any coercion failed. Use error? to check result. Use Case: 'I want to change my data into the types specified by the schema.'
(coerce! schema entity)
Returns a coerced entity or throws an exception if there are errors.
Returns a coerced entity or throws an exception if there are errors.
(coerce-errors schema entity)
Runs coerce on the entity and returns a map of error message, or nil if none.
Runs coerce on the entity and returns a map of error message, or nil if none.
Same as coerce-value!. Exists for backwards compatibility.
Same as coerce-value!. Exists for backwards compatibility.
(coerce-value! spec value)
(coerce-value! schema key value)
returns coerced value or throws an exception
returns coerced value or throws an exception
(conform schema entity)
Returns coerced entity or SchemaError upon any coercion or validation failure. Use error? to check result. Use Case: 'I want to coerce my data then validate the coerced data, all according to the schema.' Use Case: Data comes in from a web-form so strings have to be coerced into numbers, etc., then we need to validate that the data is good.
Returns coerced entity or SchemaError upon any coercion or validation failure. Use error? to check result. Use Case: 'I want to coerce my data then validate the coerced data, all according to the schema.' Use Case: Data comes in from a web-form so strings have to be coerced into numbers, etc., then we need to validate that the data is good.
(conform! schema entity)
Returns a conformed entity or throws an exception if there are errors.
Returns a conformed entity or throws an exception if there are errors.
(conform-errors schema entity)
Runs conform on the entity and returns a map of error message, or nil if none.
Runs conform on the entity and returns a map of error message, or nil if none.
Same as conform-value!. Exists for backwards compatibility.
Same as conform-value!. Exists for backwards compatibility.
(conform-value! spec value)
(conform-value! schema key value)
coerce and validate, returns coerced value or throws
coerce and validate, returns coerced value or throws
(email? value)
(error-data field-error)
Return the data map associated with the FieldError.
Return the data map associated with the FieldError.
(error-exception field-error)
Return the exception attached to a FieldError if any, otherwise nil.
Return the exception attached to a FieldError if any, otherwise nil.
(error-map result)
(error-message error)
Return the message of an error.
Return the message of an error.
Same as message-map. Exists for backwards compatibility.
Same as message-map. Exists for backwards compatibility.
(error-seq entity)
Returns a sequence of all the FieldErrors in a processed entity.
Returns a sequence of all the FieldErrors in a processed entity.
(error-type field-error)
Return the target type of a CoerceError, if any, otherwise nil.
Return the target type of a CoerceError, if any, otherwise nil.
(error-value field-error)
Return the value that caused the FieldError, if any, otherwise nil.
Return the value that caused the FieldError, if any, otherwise nil.
(error? entity)
Return true if the processed entity has errors, false otherwise.
Return true if the processed entity has errors, false otherwise.
(field-error? value)
Returns true if the value is a FieldError, false otherwise.
Returns true if the value is a FieldError, false otherwise.
(is-enum? enum)
(kind key)
(merge-schemas & schemas)
(merge-specs a b)
(message-map result)
nil when there are no errors, otherwise a map {<field> <error message>}.
nil when there are no errors, otherwise a map {<field> <error message>}.
(message-seq result)
seq of 'friendly' error messages; nil if none.
seq of 'friendly' error messages; nil if none.
Same as message-seq. Exists for backwards compatibility.
Same as message-seq. Exists for backwards compatibility.
(nil-or f)
Used as a :present value to remove the entry from presentation
Used as a :present value to remove the entry from presentation
(parse! f v)
(present schema entity)
Returns presented entity with FieldErrors where the process failed. Use error? to check result.
Returns presented entity with FieldErrors where the process failed. Use error? to check result.
(present! schema entity)
Returns a presented entity or throws an exception if there are errors.
Returns a presented entity or throws an exception if there are errors.
Same as present-value!. Exists for backwards compatibility.
Same as present-value!. Exists for backwards compatibility.
(present-value! spec value)
(present-value! schema key value)
returns a presentable representation of the value, or throws
returns a presentable representation of the value, or throws
(present? v)
(str-or-nil v)
(type-coercer! type)
(type-validator! type)
(uri? value)
(valid-value? spec value)
(valid-value? schema key value)
return true or false
return true or false
(validate schema entity)
Returns entity with all values true, or SchemaError when one or more invalid fields. Use error? to check result. Use Case: 'I want to make sure all the data is valid according to the schema.'
Returns entity with all values true, or SchemaError when one or more invalid fields. Use error? to check result. Use Case: 'I want to make sure all the data is valid according to the schema.'
(validate! schema entity)
Returns a validated entity or throws an exception if there are errors.
Returns a validated entity or throws an exception if there are errors.
(validate-errors schema entity)
Runs validate on the entity and returns a map of error message, or nil if none.
Runs validate on the entity and returns a map of error message, or nil if none.
(validate-value! spec value)
(validate-value! schema key value)
throws an exception when validation fails, value otherwise
throws an exception when validation fails, value otherwise
Same as validate-errors. Exists for backwards compatibility.
Same as validate-errors. Exists for backwards compatibility.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close