Hey,
I am attempting to use validators from class-validator in a GraphQL @InputType(). Not sure if I've setup this correctly.
I have the following enabled the global pipe in main.ts via app.useGlobalPipes(new ValidationPipe());
@InputType()
export class PaginationArgs {
@Field(() => Int, { nullable: true })
@Min(0)
skip?: number;
@Field(() => Int, { nullable: true })
@Min(0)
@Max(50)
take = 50;
}
@ArgsType()
export class TestQueryArgs {
@Field(() => PaginationArgs, { nullable: true })
pagination: PaginationArgs;
@Field()
@Max(10)
test: number;
}
The @Max decorator validation on TestQueryArgs.test works but the ones on PaginationArgs do not. Have I misunderstood how you set this up?