The underlying schema type to modify
Creates a new optional modifier wrapping the given schema.
The schema to make optional
Optionalvalidations: Validation<any>[]Optional list of validations to apply
Define the input type of the schema, including undefined and null
The output value of the field with undefined support. The property points to a type only and not the real value.
Type marker for camelCase output type inference
List of validations to apply to non-undefined values
Define a callback to conditionally require a field at runtime.
The callback method should return "true" to mark the field as required, or "false" to skip the required validation
Define a callback to conditionally require a field at runtime.
The callback method should return "true" to mark the field as required, or "false" to skip the required validation
Mark the field under validation as required when all
the other fields are present with value other
than undefined or null.
Mark the field under validation as required when any one of the other fields are present with non-nullable value.
Mark the field under validation as required when all
the other fields are missing or their value is
undefined or null.
Mark the field under validation as required when any one of the other fields are missing.
Mark the field under validation to be null. The null value will be written to the output as well.
If optional and nullable are used together, then both undefined
and null values will be allowed.
Push a validation to the validations chain.
Creates a fresh instance of the underlying schema type and wraps it inside the optional modifier
Compiles to compiler node
Modifies the schema type to allow undefined values in addition to the original schema type. This is useful for form fields that may not be present in the submitted data.
Example