-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Serialization of spaceDelimited
query parameter with a list of strings.
#3550
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
@iglosiggio - let me stake a stab at this. I too agree this is not clear, so, I end up not using this part of the spec to describe the API. I have tried APIs like so: api/phrases?phrase=hello world&phrase=Nice to meet you you'll end up wtih: and then have the API code roll up all the values internally into an array. Here is another example: /authors?name[]=miguel&name[]=quintero Again, this does not address your concern exactly, but perhaps it "gets you going". I'll raise this during this week's community call. |
@handrews - perhaps this one is a candidate (once we decide on the correct wording, etc) that could be migrated to MoonWalk. Thoughts? |
I understand that. We are building some internal tools that expect to use API specs in order to make HTTP requests.
Is that the correct encoding for
Thanks! |
@miqui this is just a clarification of what the existing spec means. It can go in a patch release (3.0.4/3.1.1) or even on the Learn site. |
We discussed this at the TDC meeting. Additional guidance is needed to let the developer know that they are responsible for pre-encoding parameter values so that characters do not conflict with the chosen delimiter. |
The specification says that
spaceDelimited
should be used for array or object values. How should an space be escaped when serializing into this format?Example
Given the array
["Hello World", "Nice to see you"]
serialization of this value using thespaceDelimited
style is not properly defined.Options
Hello%20World%20Nice%20to%20see%20you
: Looses informationHello%20World Nice%20to%20see%20you
: Doesn't follow from the examples on the specHello World%20Nice to see you
: Is not valid as a query parameter. If we URLEncode again then the separator ends up URLEncoded twice.Hello%2520World%20Nice%2520to%2520see%2520you
: Encodes the array items twice. I think this is the most reasonable option but it is a bit weird.Hello%20World%2520Nice%20to%20see%20you
: Ecodes the separator twice.The text was updated successfully, but these errors were encountered: