sema-validate 0.1.0

API reference · 13 exports

Source declarations and literal docstrings from this release. Package code was not executed.

validate/all-of

(validate/all-of . preds)
Value must satisfy every given predicate or validator.

Source: package.sema:75

validate/assert!

(validate/assert! sch data)
Return data if valid; raise an error listing every failure if not.

Source: package.sema:189

validate/errors

(validate/errors sch data)
Return a list of error maps ({:path :message :value}). Empty list if valid.

Source: package.sema:173

validate/in-range

(validate/in-range lo hi)
Value must be a number within the inclusive range [lo, hi].

Source: package.sema:100

validate/list-of

(validate/list-of pred)
Value must be a list whose every element matches the predicate or validator.

Source: package.sema:84

validate/matches

(validate/matches pattern)
Value must be a string matching the given regex pattern.

Source: package.sema:92

validate/max-length

(validate/max-length n)
Value must be a string or list with at most n characters/elements.

Source: package.sema:118

validate/min-length

(validate/min-length n)
Value must be a string or list with at least n characters/elements.

Source: package.sema:108

validate/one-of

(validate/one-of . values)
Value must equal one of the given values.

Source: package.sema:67

validate/optional

(validate/optional pred)
Mark a field as optional: absent is fine, present values must still match. pred is a predicate, validator, or nested spec map.

Source: package.sema:58

validate/required

(validate/required pred)
Mark a field as required. pred is a predicate, validator, or nested spec map.

Source: package.sema:50

validate/schema

(validate/schema spec)
Create a schema from a spec map.

Source: package.sema:143

validate/valid?

(validate/valid? sch data)
Return #t if data matches the schema, #f otherwise.

Source: package.sema:177