(keys & args)
Use spec-tools.spell-spec.alpha/keys
the same way that you would use
clojure.spec.alpha/keys
keeping in mind that the spec it creates
will fail for keys that are misspelled.
spec-tools.spell-spec.alpha/keys
is a spec macro that has the same signature and
behavior as clojure.spec.alpha/keys. In addition to performing the
same checks that clojure.spec.alpha/keys
does, it checks to see if
there are unknown keys present which are also close misspellings of
the specified keys.
An important aspect of this behavior is that the map is left open to other keys that are not close misspellings of the specified keys. Keeping maps open is an important pattern in Clojure which allows one to simply add behavior to a program by adding extra data to maps that flow through functions. spec-tools.spell-spec.alpha/keys keeps this in mind and is fairly conservative in its spelling checks.
Use `spec-tools.spell-spec.alpha/keys` the same way that you would use `clojure.spec.alpha/keys` keeping in mind that the spec it creates will fail for keys that are misspelled. `spec-tools.spell-spec.alpha/keys` is a spec macro that has the same signature and behavior as clojure.spec.alpha/keys. In addition to performing the same checks that `clojure.spec.alpha/keys` does, it checks to see if there are unknown keys present which are also close misspellings of the specified keys. An important aspect of this behavior is that the map is left open to other keys that are not close misspellings of the specified keys. Keeping maps open is an important pattern in Clojure which allows one to simply add behavior to a program by adding extra data to maps that flow through functions. spec-tools.spell-spec.alpha/keys keeps this in mind and is fairly conservative in its spelling checks.
(known-keys-spec known-keys)
A spec that verifies that a keyword is a member of the provided set
of keywords. Will produce problems with a
:expound.spec.problem/type
of both
:spec-tools.spell-spec.alpha/misspelled-key
and
:spec-tools.spell-spec.alpha/unknown-key
A spec that verifies that a keyword is a member of the provided set of keywords. Will produce problems with a `:expound.spec.problem/type` of both `:spec-tools.spell-spec.alpha/misspelled-key` and `:spec-tools.spell-spec.alpha/unknown-key`
(map-explain f aspec)
A spec wrapper that takes a function and a spec, and returns a spec
that will map a function over the spec problems emmitted by the call
to clojure.spec.alpha/explain*
on that spec.
Useful for enhancing the spec problems with extra data.
A spec wrapper that takes a function and a spec, and returns a spec that will map a function over the spec problems emmitted by the call to `clojure.spec.alpha/explain*` on that spec. Useful for enhancing the spec problems with extra data.
(not-misspelled-spec known-keys)
A spec that verifies that a keyword is not a near misspelling of
the provided set of keywords. Will produce problems with a
:expound.spec.problem/type
of :spec-tools.spell-spec.alpha/misspelled-key
A spec that verifies that a keyword is not a near misspelling of the provided set of keywords. Will produce problems with a `:expound.spec.problem/type` of `:spec-tools.spell-spec.alpha/misspelled-key`
(pre-check & specs)
Similar to clojure.spec.alpha/and
but treats the all the specs
except the last one as pre-conditions for validity purposes but behaves
like a proxy to the last spec provided for everything else.
Similar to `clojure.spec.alpha/and` but treats the all the specs except the last one as pre-conditions for validity purposes but behaves like a proxy to the last spec provided for everything else.
(strict-keys & args)
strict-keys
is very similar to spec-tools.spell-spec.alpha/keys
except
that the map is closed to keys that are not specified.
strict-keys
will produce two types of validation problems: one for
misspelled keys and one for unknown keys.
This spec macro violates the Clojure idiom of keeping maps open. However,
there are some situations where this behavior is warranted. I
strongly advocate for the use of spec-tools.spell-spec.alpha/keys
over
strict-keys
`strict-keys` is very similar to `spec-tools.spell-spec.alpha/keys` except that the map is closed to keys that are not specified. `strict-keys` will produce two types of validation problems: one for misspelled keys and one for unknown keys. This spec macro violates the Clojure idiom of keeping maps open. However, there are some situations where this behavior is warranted. I strongly advocate for the use of `spec-tools.spell-spec.alpha/keys` over `strict-keys`
(warn-keys & args)
This macro is the same as spec-tools.spell-spec.alpha/keys
macro except
it will print warnings instead of failing when misspelled keys are discovered.
This macro is the same as `spec-tools.spell-spec.alpha/keys` macro except it will print warnings instead of failing when misspelled keys are discovered.
(warn-only-impl spec)
A spec wrapper that forces warn only behavior.
A spec wrapper that forces warn only behavior.
(warn-strict-keys & args)
This macro is similar to spec-tools.spell-spec.alpha/strict-keys
macro
except that it will print warnings for unknown and misspelled keys
instead of failing.
This macro is similar to `spec-tools.spell-spec.alpha/strict-keys` macro except that it will print warnings for unknown and misspelled keys instead of failing.
(warning-spec wspec)
Wraps a spec and will behave just like the wrapped spec but if
spec-tools.spell-spec.alpha/*warn-only*
is bound to true
around spec
validation calls, this will print warnings instead of failing the
validation.
Bind the spec-tools.spell-spec.alpha/*warning-handler*
if you want to handle
the emmitted warnings.
Wraps a spec and will behave just like the wrapped spec but if `spec-tools.spell-spec.alpha/*warn-only*` is bound to `true` around spec validation calls, this will print warnings instead of failing the validation. Bind the `spec-tools.spell-spec.alpha/*warning-handler*` if you want to handle the emmitted warnings.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close