Skip to content

ApiProperty with enum undefined changes type #3229

@nxht

Description

@nxht

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

Query parameter name shown as number despite the dto type says string

Minimum reproduction code

https://github.com/nxht/test-nestjs

Steps to reproduce

  1. pnpm install
  2. pnpm start:dev
  3. Open http://localhost:3000/docs#/App/AppController_getHello

Expected behavior

Query parameter name should be string

Package version

8.1.0

NestJS version

10.4.15

Node.js version

20.9.0

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

DTO tested:

export class TestDto {
  @ApiProperty({
    type: 'string',
    enum: undefined,
  })
  name: string;
}

When the enum: undefined is removed, it works normally.

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