The underlying literal schema type to make optional
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.
Camelcase output type with undefined support
List of additional 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.
Apply transform on the final validated value. The transform method may convert the value to any new datatype.
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 a literal schema type to allow undefined values in addition to the original type. This modifier is used for form fields that may not be present in submitted data.
Example