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
oneOf("only one of arrayOne or arrayTwo can be present!",{
MyData::arrayOne{
minItems(1)
}
MyData::arrayTwo{
maxItems(0)
}
},{
MyData::arrayOne{
maxItems(0)
}
MyData::arrayTwo{
minItems(1)
}
})
This creates a validation error, if not only one of the rules passed. This specific validation ensures that only one of the specified arrays have any items. I'd set both of the default values to an empty array, and after I parsed it from say json only the array that was present in the input will contain any items.
Add support for Swagger/OpenAPI #6 , an openapi generator can generate the relationships as constraints. As a bonus it provides that generator instant support for oneOf,anyOf as you can use validation results to check which type it matches. (allOf is supported by the class structure). You do need to use nullable fields, but it is a small price for this feature.
Cross-field validation #29 you can use the individual validation statements to set up constraints between fields, as shown in the example.
For example a login field can be a phone or and email.
The text was updated successfully, but these errors were encountered: