nestjs / swagger

OpenAPI (Swagger) module for Nest framework (node.js) :earth_americas:

Home Page:https://nestjs.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@ApiProperty() enum can display keys in the UI instead of just values.

mstar-kk opened this issue · comments

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

enum define

enum ReplyStatusEnum {
  STATELESS = 0,
  REPLIED = 1,
  CONTENT_FILTER = 2,
  RATE_FILTER = 3,
}

Request Body define

class BodyDto {
  @IsOptional()
  @IsEnum(ReplyStatusEnum)
  @ApiProperty({ description: '', enum: ReplyStatusEnum, required: false, type: 'array', enumName: 'ReplyStatusEnum' })
  replyStatus: ReplyStatusEnum;
}

swagger ui
image

Describe the solution you'd like

Is it possible to display key values in the UI, rather than just the values, enabling API documentation readers to clearly understand the meaning of each?
image

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

Enhance the UI reading experience for better comprehension.

Please, report this issue in the swagger-ui-dist repository