`@ApiHideClass()`/`@ApiHideDto()` decorator
ehenon 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
There are decorators such as @ApiExcludeEndpoint
to exclude documentation for a route, or even @ApiExcludeController
to exclude documentation for an entire controller. In the same way, it's possible to hide a property of a DTO class for example, via the @ApiHideProperty
decorator.
However, it doesn't seem possible to completely hide a class from the doc, aka exclude a class from the list of schemas.
Describe the solution you'd like
@ApiHideClass() // or @ApiHideDto
class Test {
@ApiProperty()
a: string;
@ApiProperty()
b: string;
}
The Test
class schema is not included in the list of schemas at the bottom of the Swagger doc.
Teachability, documentation, adoption, migration strategy
No response
What is the motivation / use case for changing the behavior?
Being able to define particular classes or subclasses for certain ApiResponse shapes but without necessarily wanting all these subclasses to be included in the list of OpenAPI schemas.
Thanks for your suggestion!
This has been discussed in the past and we decided to not implement it in the foreseeable future.
If you think your request could live outside Nest's scope, we'd encourage you to collaborate with the community on publishing it as an open source package.