-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Support for ordered array query params #883
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
Comments
No thought on this ? Since the final v3 is coming i'd like to know if I have a chance to get this shipped in the spec. I can do a PR if needed. |
Just to understand, you want to have If you use |
I can distinguish three type of item collections:
Using the The more I think about it, the fact I order the positional free sets for caching reason is an implementation detail, the real matter is to distinguish positional collections from the other. A client UI would probably not use the same component if the position of the items matter to input them. For a positional free collection that can have 3 different items, one could use checkboxes. But if they are positional, one would use something else. In light of it the good property name would probably be |
@nfroidure exploded arrays are done in order because arrays are ordered. Thats part of RFC6570 (which states that the explode operatior "iterates over the list" which is clearly intended to be ordered. I don't think there's anything to be done here. I think there's an issue open with JSON Schema for being able to describe unordered sets, which is where you'd address that. Am I missing something here? |
@handrews by ordered true / false, I meant : the order is important / the order doesn't matter. Basically : [2, 3, 1, 2] is the same than [1, 2, 2, 3]. If true, you can safely use the same cache key for both (by example, by sorting items before creating the cache key), otherwise, you'll have to distinguish them and keep the original order. An array not ordered is different of a Set since a set cannot have duplicate items. That said, maybe that a better word can name that kind of property ? |
@nfroidure what I gather here is that there's nothing to be done regarding RFC6570 parameter expansion and ordering (we can't change that spec and that's what we reference). For things like set vs unordered list can we close this in favor of: which proposes That seems like the same concern but it's more complete and someone can open a PR for that at any time because the registries are much easier to expand than the spec. Plus, this part of the spec (Schema Object) is really the JSON Schema spec - we don't want to add more complexity to the Parameter Object list (but #1502 would allow handling the whole query string with one Schema Object, so you could then apply a |
@handrews ok, let's close this then ;) |
It would be nice to have a way to indicate that an
array
query parameter items should be ordered.That way you ensure that the encoded query string will always be the same if it contains the same elements. This is useful for caching for example. Indeed a proxy cannot figure out if the query parameters elements order matter or not and lead to potential content duplication / cache busting issues.
It would give parameters definitions like that:
How i handle this:
https://github.com/nfroidure/strict-qs/blob/master/src/index.mocha.js#L34-L60
Seems related: #568
The text was updated successfully, but these errors were encountered: