Optional
allowedFor serialization, the first type will be used. ['number']
is assumed if nothing is specified.
For deserialization, forms are tried in order.
If one or more values are specified, the value must be equal to one of the specified values or in one of the specified ranges
Returns a new schema that requires that either this schema is satisfied or that the value is null
.
Deeply clones a value
Optional
descriptionA description, which can be used by code generation tools to generate documentation
Deserialize (and validate) a value
If one or more values are specified, the value must be divisible by one of the specified options
An estimate of the time complexity for validating this element, which should be on the same order of the number of items to be validated
Optional
exampleAn example, which can be used by code generation tools to generate documentation
If true
, "shallow"
ancestor validation mode preferences won't be used when this schemas validation mode preference is
"inherit"
, like other built-in container types
If true
, this schema or any sub-elements have the potential to represent an object value that might need unknown-key removal
A marker that can be used for testing if this is a YaSchema schema
Returns a new schema that requires that this schema is satisfied but that the specified schema cannot be satisfied.
Returns a new schema that requires that either this schema is satisfied or that the value is undefined
.
The preferred validation mode for this schema.
The lesser level of the preferred validation mode, which will be applied recursively depending on the depth
parameter / unless
further re-specified, and the specified validation mode, will be used, where the order is none < soft < hard
.
Special Values:
"initial"
- use the initially specified validation mode for the current operation (ex. the validation
field of the options
parameter to deserialize
)."inherit"
- use the closet applicable mode from an ancestor schema level.The type of schema
Serialize (and validate) a value
Sets (replaces) the allowed serialization forms metadata for this schema and returns the same schema
Sets (replaces) the description metadata for this schema and returns the same schema
Sets (replaces) the example metadata for this schema and returns the same schema
Sets (replaces) the preferred validation mode for this schema and returns the same schema.
The lesser level of the preferred validation mode, which will be applied recursively depending on the depth
parameter / unless
further re-specified, and the specified validation mode, will be used, where the order is none < soft < hard
.
The preferred validation mode for this schema Special Values:
"initial"
- use the initially specified validation mode for the current operation (ex. the validation
field of the options
parameter to deserialize
)."inherit"
- use the closet applicable mode from an ancestor schema level.Makes a string representation of this schema, mostly for debugging
If true
, this schema or any sub-elements have a custom serializer-deserializer
Validate a value
The actual value of this field is always undefined
, but this should be used for determining the value type represented by this
schema, ex. typeof someSchema.valueType
Requires a real, finite number, optionally matching one of the specified values or in one of the specified ranges and optionally being divisible by one of the specified divisors.