-
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
Correctly escape example operationRef URLs #3731
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ... ahh ... ugly ... but correct. 👍
@@ -2124,7 +2124,7 @@ field in an [Operation Object](#operationObject)), references MAY also be made t | |||
links: | |||
UserRepositories: | |||
# returns array of '#/components/schemas/repository' | |||
operationRef: '#/paths/~12.0~1repositories~1{username}/get' | |||
operationRef: '#/paths/~12.0~1repositories~1%7Busername%7D/get' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
@@ -2135,13 +2135,14 @@ or an absolute `operationRef`: | |||
links: | |||
UserRepositories: | |||
# returns array of '#/components/schemas/repository' | |||
operationRef: https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get | |||
operationRef: https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1%7Busername%7D/get |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
parameters: | ||
username: $response.body#/username | ||
``` | ||
|
||
Note that in the use of `operationRef`, the _escaped forward-slash_ is necessary when | ||
using JSON references. | ||
using JSON Pointers, and it is necessary to URL-encode `{` and `}` as `%7B` and `%7D`, respectively when |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
Alternatively perhaps the operationRef format removal from that PR should be reverted. |
@karenetheridge the schema is not normative and issue #1677 has TSC folks acknowledging that it needs URL-encoding. So I guess we have to burn up Thursday meeting time on this after all? This is what is so frustrating about trying to move forward. We have such an immense backlog of minor things that they are all stepping on each other, and any attempt to resolve them runs into yet another contradiction or change in opinion. |
The normative spec clearly states that
Not a template. So I think this change is correct and the schema change was wrong. If we want it to be an unencoded template we'd need to change the spec language. |
Correctly escape example operationRef URLs (3.1.1 port of #3731)
Correctly escape example operationRef URLs (3.2.0 port of #3731)
It's ugly, but that's URL-encoding for you. If accepted, I will port this to 3.1.1 and 3.2.0.