-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Swagger Editor does not resolve local files referenced with $ref #1630
Comments
@vnalla, hopefully you can clarify one thing for me: are you accessing your Swagger-Editor through a |
I tried both, with the same error: parameters:
- $ref: >-
http://localhost:7070/files/header_parameters.yaml#/xcsimessageid
- $ref: >-
http://localhost:7070/files/header_parameters.yaml#/xcsitimetolive
- $ref: >-
http://localhost:7070/files/header_parameters.yaml#/ctnid Could not resolve reference because of: NetworkError when attempting to fetch resource. |
if the swagger editor is deployed in the same server, serving the files than it is able to resolve references, otherwise it is not even sending the requests from browser and results in the following errors: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:7070/files/e911address.yaml. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing). (unknown) |
@vnalla, ah, I see. This is not Swagger-Editor's fault: in order to allow your browser to make requests to a different origin, you need to set some specific browser security-related headers. https://enable-cors.org is a good place to start for this. For more context, check out Same-origin policy. |
Closing due to inactivity. This is simply to keep our issue tracker clean - feel free to comment if there are any further thoughts or concerns, and we'll be happy to reopen this issue. |
Configuration (browser query string, constructor, config.yaml)
No special configuration
Expected Behavior
If the spec is broken in to multiple files, there should be a way to resolve the files with relative path. All the files are in the same directory.
Current Behavior
ERROR: Could not resolve reference because of: Tried to resolve a relative URL ...
the second one with file:/// prefix results in the error: Could not resolve reference because of: NetworkError when attempting to fetch resource.
Replaced them with http url's but still the same network error as file uri. The files are served from Tomcat 7 and CORS filter enabled at the server level in <CATALINA_BASE>/conf/web.xml file
Possible Solution
relative path should work
Context
Trying to break specification in to multiple files.
The text was updated successfully, but these errors were encountered: