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

Enums with enumName field and additional fields generate non-functional swagger file

Algram opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

If you have a look at my gist, I added additional fields like deprecated or description to an enum that also has enumName.
In this case, the resulting swagger file is not really functional since as per swagger specification, siblings to refs get ignored completely: https://swagger.io/docs/specification/using-ref/#sibling

Since there is no way to use decorators with enums, it is currently impossible to be swagger-spec compliant. I think the generation would have to move the additional fields to the referenced enum instead of keeping it in place.

Minimum reproduction code

https://gist.github.com/Algram/5e95133afd8750bd4f936cd846f51639

Steps to reproduce

No response

Expected behavior

The additional fields are part of the referenced enum.

Package version

7.2.0

NestJS version

10.3.1

Node.js version

No response

In which operating systems have you tested?

  • macOS
  • Windows
  • Linux

Other

No response

Would you like to create a PR for this issue?

@kamilmysliwiec Sure, I've opened one here: #2816

Let's track this here #2816