-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Description
In the current version, all constraint directives are run when validating an input. This is usually a good thing, but we might want, sometimes, to stop the validation if a specific constraint is not met.
For example: let's define a new constraint @ComplexConstraint.
type Mutation {
createObject(input: [CreateObjectInput] @NotEmpty @ComplexConstraint): Object
}
In this case, it would be great if the @ComplexConstraint would not be run if the input is empty.
Another use case is a @lookup constraint. When run, it checks if an ID exists in the database.
type Mutation {
updateObject(id:ID @Lookup, input: UpdateObjectInput @ComplexConstraint): Object
}
Here, the mutation should try to validate the input only and only if the object to edit exists in the database.
Metadata
Metadata
Assignees
Labels
No labels