Ryan-Sin / swagger-nestjs-codegen

MIT License
20 stars 4 forks source link

Don't change case of schema properties #12

Open d9k opened 1 year ago

d9k commented 1 year ago

Input

# . . . . .

components:
  schemas:
    MyItem:

# . . . . .

      updated_at: 
          type: string
          format: date-time
          nullable: true

# . . . . .

Ouput to src/dto/data/my-item.data.ts

// . . . . .

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

// . . . . .

Expected ouput to src/dto/data/my-item.data.ts

// . . . . .

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

// . . . . .

Reason

Sometimes it is a business requirement to have snake_case properties names for JSON body/JSON response.

d9k commented 1 year ago

Please feel free to inspect, copy, modify, apply code patches from my fork https://github.com/d9k/swagger-nestjs-codegen