-
-
Notifications
You must be signed in to change notification settings - Fork 102
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
Custom QueryString parser support #882
Comments
I'm also having the same issue. Would be nice getting this addressed. |
Your suggestion is a typical anti pattern that violating standard. If you write a query string Also, URL path has length limit in most browsers (about 1,023), and nested query is much dangerous than non-nested. |
Instead, I recommend to use request body of POST/PATCH/PUT/DELETE methods. The request body does not have any length and depth limit. In my case, I prefer |
The main issue is that if somebody is already using its own querystring parser that works in nestjs, it stops working once nestia is installed since you are not using already parsed query value that Express/Fastify framework already handled. We have spend few hours debugging why we are receiving completely different values with TypedQuery which should happen |
In that case, it would better to use Also, in that case, how serialize the query string in the frontend application? I need to update the SDK generator only for |
PHP and similar languages are supporting nested associative arrays natively when parsing querystring therefore quite a lot of people used nested objects - NodeJS ecosystem offloaded support to 3rd party libraries like Origins of our problem started few weeks ago when swagger client library was updated and it started generating querystring using swagger-js v3.26.6 Example of QS stringify
If it helps i might have a look and create a merge request |
Oh my god, looking at the format option, it seems terrible and why could not be standard. Have you to use it? It seems not easy to support from SDK generator. |
We have been using deep nested object serialization for past 20 years, since my backend origins were PHP. Nonetheless swagger does offer deepObject serialization type and it is the only way to make it generic and universal enough so every backend can parse it There is an option native to expressJS for parsing nested objects
|
I will study how native nestjs (platform of both express and fastify), and will determine how. |
Bug Report
Hey Samchon,
we are having issue processing extended querystring using
@TypedQuery
decorator since you are using URLSearchParams for parsing querystringSummary
When sending complex querystring like
foo[0][type]=a&foo[0][value]=foo&foo[1][type]=b&foo[1][value]=bar
nestia is unable to parse it using@TypedQuery
decoratorWrite detailed description in here.
In
src/decorators/TypedQuery.ts
you are parsing request.query usingURLSearchParams
however it does not support extended query strings.I suggest changing a functionality to using already parsed QueryString from request.query if already parsed by middleware querystring parser and then change the validation logic accordingly to accept object instead of URLSearchParams instance
The text was updated successfully, but these errors were encountered: