Skip to content

InputType Array Validation #923

@hayes

Description

@hayes

Discussed in #921

Originally posted by enri90 May 26, 2023
I have a problem with the module
https://pothos-graphql.dev/docs/plugins/validation

when I use an inputType in array it doesn't parse for validation

export const BlockByInput = builder.inputType('BlockByInput', {
  fields: (t) => ({
    code: t.string({
      required: true,
      validate: {
        schema: z.string().min(1).max(5),
      },
    }),
  })
})

the code is not parsed validation

t.stringList({
  nullable: false,
  args: {
    blocks: t.arg({
      type: [BlockByInput],
      required: true,
    }),
  },
  errors: {
    types: [ZodError],
  },

the code is parsed

t.boolean({
  nullable: false,
  args: {
    block: t.arg({
      type: BlockByInput,
      required: true,
    }),
  },
  errors: {
    types: [ZodError],
  },

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