NumberSchema <T>
Type parameters
- T = number
Hierarchy
- Schema<T>
- NumberCriterias<NumberSchema<T>>
- CommonCriterias<NumberSchema<T>>
- NumberSchema
Index
Methods
and
between
Require field value to be between 2 numbers.
custom
Set a callback to run custom validation logic.
deprecate
Set a message to log when this field is present.
float
Require field value to be a float (requires a decimal).
gt
Require field value to be greater than a number.
gte
Require field value to be greater than or equals to a number.
int
Require field value to be an integer.
lt
Require field value to be less than a number.
lte
Require field value to be less than or equals to a number.
negative
Require field value to be negative and not zero.
never
Mark that this field should never be used.
notNullable
Disallow null values.
notUndefinable
Disallow undefined values. Will fallback to the default value.
nullable
Allow and return null values.
oneOf
Require field value to be one of the provided numbers.
Type parameters
- I: number = number
only
Mark that this field can ONLY use a value that matches the default value.
optional
Require this field to NOT be explicitly defined.
or
Map a list of field names that must have at least 1 defined.
positive
Require field value to be positive and not zero.
required
Require this field to be explicitly defined.
schema
The type of schema.
state
The internal state object. Contains useful metadata.
transform
Transform a value before it’s passed to the next criteria.
type
The type of schema and it’s children (when applicable).
undefinable
Allow and return undefined values. Will NOT fallback to the default value.
validate
Run all validation checks that have been enqueued and return a type casted value. If a value is undefined, inherit the default value, otherwise throw if required. If nullable and the value is null, return early.
when
Validate with another schema when a condition is met.
xor
Map a list of field names that must not be defined alongside this field.
Map a list of field names that must be defined alongside this field.