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

Can't open my swagger.json #125

Closed
darrenhaken opened this issue Oct 13, 2016 · 6 comments
Closed

Can't open my swagger.json #125

darrenhaken opened this issue Oct 13, 2016 · 6 comments

Comments

@darrenhaken
Copy link

I tried using the following template to open a Swagger doc:

<!DOCTYPE html>
<html>
<head>
    <title>API Docs</title>
    <!-- needed for mobile devices -->
    <meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!--<redoc spec-url='http://petstore.swagger.io/v2/swagger.json'></redoc>-->
<redoc spec-url="https://companydomain.com/swagger.json"></redoc>
<script src="https://rebilly.github.io/ReDoc/releases/v1.2.0/redoc.min.js"></script>
</body>
</html>

If I open the Petstore sample it works but my JSON file eventually times out and fails. There are no error messages to help me debug exactly why it's not working. Any clues?

@darrenhaken
Copy link
Author

darrenhaken commented Oct 13, 2016

I suspect the issue is that I'm trying to add a spec using HTTPS but the fetch command isn't using the protocol. The Swagger JSON I'm trying to query isn't available on HTTP.

The network tab in the debugger tools has the resource URL as HTTP

@IvanGoncharov
Copy link
Contributor

@darrenhaken Can you please copy browser console or make a screenshot?
I suspect that you have a problem with CORS since you file served under companydomain.com.
To confirm this you can use, this service: https://crossorigin.me/

@darrenhaken
Copy link
Author

@IvanGoncharov So I prepended the https://crossorigin.me/ and the resource was retrieved in the network tab so it does appear likely its a CORS issue.

However after doing that I get the following error:

image

@RomanHotsiy
Copy link
Member

RomanHotsiy commented Oct 14, 2016

@darrenhaken seems like you don't have version field in your info object which is required according to the spec.

@darrenhaken
Copy link
Author

@RomanGotsiy that seemed to be the issue and it's resolved now thanks!

One last thing about the ReDoc UI; is there a way of adding auth headers when testing out the service?

@RomanHotsiy
Copy link
Member

@darrenhaken if you need to document authentication headers you should probably use securityDefinitions.
They are still not rendered by ReDoc but this will be implemented soon. Check out issue: #7

I'm closing this issue

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

3 participants