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)
(-process-entity-level-spec process key spec entity)
(-process-error process options)
(-process-field-spec process spec value)
(-process-spec-on-value process spec value)
(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-message-map 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.
(coerce-value spec value)
(coerce-value schema key value)
DEPRECATED
DEPRECATED
(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-message-map 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.
(conform-schema! schema)
Normalizes, coerces, and validates all the specs in the schema. Any problems in the schema will throw an exception. Any extra fields in the spec (:value, :db, ...) will be preserved.
Normalizes, coerces, and validates all the specs in the schema. Any problems in the schema will throw an exception. Any extra fields in the spec (:value, :db, ...) will be preserved.
(conform-value spec value)
(conform-value schema key value)
DEPRECATED
DEPRECATED
(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.
(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.
(nil-or f)
(nil?-or f)
(normalize-schema schema)
Returns the schema with all shorthand specs expanded.
Returns the schema with all shorthand specs expanded.
(normalize-spec spec)
If the spec is using a shorthand, it will be expanded.
If the spec is using a shorthand, it will be expanded.
(normalized? schema-or-spec)
Returns true if the schema-or-spec has been normalized, false otherwise.
Returns true if the schema-or-spec has been normalized, false otherwise.
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.
(present-value spec value)
(present-value schema key value)
DEPRECATED
DEPRECATED
(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)
(process-map-spec-on-value process spec value)
(process-one-of-on-value process spec value)
(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-message-map 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
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close