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

Drop uri-reference format for template URLs #3455

Merged
merged 1 commit into from
Feb 1, 2024

Conversation

davishmcclurg
Copy link
Contributor

Server.url and Link.operationRef both allow variable substitution with {brackets}, which means they're not always valid URI references.

For example, the current specification shows
https://{username}.gigantic-server.com:{port}/{basePath} as a Server Object url, but it's not a valid URI reference because the host includes curly brackets.

operationRef similarly includes
https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get as an example that isn't valid using the uri-reference format.

I looked into the other uses of uri-reference and they seemed ok.

I'm not sure how to update the actual JSON schemas but readme says to just update the yaml files, so let me know if there's anything else to do.

Related:

`Server.url` and `Link.operationRef` both allow variable substitution
with {brackets}, which means they're not always valid URI references.

For example, the [current specification][0] shows
`https://{username}.gigantic-server.com:{port}/{basePath}` as a Server
Object `url`, but it's not a valid URI reference because the host
includes curly brackets.

[`operationRef`][1] similarly includes
`https://na2.gigantic-server.com/#/paths/~12.0~1repositories~1{username}/get`
as an example that isn't valid using the `uri-reference` format.

I looked into the other uses of `uri-reference` and they seemed ok.

Related:
- OAI#2586
- OAI#3235
- OAI#3256
- davishmcclurg/json_schemer#158

[0]: https://spec.openapis.org/oas/v3.1.0#server-object-example
[1]: https://spec.openapis.org/oas/v3.1.0#operationref-examples
@handrews
Copy link
Member

Thanks, @davishmcclurg ! This is more or less a duplicate of #3235, which got a bit bogged down in questions over what format to use (and add to the format registry) for these things.

@MikeRalphson it might be good to go ahead and accept this one to at least stop implementations that try to enforce the existing format from breaking on this. Assuming we can actually work out the logistics of publishing a schema update soon.

davishmcclurg added a commit to davishmcclurg/json_schemer that referenced this pull request Nov 23, 2023
Temporary fix until upstream schemas are fixed and published: OAI/OpenAPI-Specification#3455

Closes: #158
@ekzobrain
Copy link

ekzobrain commented Jan 14, 2024

This also enables support for IDNs. Current format "uri-reference" does not allow them. If not considering variables, at least "iri-reference" should be used instead.

@handrews
Copy link
Member

@ekzobrain OAS 3.x does not have direct IRI support (I am hopeful it will be in OAS 4 "Moonwalk"). IRIs are only supported by being encoded down to URIs.

Copy link
Member

@handrews handrews left a comment

Choose a reason for hiding this comment

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

I think it's worth merging this even though there's another PR that overlaps with it. This one is simpler. Although we still need to solve the schema deployment issues discussed in #151.

@karenetheridge
Copy link
Member

Thanks for this! I just ran into this issue when implementing servers url matching in my implementation.

It would be good to see this published so I can make use of it :)

@handrews
Copy link
Member

For those following the schema publishing topic who haven't otherwise seen it, I pulled the still-relevant schema publishing challenges out of #151 (which I have now closed) and filed them as #3715 (see also #3716 for related schema development process concerns).

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

Successfully merging this pull request may close these issues.

6 participants