Expand description
The builders: functions that take a spec and return a node with the builder’s rule applied, and the same as methods on a node so they chain.
A builder given a wrong argument returns a node that accepts nothing and says why at validation, since a Rust builder cannot throw as the canonical one does; a chain method on such an argument turns its node into that fault.
Structs§
- Refer
Options referoptions.- Rename
Options renameoptions.
Enums§
- TypeRef
- What
type_takes its kind from.
Functions§
- above
- A strict lower bound on value, or length.
- after
- A custom validator run after the structural check.
- all
- The value must satisfy every shape.
- any
- An optional
Any, the node a builder with no spec starts from. - before
- A custom validator run before the structural check.
- below
- A strict upper bound on value, or length.
- buildize
- A spec as a node: what every builder starts from.
- catch
- Whatever fails inside is replaced with the fallback, raising nothing.
- check
- A custom check, run before the structural check.
- check_
re - A regexp check: the value must be a string matching it. A failure reads
check "/re/" failed. - child
- The shape of every unknown object value, or of every array element.
- closed
- An object rejects keys it does not declare; a single-shape array becomes a tuple of one.
- coerce
- The value is converted to the node’s kind where the conversion is unambiguous, before the type check.
- date_
time - A strict ISO 8601 date-time string.
- default
- Optional, with an explicit default. The node is the spec’s, so an object or array shape keeps its children; an untyped spec takes the default’s kind.
- default_
of - A default with no spec: the node takes the default’s kind.
- define
- Name the node so a later
refercan substitute it. - describe
- A description, read back from the node’s meta.
- A string in email address form.
- empty
- The empty string is allowed. Untyped when bare:
empty(any())allows the empty string without also demanding a string. - exact
- The value must equal one of the literals.
- fault
- A
Faultmessage overriding the structural text. - func
- A function-typed value. A builder, not a type token, so it does not require a value of itself.
- ignore
- Like
skip, and a value that fails is dropped with its errors. - ip
- An IPv4 or IPv6 address.
- ipv4
- A dotted-quad IPv4 address.
- ipv6
- An IPv6 address in RFC 4291 text form.
- key
- The value is replaced with the key of the property it sits under.
- key_
args keyfrom raw arguments: a numeric argument is the depth, a string the separator, as the string form of a spec supplies them.- key_
depth - The value is replaced with the path
depthlevels up, as an array. - key_
join - The value is replaced with the path
depthlevels up, joined bysep. - len
- An exact value, or length.
- max
- A maximum value, or length.
- min
- A minimum value, or length.
- never
- A node that accepts nothing.
- nullable
- An explicit null is accepted as the value.
- one
- The value must satisfy exactly one of the shapes.
- open
- An object accepts keys it does not declare.
- optional
- The value may be absent; the default is injected.
- refer
- Substitute the named node at validation time.
- refer_
with referwith options.- rename
- Rename the property after validation. For object children only.
- rename_
with renamewith options.- required
- The value must be present.
- rest
- The shape of the array elements past the tuple positions.
- skip
- Optional, and an absent value leaves the key out.
- some
- The value must satisfy at least one of the shapes.
- transform
- A valid value is replaced with a function of it.
- type_
- The kind the node asserts, given a kind, a token, a kind name or a node to take it from.
- url
- An absolute URL.
- uuid
- A UUID in 8-4-4-4-12 hex form.