nestjs/swagger

Add decorator to allow specification of the schema type name

danielsharvey opened this issue · 1 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

There are cases where overriding the default DTO class name for use with Swagger docs would be necessary / extremely useful.

In my case, when I generating DTOs from Zod schemas, but the referenced issues contain comments from a number of others who requested this feature.

The @ApiSchema() decorator as been proposed, discussed and implemented to achieve this. It seems to have support of the maintainers.

There are several issues covering this - primarily #983.

Additionally, a PR has been created - see #2427.

However, the issues is closed and locked even thought the PR has not been merged. Additionally, the PR discussion is locked.

Describe the solution you'd like

I am opening this issue to track the support for finalising merging #2427.

Is it possible to move this forward?

Teachability, documentation, adoption, migration strategy

There is also a docs PR nestjs/docs.nestjs.com#1533.

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

There are cases where overriding the default DTO class name for use with Swagger docs would be necessary / extremely useful.

In my case, when I generating DTOs from Zod schemas, but the referenced issues contain comments from a number of others who request this feature.

We understand the need for this decorator and I'm sure it will (hopefully soon) land in @nestjs/swagger.

Duplicate of #2427