nestjs / graphql

GraphQL (TypeScript) module for Nest framework (node.js) 🍷
https://docs.nestjs.com/graphql/quick-start
MIT License
1.46k stars 397 forks source link

mapped-types does not inherit class-validator #3371

Closed 4FunAndProfit closed 1 week ago

4FunAndProfit commented 1 week ago

Is there an existing issue for this?

Current behavior

Hello !

strange behavior on mapped-types, is it attended? Is there a way to pass class-validator through picktype?

@ObjectType()
class User {
  @IsUUID()
  id: string;

  @IsString()
  firstName: string;

  @IsString()
  lastName: string;
}
@InputType()
export class CreateUserInput extends PickType(
  User,
  ['firstName', 'lastName'], <= not class-validator validated
  InputType,
) {
}

Thanks a lot in advance

Minimum reproduction code

-

Steps to reproduce

No response

Expected behavior

There is a lot of code duplicatation which may results in bugs.

Package version

12.2.1

Graphql version

graphql:

NestJS version

No response

Node.js version

No response

In which operating systems have you tested?

Other

No response