Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rules for arrays and objects validation #13

Open
FluorescentHallucinogen opened this issue Apr 10, 2019 · 1 comment
Open

Add rules for arrays and objects validation #13

FluorescentHallucinogen opened this issue Apr 10, 2019 · 1 comment

Comments

@FluorescentHallucinogen
Copy link
Contributor

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
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant