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

ReDoc doesn't resolve relative file URL to swagger spec #390

Closed
shreyas-agnihotri opened this issue Dec 12, 2017 · 5 comments
Closed

ReDoc doesn't resolve relative file URL to swagger spec #390

shreyas-agnihotri opened this issue Dec 12, 2017 · 5 comments

Comments

@shreyas-agnihotri
Copy link

shreyas-agnihotri commented Dec 12, 2017

redoc-standalone.js and swagger.yaml are in the same directory. HTML looks like this:

<!DOCTYPE html>
<html>
  <head>
    <title>ReDoc</title>
    <!-- link rel="stylesheet" href="main.css" -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
  </head>
  <body>
    <redoc scroll-y-offset="body > nav" spec-url='swagger.yaml' lazy-rendering untrusted-spec></redoc>
    <script src="redoc.standalone.js"></script>
  </body>
</html>

I get an exception when trying to load the html.
Unable to resolve $ref pointer "file:///Users/max/Desktop/ReDoc/demo/swagger.yaml"

Seems like local file URLs are not resolved correctly.

@bartfeenstra
Copy link

bartfeenstra commented Dec 13, 2017

What happens when you go to file:///Users/max/Desktop/ReDoc/demo/swagger.yaml in your browser directly?

@shreyas-agnihotri
Copy link
Author

What happens when you go to file:///Users/max/Desktop/ReDoc/demo/swagger.yaml in your browser directly?

I see the contents of YAML file in browser.

@drewish
Copy link

drewish commented Dec 14, 2017

Curious what you mean by:

Unable to resolve $ref pointer

Do you mean it won't follow a $ref from inside your swagger.yaml file to another file?

@shreyas-agnihotri
Copy link
Author

Unable to resolve $ref pointer

So my swagger.yaml doesn't have any $ref. That's the error message string being thrown by ReDoc.

I must clarify that I am not running any web server. I just have the swagger.yaml and index.html (with the HTML code above) in the same directory. I am then trying to open index.html in a browser by double-clicking on it.

@RomanHotsiy
Copy link
Member

Hey guys. This is a duplicate of #149

I think I will finally fix in the upcoming alpha release.

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

No branches or pull requests

4 participants