Brakebein / prisma-generator-nestjs-dto

Generates NestJS DTO classes from Prisma Schema
Apache License 2.0
51 stars 28 forks source link

Feature request @DtoUpdateRequired #40

Closed KoenLemmen closed 5 months ago

KoenLemmen commented 5 months ago

Please add a decorator that sets an update DTO property to required: true and no ? and @IsOptional()

For example:

  @ApiProperty({
    type: 'string',
    required: false,
  })
  @IsOptional()
  @IsString()
  name?: string;

Would become

  @ApiProperty({
    type: 'string',
    required: true, // or if true by default remove this line
  })
  @IsString()
  name: string;

Right now I modify this manually locally, but we run prisma generate during CI/CD and this overwrites the manually edited DTO's causing errors. Please consider this for users who want a property in update to be required for each update.

Brakebein commented 5 months ago

Thanks! I just released a new version that includes your additions.

KoenLemmen commented 5 months ago

Thanks!