Skip to content

Feature: break constraint validation option #9

@lilianchiassai

Description

@lilianchiassai

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions