@ApiProperty not working with swagger plugin on DTO classes
See original GitHub issueI’m submitting a…
[ ] Regression
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.
Current behavior
When using the plugin @nestjs/swagger/plugin
is not possible to override the api properties in a DTO class that is used with a @Body
decorator in a controller. This causes the error Uncaught SyntaxError: Unexpected identifier
when trying to use swagger ui
Expected behavior
Being able to override the api properties of the class while using the plugin
Minimal reproduction of the problem with instructions
Add @ApiProperty()
to one of the properties in the class CreateCatDto
from the sample https://github.com/nestjs/nest/tree/master/sample/11-swagger
What is the motivation / use case for changing the behavior?
Being able to be more descriptive on specific endpoints (description, examples, etc…)
Environment
Nest version:
- platform-express version : 6.10.14
- passport version : 6.1.1
- swagger version : 4.1.2
- typeorm version : 6.2.0
- common version : 6.10.14
- core version : 6.10.14
- jwt version : 6.1.1
For Tooling issues:
- OS Version : Linux 5.0
- NodeJS Version : v10.18.0
- NPM Version : 6.13.4
Others:
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to avoid to write `@ApiProperty()` in each dto for NestJs ...
I know there is exist a way to create file nest-cli.json , and if you specify Promise<DTO> in your controller in nest-swagger it...
Read more >CLI Plugin - OpenAPI - A progressive Node.js framework
The Swagger plugin will automatically: annotate all DTO properties with @ApiProperty unless @ApiHideProperty is used; set the required property depending on ...
Read more >Using a dynamic DTO property in a NestJS API
The dynamic meta data issue. The interesting problem here is how do we store and retrieve different classes for different TriggerTypeEnum values ...
Read more >API with NestJS #60. The OpenAPI specification and Swagger
We can use the @ApiProperty() decorator to annotate class properties. register.dto ...
Read more >Integrating Swagger/OpenAPI with NestJS - codeburst
Here, we add the @nestjs/swagger/plugin to the plugins array. That's it. We can also remove the @ApiProperty() decorator from the task DTO, ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed in 4.1.4
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.