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

Correctly escape example operationRef URLs #3731

Merged
merged 1 commit into from
Apr 25, 2024

Conversation

handrews
Copy link
Member

It's ugly, but that's URL-encoding for you. If accepted, I will port this to 3.1.1 and 3.2.0.

@handrews handrews added bug examples requests for more or better examples in the specification labels Apr 20, 2024
@handrews handrews added this to the v3.0.4 milestone Apr 20, 2024
@handrews handrews requested a review from a team April 20, 2024 23:22
Copy link
Contributor

@mikekistler mikekistler left a 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'
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

Choose a reason for hiding this comment

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

+1

@karenetheridge
Copy link
Member

karenetheridge commented Apr 24, 2024

I'm not sure that this is needed now that we have the change from #3455 ?

Alternatively perhaps the operationRef format removal from that PR should be reverted.

@handrews
Copy link
Member Author

@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.

@handrews
Copy link
Member Author

The normative spec clearly states that operationRef is:

A relative or absolute URI reference to an OAS operation.

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.

@miqui miqui merged commit 761f50f into OAI:v3.0.4-dev Apr 25, 2024
1 check passed
@handrews handrews deleted the curly-braces branch April 25, 2024 19:26
lornajane added a commit that referenced this pull request May 1, 2024
Correctly escape example operationRef URLs (3.1.1 port of #3731)
lornajane added a commit that referenced this pull request May 1, 2024
Correctly escape example operationRef URLs (3.2.0 port of #3731)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug examples requests for more or better examples in the specification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants