class-validator-jsonschema icon indicating copy to clipboard operation
class-validator-jsonschema copied to clipboard

feat: add option doNotExcludeDecorator

Open Innei opened this issue 3 years ago • 0 comments

I have encountered a problem. I have a Dto that has a field decorated by Exclude, but I don't want it to disappear from the JsonSchema.


export class TerminalOptionsDto {
  @IsOptional()
  @IsBoolean()
  enable: boolean

  @IsOptional()
  @IsString()
  @Transform(({ value }) =>
    typeof value == 'string' && value.length == 0 ? null : value,
  )
  @Exclude({ toPlainOnly: true, })
  @JSONSchema({ format: 'password', type: 'string', title: '密码' })
  password?: string

  @IsOptional()
  @IsString()
  script?: string
}

The password is disappear in JSONSchema, but I need it.

So, can add option to disable this feature?

Innei avatar Feb 16 '22 13:02 Innei