Liking cljdoc? Tell your friends :D

schema.spec.core

Protocol and preliminaries for Schema 'specs', which are a common language for schemas to use to express their structure.

Protocol and preliminaries for Schema 'specs', which are a common language
for schemas to use to express their structure.
raw docstring

+no-precondition+clj/s

source

CoreSpecclj/sprotocol

Specs are a common language for Schemas to express their structure. These two use-cases aren't priveledged, just the two that are considered core to being a Spec.

Specs are a common language for Schemas to express their structure.
These two use-cases aren't priveledged, just the two that are considered core
to being a Spec.

checkerclj/s

(checker this params)

Create a function that takes [data], and either returns a walked version of data (by default, usually just data), or a utils/ErrorContainer containing value that looks like the 'bad' parts of data with ValidationErrors at the leaves describing the failures.

params are: subschema-checker, return-walked?, and cache.

params is a map specifying:

  • subschema-checker - a function for checking subschemas
  • returned-walked? - a boolean specifying whether to return a walked version of the data (otherwise, nil is returned which increases performance)
  • cache - a map structure from schema to checker, which speeds up checker creation when the same subschema appears multiple times, and also facilitates handling recursive schemas.
Create a function that takes [data], and either returns a walked version of data
(by default, usually just data), or a utils/ErrorContainer containing value that looks
like the 'bad' parts of data with ValidationErrors at the leaves describing the failures.

params are: subschema-checker, return-walked?, and cache.

params is a map specifying:
 - subschema-checker - a function for checking subschemas
 - returned-walked? - a boolean specifying whether to return a walked version of the data
   (otherwise, nil is returned which increases performance)
 - cache - a map structure from schema to checker, which speeds up checker creation
   when the same subschema appears multiple times, and also facilitates handling
   recursive schemas.

subschemasclj/s

(subschemas this)

List all subschemas

List all subschemas
sourceraw docstring

preconditionclj/s

(precondition s p err-f)

Helper for making preconditions. Takes a schema, predicate p, and error function err-f. If the datum passes the predicate, returns nil. Otherwise, returns a validation error with description (err-f datum-description), where datum-description is a (short) printable standin for the datum.

Helper for making preconditions.
Takes a schema, predicate p, and error function err-f.
If the datum passes the predicate, returns nil.
Otherwise, returns a validation error with description (err-f datum-description),
where datum-description is a (short) printable standin for the datum.
sourceraw docstring

run-checkerclj/s

(run-checker f return-walked? s)

A helper to start a checking run, by setting the appropriate params. For examples, see schema.core/checker or schema.coerce/coercer.

A helper to start a checking run, by setting the appropriate params.
For examples, see schema.core/checker or schema.coerce/coercer.
sourceraw docstring

simple-preconditionclj/smacro

(simple-precondition s f-sym)

A simple precondition where f-sym names a predicate (e.g. (simple-precondition s map?))

A simple precondition where f-sym names a predicate (e.g. (simple-precondition s map?))
sourceraw docstring

sub-checkerclj/s

(sub-checker {:keys [schema error-wrap]}
             {:keys [subschema-checker cache] :as params})

Should be called recursively on each subschema in the 'checker' method of a spec. Handles caching and error wrapping behavior.

Should be called recursively on each subschema in the 'checker' method of a spec.
Handles caching and error wrapping behavior.
sourceraw docstring

with-cacheclj/s

(with-cache cache cache-key wrap-recursive-delay result-fn)
source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close