Skip to content

Add rules for arrays and objects validation #13

@FluorescentHallucinogen

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
}

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