Skip to content
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

REST: Unescape slashes in JSON examples #2567

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

adriendupuis
Copy link
Contributor

@adriendupuis adriendupuis commented Dec 3, 2024

Question Answer
JIRA Ticket
Versions
Edition

JSON examples were mixing escaped and not escaped slashes. This PR unify them as not escaped.

ECMA-404 "The JSON data interchange syntax" 2nd edition, December 2017 states:

All code points may be placed within the quotation marks except for the code points that must be escaped: quotation mark (U+0022), reverse solidus (U+005C), and the control characters U+0000 to U+001F.
[…]
\/ represents the solidus character (U+002F).

So escaping the slash (a.k.a solidus) is optional; it doesn't matter.

% echo '{ "slash": "\/" }' | jq                                                                                     
{
  "slash": "/"
}

jq understands it but considers it's not worth keeping it.

Checklist

  • Text renders correctly
  • Text has been checked with vale
  • Description metadata is up to date
  • Redirects cover removed/moved pages
  • Code samples are working
  • PHP code samples have been fixed with PHP CS fixer
  • Added link to this PR in relevant JIRA ticket or code PR

@@ -86,7 +86,7 @@
"_media-type": "application/vnd.ibexa.api.RefList+json"
},
"refreshSession": {
"_media-type": "application\/vnd.ibexa.api.UserSession+json",
"_media-type": "application/vnd.ibexa.api.UserSession+json",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is a response.
And this response escapes all slashes.
It should be the opposite.
\/must be kept as they are in reality in responses. Just avoided in requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant