@ApiProperty 's operation is not correct on OpenApi, Swagger queries are not sending
See original GitHub issueIs there an existing issue for this?
- I have searched the existing issues
Minimum reproduction code
https://github.com/p29hieu-sub-projects/nestjs-swagger
Steps to reproduce
Proplem: When i use ApiProperty
decorator from nestjs/swagger, i can’t use them on OpenApi.
I created a dto file like:
export class GetProductsDto implements IGetProductsDto {
@ApiProperty({
example: 37.7752315,
})
@IsNotEmpty()
latitude: number;
@ApiProperty({
example: -122.418075,
})
@IsNotEmpty()
longitude: number;
}
then, i used it:
@ApiQuery({
type: GetProductsDto,
})
@Get("products")
async getProducts(@Query() query: GetProductsDto): Promise<any> {
return {
data: [],
};
}
In my browser:
When i press Try it out
and Excecute
buttons:
Input fields have been filled but the error still occurs.
When i use required: false
in ApiProperty
export class GetProductsDto implements IGetProductsDto {
@ApiProperty({
example: 37.7752315,
required: false
})
@IsNotEmpty()
latitude: number;
@ApiProperty({
example: -122.418075,
required: false
})
@IsNotEmpty()
longitude: number;
}
Then I press Try it out
and Excecute
buttons again,
In Curl
, the params is not true:
Please give me some help. Thanks!
@nestjs/cli: "^8.0.0",
OS: ubuntu 20.04
Browser: Microsoft Edge Version 94.0.992.38
Package version
^5.0.9
NestJS version
^8.0.0
Node.js version
14.17.2
In which operating systems have you tested?
- macOS
- Windows
- Linux
Other
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (2 by maintainers)
Top Results From Across the Web
OpenAPI Specification - Version 3.0.3 - Swagger
If the servers property is not provided, or is an empty array, the default value would be a Server Object with a url...
Read more >API with NestJS #60. The OpenAPI specification and Swagger
The OpenAPI is a specification used to describe our API and gives us a way to provide the details of our endpoints. It...
Read more >Fix Swagger Validator errors in Power Platform connectors
The operation is not valid, it must contain at least one response definition. Your swagger has an operation that doesn't have at least...
Read more >OpenAPI (Swagger) | NestJS - A progressive Node.js framework
Nest is a framework for building efficient, scalable Node.js server-side applications. It uses progressive JavaScript, is built with TypeScript and combines ...
Read more >Nest + Swagger not recognizing endpoints or parameters
My understanding is that methods will only fail to get unique operationId 's when they are not sufficiently unique: 2 methods with identical ......
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
Please, report this issue in the corresponding repository https://github.com/swagger-api/swagger-ui
Workarround, put this in your
main.ts
it will make the parameters distinct:_Originally posted by @mathis-m in https://github.com/swagger-api/swagger-ui/issues/7539#issuecomment-938268189_