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
Sparse field sets examples not RFC 3986 compliant #647
Comments
ref #544 |
@tkellen If our spec were the only thing in the world, I'd be in favor of using |
Precisely my thinking as well @ethanresnick. Would you mind working up a PR? |
@tkellen Sure! |
This is simply making explicit a requirement from the URI spec that was already implicitly in effect, so it’s not a BC break. Addresses json-api#647
Resolved! |
The current examples for sparse field sets use non-RFC 3986 compliant URLs: [ and ] are reserved characters and must be percent encoded.
The RFC 3986 compliant version of the example is: GET /articles?include=author&fields%5Barticles%5D=title,body&fields%5Bpeople%5D=name
Should [ and ] be used to denote the type if the client needs to encode these? At least the example needs to be updated because it isn't RFC 3986 compliant.
See: https://www.ietf.org/rfc/rfc3986.txt
3.4 Query:
query = *( pchar / "/" / "?" )
And
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
reserved = gen-delims / sub-delims
gen-delims = ":" / "/" / "?" / "#" / "[" / "]" / "@"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
So [ and ] must be percent encoded.
Proposal: perhaps the dot could work instead, the example becomes than:
GET /articles?include=author&fields.articles=title,body&fields.people=name
The text was updated successfully, but these errors were encountered: