We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I want to create a GET endpoint with a inner object inside query params:
export class QueryParamsSubObject { @ApiProperty() subObjectStringParam: string; } export class QueryParams { @ApiProperty() stringParam: string; @ApiProperty({ type: QueryParamsSubObject }) subObject: QueryParamsSubObject; } @Controller() export class AppController { constructor(private readonly appService: AppService) {} @Get('/bugged') getHelloBugged(@Query() queryParams: QueryParams): string { console.log(queryParams); return this.appService.getHello(); } }
The swagger definition is bugged, having all parameters from QueryParamsSubObject inside QueryParams instead of QueryParams.subObject:
QueryParamsSubObject
QueryParams
QueryParams.subObject
The definition is generated correctly when using @ApiQuery instead of @Query:
@ApiQuery
@Query
@Get('/correct') @ApiQuery({ type: QueryParams, }) getCorrectlyGenerated(): string { return this.appService.getHello(); }
Codesandbox https://github.com/wilker7ribeiro/nest-swagger-query-object-param-issue
npm install
npm start
http://localhost:3000/api
@Query should correctly generate the swagger definition as @ApiQuery does.
7.3.1
10.3.2
The text was updated successfully, but these errors were encountered:
Would you like to create a PR for this issue?
Sorry, something went wrong.
No branches or pull requests
Is there an existing issue for this?
Current behavior
I want to create a GET endpoint with a inner object inside query params:
The swagger definition is bugged, having all parameters from
QueryParamsSubObject
insideQueryParams
instead ofQueryParams.subObject
:The definition is generated correctly when using
@ApiQuery
instead of@Query
:Minimum reproduction code
Codesandbox
https://github.com/wilker7ribeiro/nest-swagger-query-object-param-issue
Steps to reproduce
npm install
npm start
http://localhost:3000/api
Expected behavior
@Query
should correctly generate the swagger definition as@ApiQuery
does.Package version
7.3.1
NestJS version
10.3.2
Node.js version
10.3.2
In which operating systems have you tested?
The text was updated successfully, but these errors were encountered: