-
Notifications
You must be signed in to change notification settings - Fork 19
Open
Labels
enhancementNew feature or requestNew feature or requesthacktoberfesthelp wantedExtra attention is neededExtra attention is neededseverity-minorItem is not urgentItem is not urgent
Description
It should be possible to validate sinbling fields based on a condition.
Something like this:
const User =
entity('Person', {
name: field(String),
hasChildren: field(Boolean),
childrenNames: field([String]).when('hasChildren', {
is: true, // possibility to use a function instead
then: ({ validation: { presence: true } }),
// otherwise: some other validation
}),
})
inspired on yup .when()
what do you guys think?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthacktoberfesthelp wantedExtra attention is neededExtra attention is neededseverity-minorItem is not urgentItem is not urgent
Type
Projects
Status
Ready to code