Skip to content

Add rules for arrays and objects validation #13

Description

Validate array argument. Something like:

type Mutation {
  updateUser(
    id: ID!
    name: String
    emails: [String!]! @constraint(
      minItems: 1,
      maxItems: 3,
      uniqueItems: true,
      format: "email" #applies to all items of array?
    )
  )
}

Validate object argument (useful when argument is an input type). Something like:

type Mutation {
  updateUser(
    data: UserUpdateInput! @constraint(
      name: { minLength: 5, maxLength: 40 },
      email: { format: "email" },
      age: { min: 18, max: 100 }
    )
    where: UserWhereUniqueInput!
  ): User!
}

input UserUpdateInput {
  name: String
  email: String
  age: Int
  verified: Boolean
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions