Skip to content

x-enumNames no longer works from v8.0.0 #3294

@nadavhalfon

Description

@nadavhalfon

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

in PR #3123 there is a refactor of createEnumSchemaType function:

Image

I'm not sure if that's the root cause

Minimum reproduction code

https://gist.github.com/nadavhalfon/f49db6fe0ea6eb49178ec84c9f338b0a

Steps to reproduce

@ApiProperty({
  enum: CreditCardDealType,
  enumName: 'CreditCardDealType',
  'x-enumNames': ['REGULAR', 'PAYMENTS'],
})
cardDealType?: CreditCardDealType;


export enum CreditCardDealType {
  REGULAR = 1,
  PAYMENTS = 2,
}

Outputs in swagger generator: 
export enum CreditCardDealType {
  Value1 = 1,
  Value2 = 2,
}

Expected behavior

Outputs in swagger generator:

export enum CreditCardDealType {
  REGULAR = 1,
  PAYMENTS = 2,
}

Package version

11.0.3

NestJS version

No response

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions