-
Notifications
You must be signed in to change notification settings - Fork 196
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
$refs with relative paths are not properly resolved with async spec loading #2578
Comments
@anikitin please provide an example of the openAPI document that contains the relative ref, along with the file that it is referencing so that we can reproduce this issue. Could you also provide an example of the html you are using. |
Sure. After experiments it seems that it only affects async loading, not the static way of specifying "apiDescriptionUrl". This is the example of OpenAPI file I want to render: https://raw.githubusercontent.com/anikitin/static-assets/main/oas-refs/test1-openapi.yml This is my HTML:
This is what I see in browser: |
Thank you so much for providing that additional information! Our suspicion is that the way you are getting the document is causing the issue
Once the
or
Potential workarounds:
|
@brendarearden , workarounds are clear but unfortunately not possible for us. I still think this is a bug because:
I understand that it can be related to async implementation with "fetch" method. I wonder how Stoplight demo app handles this with dynamically loaded document: https://elements-demo.stoplight.io/ |
OK, I have figured out that I can just set So this issue can be closed, but I recommend adding an example to https://docs.stoplight.io/docs/elements/a71d7fcfefcd6-elements-in-html that demonstrates how to set |
This ticket has been labeled jira. A tracking ticket in Stoplight's Jira ( |
Context
Our OpenAPI files contain references to common schemas defined in separate YaML files
Current Behavior
If I have "$ref" in OpenAPI document with a relative path, it is not properly resolved.
It is actually resolved based on current HTML page address instead of OpenAPI document (that contains this $ref) address.
Browser console shows HTTP 404.
Expected Behavior
$ref with relative paths should be properly resolved based on rendered OpenAPI document address (ReDoc and Swagger UI do it properly)
Environment
I used the version from CDN https://unpkg.com/@stoplight/elements/web-components.min.js
The text was updated successfully, but these errors were encountered: