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.
Removes a value
defeined by equals()
call.
Clears type set by call to .hasType<T>()
, default schema type inference will be used
for schema retuned by this call.
Remove all preprocessors for this schema.
Remove all validators for this schema.
Protected
createProtected method used to create an new instance of the Builder
defined by the props
object. Should be used to instanticate new
builders to keep builder's immutability.
arbitrary props object
Restricts object to be equal to value
.
Set type of schema explicitly. notUsed
param is needed only for cas when JS is used. E.g. when you
can't call method like schema.hasType<Date>()
, so instead you can call schema.hasType(new Date())
with the same result.
Optional
notUsed: TGenerates a serializable object describing the defined schema
If set, restrict object to be equal to a certain value.
If set to false
, schema will be optional (null
or undefined
values
will be considered as valid).
Array of preprocessor functions
String id
of schema type, e.g. string',
numberor
object`.
Array of validator functions
Makes schema optional (consider null
and undefined
as valid objects for this schema)
Protected
preMakes schema required (consider null
and undefined
as invalid objects for this schema)
Performs validion of the schema over object
. Basically runs
validators, preprocessors and checks for required (if schema is not optional).
Optional
context: ValidationContextOptional ValidationContext
settings.
Static
createGenerated using TypeDoc
Similar to
boolean
type in TypeScript. Allows to define a schema for a boolean value. It can be required or optional. It can be restricted to be equal to a certain value.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.
Example
Example
Example
See
boolean