Nest 5.0.0-rc.2 Swagger example not correct generate parameters
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
Swagger example not correct generate parameters
Expected behavior
parameters should generate correct.
Minimal reproduction of the problem with instructions
use example codes: https://github.com/nestjs/nest/tree/master/sample/11-swagger
What is the motivation / use case for changing the behavior?
Environment
Nest version: 5.0.0-rc.2
```
{
"@nestjs/microservices": "^5.0.0-rc.2",
"@nestjs/common": "^5.0.0-rc.2",
"@nestjs/core": "^5.0.0-rc.2",
"@nestjs/passport": "^1.0.6",
"@nestjs/swagger": "^1.2.2",
"@nestjs/testing": "^5.0.0-rc.2",
"@nestjs/typeorm": "^2.0.0",
"@nestjs/websockets": "^5.0.0-rc.2",
"class-transformer": "^0.1.7",
"class-validator": "^0.7.2",
"reflect-metadata": "^0.1.12",
"rxjs": "^6.0.0",
"rxjs-compat": "^6.0.0",
"typescript": "^2.8.0"
}
```
For Tooling issues:
- Node version: XX
- Platform:
Others:
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:13 (4 by maintainers)
Top Results From Across the Web
Describing Parameters - Swagger
In OpenAPI, a path parameter is defined using in: path . The parameter name must be the same as specified in the path....
Read more >Adding Examples - Swagger
You can add examples to parameters, properties and objects to make OpenAPI specification of your web service clearer. Examples can be read by...
Read more >Parameter Serialization - Swagger
explode (true/false) specifies whether arrays and objects should generate separate parameters for each array item or object property. OpenAPI serialization ...
Read more >Describing Parameters - Swagger
OAS 2 This page applies to OpenAPI Specification ver. ... The location is determined by the parameter's in key, for example, in: query...
Read more >Adding Examples - Swagger
OAS 2 This page applies to OpenAPI Specification ver. 2 (fka Swagger). ... Note: Do not confuse example values with the default values....
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 Free
Top 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
@kamilmysliwiec I also have to specify ApiImplicitParam otherwise the params do not show up in the UI:
Is this expected? In addition, I installed nest (CLI) from scratch today and got these versions:
Isn’t 5.4.0 the latest Nest version?
@kamilmysliwiec @vellengs Not sure why this is happening, but from my investigation, you can fix this by adding a type of
string
to that function argument. for example:This will NOT generate the swagger parameter:
But this WILL
the only difference is in this part:
@Param('username') username: string
where I set the username parameter to be a string.Since most of the examples here didn’t include types for the function arguments, I thought I might share this because this might solve the problem in the meanwhile for people.