Skip to content
New issue

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

QueryParams are parsed as object, not mutiple params #39

Closed
atomicus opened this issue Feb 6, 2020 · 3 comments
Closed

QueryParams are parsed as object, not mutiple params #39

atomicus opened this issue Feb 6, 2020 · 3 comments

Comments

@atomicus
Copy link

atomicus commented Feb 6, 2020

This looks similiar to #38, but I'm not doing any kind of merging here.

Having simple:

class PageableQuery {
    @IsNumber()
    @Max(50)
    @IsPositive()
    per_page: number = 50;

    @IsNumber()
    @IsPositive()
    page: number = 1;

    username: string;
}

#....
    @Get('/')
    public async getAll(@QueryParams() query: PageableQuery) {
}

Generates swagger with one query param of object type, instead of mutiple query params like this:
Zrzut ekranu 2020-02-6 o 21 51 01

I'm doing something wrong?

@epiphone
Copy link
Owner

epiphone commented Feb 6, 2020

No, that's by design. I'd be happy to review a PR to change the behaviour though: we'd have to iterate through the queriesMeta properties here and do a separate queries.push({ in: 'query', ... }) for each property, or something similar.

@atomicus
Copy link
Author

atomicus commented Feb 7, 2020

Sure, i'll give a try

@epiphone
Copy link
Owner

Released in v2.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants