Protected isProtected preprocessorsA list of preprocessors associated with the Builder
Protected typeProtected validatorsA list of validators associated with the Builder
Adds a preprocessor to a preprocessors list
Adds a validator to validators list.
Clear max length of the valid array value for schema.
Clear minimal length of the valid array value for schema.
Remove all preprocessors for this schema.
Remove all validators for this schema.
Generates a serializable object describing the defined schema
Schema of array item (if defined)
If set to false, schema will be optional (null or undefined values
will be considered as valid).
Max length of a valid array
Min length of a valid array
Array of preprocessor functions
String id of schema type, e.g. string', numberorobject`.
Array of validator functions
Set max length of the valid array value for schema.
Set minimal length of the valid array value for schema.
Set a schema that every array item has to satisfy. If it is not set, Item of any type is allowed.
Schema that every array item has to satisfy
Protected prePerforms validion of the schema over object. Basically runs
validators, preprocessors and checks for required (if schema is not optional).
Optional context: ValidationContextOptional ValidationContext settings.
Generated using TypeDoc
Similar to the
Arraytype in TypeScript. It can be used to validate arrays of any type. It can also be used to validate arrays of specific type. For example, if you want to validate an array of numbers, you can usearray(number())to create a schema builder. If you want to validate an array of users, you can usearray().of(object({ name: string(), age: number() }))to create a schema builder. If you want to validate an array of numbers or strings, you can usearray(union(number()).or(string())).Also you can limit the length of the array by using
minLengthandmaxLengthmethods.NOTE this class is exported only to give opportunity to extend it by inheriting. It is not recommended to create an instance of this class directly. Use () function instead.
See
array