-
Notifications
You must be signed in to change notification settings - Fork 65
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
figure out better specifications for this library #113
Comments
Well, due to the stagnation of this library I ended up writing my own (see riddler) but I have some thoughts to share. It would be great if we could come to a consensus on some of these questions you have, since I shared the same struggles.
I made the nesting depth configurable, but defaulted to 5. I find it highly unlikely anyone will ever have to go deeper than that, but options are nice and it was trivial to add. As for #30, the issue there isn't only the nesting but the formatting. As this module does, riddler bases object notation on square brackets
I don't throw errors in these situations. I create a sparse array with the values in the requested indices, then compact it to only the values that exist while preserving order. This seemed like the fair compromise to me.
This is the same question as what I was mentioning above. Should it support only dots? Only square brackets? Both? I don't think supporting both would be too terribly difficult, but it's hard to say without getting started and finding out.
I prefer not to throw with invalid strings, but return what you are able to parse and remove the rest. I think the current behavior in #73 is correct. As for #75 I think a return value of That's just me though, I'd love to hear more thoughts about throwing errors instead.
Again, this is another one I debated in my head. Casting values isn't overly difficult, and could be a positive gain, but I'm not sure how worthwhile it is. I may attempt it and see how much additional complexity it adds.
My hunch here is actually to change things and take the last item instead of returning an array, as that seems to be the consensus amongst other frameworks. Regarding #11, I think bailing on nesting and returning |
I see no problem with a fork and I guess it is a good thing what you did. This all sounds pretty good to me when I flash over the post. Why dont you and TJ get on a skype call phone and talk directly about this. Not that I dont like the ideas of forks, but your work could re-animate this project |
I'm having second thoughts about my stance regarding #38 and I think I'm going to keep the current behavior of merging into an array, unless someone can present a very strong reason not to.. |
So while attempting to fix both #11 and #75, I stumbled across this behavior:
For my code base, I did this by just assuming if no prefix exists that I should continue parsing regardless.
This also means that I'm considering changing this so that if only an array exists at the root, as is the case with |
i think this is a security issue, i'm not 100% sure though.
might confuse some people. maybe returning a separate object of "WTF"s is better. |
i don't think TJ cares about this module anymore. none of the "previous" maintainers of express care much either (including myself). this library is really more trouble than its worth. might be easier just to JSON in the query string fields. hahaha i also don't think a fork is necessary. @nlf if you'd like to maintain this project and merge in your riddler ideas, i'm sure TJ wouldn't mind adding you as collab |
eek yeah so many edge-cases haha, I've tried my best to avoid super weird requests that require anything that a browser form submission doesn't create. fork and/or contrib doesn't matter to me! the parse array thing works fine until someone iterates over it via console.log / json.stringify or similar |
It was a security issue, but I actually tweaked things so that the specific index depth is limited. If you attempt to assign to an array index over the limit, you get an object with that number as the key instead. As far as forking, I've already completely reimplemented the entire library in riddler. I didn't base it off of this module though, so merging it back in isn't really an option. It would be more like replacing everything. My thought is to either deprecate this library entirely and refer people to riddler, or publish a copy of riddler in its place. Thoughts? |
haven't really looked at riddler to know what the differences are but either sounds fine to me assuming riddler supports the same things, not the worst thing to have two either I'm sure there are many more in npm |
Yeah, riddler supports all the same things. My personal feeling, especially if this is going to stay unmaintained, is that the best course of action is to deprecate this library and refer people to riddler. |
i don't mind replacing this, or just have riddler be qs v1+ :) |
SGTM |
dev has moved to https://github.com/hapijs/qs :D |
visionmedia historically does not move repos. Check out |
Just because that's what's been done doesn't mean it's a good decision. Especially lacking insight as to why, I find this really confusing. |
IDK what you want us to say :) Ask @visionmedia :) |
it's a rewrite, doesn't really matter, move would be fine. As for should.js it doesn't make any sense to me, it's a single project, why move it to an org? |
You move because then all existing installs that point to the old repo automatically get a 302 to the new location. Issues, commits, etc all persist. |
And no weird "now deprecated" messages as well. |
there are two issues blocking me from maintaining this library.
i'd like to have a consensus on how we should treat nested query strings before making any changes. in particular:
a[1]=
will throw.a[1]=&a[0]
will throw. buta[0]=&a[1]
will not throw. another option is just to convert those into objects and never arraysa.0=&a.1=
.=true
totrue
Add type coercion for parsing querystrings. #34basically, i want to be stricter and have options on the types of values returned. i also explicitly do not want to support params like #11.
The text was updated successfully, but these errors were encountered: