Not able to parse @QueryParams()
See original GitHub issueclass SortOrder {
[index: string]: 'ASC' | 'DESC'
}
class Query {
@IsNumber()
readonly offset: number = 0;
@IsNumber()
readonly limit: number = 10;
@ValidateNested()
readonly order: SortOrder;
}
class Controller {
getAll(@QueryParams() query: Query) {
}
}
This example creates one field called query and displays it as json field.
Expected behavior is to have 3 query parameters: offset, limit and order. Order parameter should be of deepObject style.
Example query string:
?limit=10&offset=0&order[firstName]=DESC&order[lastName]=ASC
More info https://swagger.io/docs/specification/serialization/
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Not able to parse query parameters with # url - Stack Overflow
getQuery() gives null. Any method to parse it with explicitly removing # from url. java · url · urlencode.
Read more >urllib.parse — Parse URLs into components — Python 3.11.1 ...
Source code: Lib/urllib/parse.py This module defines a standard interface to break Uniform Resource Locator (URL) strings up in components (addressing ...
Read more >parse_url - Manual - PHP
This function parses a URL and returns an associative array containing any of the various components of the URL that are present.
Read more >Query parameters - Dreamdata | Docs
You can use URL query parameters in your links to pass User ID, ... be because of privacy reasons are not having the...
Read more >How to migrate from querystring to URLSearchParams in ...
Is used by querystring.parse(). ... “Unlike querystring module, duplicate keys in the form of array values are not allowed.
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
I regenerate the parameters after the spec is generated. In short go through the whole spec and if I find a “query” parameter that has “$ref” set I lookup the schema and replace the parameter.
This should actually be the default behavior.
QueryParams
should be expanded because it represents the whole query object (or at least part of it) not just one query parameter. I’ll take a look and maybe create a PR.