eslint-plugin-nestjs-typed icon indicating copy to clipboard operation
eslint-plugin-nestjs-typed copied to clipboard

api-property-matches-property-optionality gets confused when property has default provided

Open karlismelderis-mckinsey opened this issue 1 year ago • 1 comments

This is bit of a grey area but still would be nice if we wouldn't need to disable @darraghor/nestjs-typed/api-property-matches-property-optionality for every such property

  @IsOptional()
  @IsString()
  @Expose()
  @ApiPropertyOptional({
    type: String,
    default: 'example',
  })
  label: string  = 'example';

@ApiPropertyOptional tells that users don't need to provide this data in body and it will be filled in with default

Can we add an option for the rule to accept @IsOptional if default is provided in @ApiPropertyOptional and property is required

karlismelderis-mckinsey avatar Feb 16 '24 11:02 karlismelderis-mckinsey

Yes, if you submit a PR for this it would be awesome. Thank you!

darraghoriordan avatar Mar 19 '24 09:03 darraghoriordan