-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
deepObject parameter style produces invalid URIs #1942
Comments
This article might be relevant. The TL;DR:
I'm not an authority on this subject (and maybe this article isn't either), but my interpretation of the article is that the square brackets (from |
so... does that mean that to use style=deepObject (and pipeDelimited too) we have to use allowReserved=true? Because all the examples in the spec (the table at https://spec.openapis.org/oas/v3.1.0#style-examples) apparently are showing the query (or path) portion of the URI, fully serialized and escaped. and these styles have reserved characters in them. I think that's important enough that it should be mentioned explicitly in the spec. Alternatively, the examples need to be modified to properly escape these characters, just as spaceEncoded uses %20 instead of space for its delimiter. |
TL;DR: if you want your URL to be parsed correctly by a strictly RFC3986-compliant parser, percent-encode OK, I delved into this more and have come up with what I hope is the correct interpretation of the following passage, the last two paragraphs of RFC 3986 §2.2 "Reserved Characters":
This pulls in more context than the blog post cited above, which I think makes things more clear:
This is why On the other hand, the OpenAPI Specification and various web framworks cannot do the same with So what that last paragraph is saying is is along the lines of: If you don't have reason to think that a query string is in That said, it seems like many systems stuff unencoded So the upshot is: it might work, and if you're absolutely certain you know all of the parsers involved will handle it, then you can get away with unencoded The final wrinkle is that people using But we should clarify it in the patch releases anyway, so I'll throw it on the (increasingly enormous) pile. |
PR merged for 3.0.4 and ported to 3.1.1 via PR #3921! |
According to the RFC,
So requiring OpenAPI clients to serialize parameters using square brackets means asking them to violate RFC 3986.
The same is true for the
allowReserved
field. The only reserved characters that need to be encoded for query strings at all are#
,[
, and]
. Allowing these to pass through unencoded produces an invalid query string.The text was updated successfully, but these errors were encountered: