-
Notifications
You must be signed in to change notification settings - Fork 65
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
OpenApi 3.1 schema validator does not handle variables in server urls #158
Comments
Interesting—OpenAPI validation uses their schema, which specficies But I don't think using variables (in brackets) makes for a valid
I'll dig into this more later, but here's what I've found so far:
|
`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
I opened a pull request to change the format in the upstream schemas. |
Temporary fix until upstream schemas are fixed and published: OAI/OpenAPI-Specification#3455 Closes: #158
Temporary fix: #161 |
This also fixed a problem with IDNs. "uri-reference" doesn't not allow those, so at least "iri-reference" should have been used instead. |
`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/OpenAPI-Specification#2586 - OAI/OpenAPI-Specification#3235 - OAI/OpenAPI-Specification#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 (cherry picked from commit 5f765f29e3c12dcab370f5155fe21c6895a8ac5e)
Attached file gives an error: value at
/servers/0/url
does not match format: uri-referenceWhile according to OpenApi docs it's a valid url with variable: https://spec.openapis.org/oas/v3.1.0#fixed-fields-3
OpenApi 3.0 validator does not seem to have this problem.
oas-amocrm.json
The text was updated successfully, but these errors were encountered: