You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently each property or element can be defined with only one validation type (e.g. string, integer, datetime, etc.). However, there are cases where it may be beneficial to allow a value to be one of several types (e.g. a date as either an ISO 8601 date/time string or as a Unix timestamp) while still being able to set some constraints on them.
Add a new validation type (e.g. conditional) that selects one of several different validators to apply to a property or element based on some condition (specified as a function).
The `conditional` validation type allows an item's value to conform to any one of several candidate validators. Each validator is accompanied by a condition that specifies whether to apply the validator to the item's value. If none of the conditions are satisfied, the value is rejected. This allows, for example, an array to contain a mix of data types or an object property to expect a different string format based on the state of other properties of the object.
Verifies that an outer conditional validator's constraints are inherited by inner candidate validators regardless of whether they are static or dynamic constraints.
Feature Request
Description
Currently each property or element can be defined with only one validation type (e.g.
string
,integer
,datetime
, etc.). However, there are cases where it may be beneficial to allow a value to be one of several types (e.g. a date as either an ISO 8601 date/time string or as a Unix timestamp) while still being able to set some constraints on them.Add a new validation type (e.g.
conditional
) that selects one of several different validators to apply to a property or element based on some condition (specified as a function).Examples
The text was updated successfully, but these errors were encountered: