-
Notifications
You must be signed in to change notification settings - Fork 103
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
Demo pages don't work for private content #79
Comments
well, checkout the QuickStart section, you need to create an HTML with the following content <!doctype html>
<html>
<head>
<script src="https://unpkg.com/rapipdf/dist/rapipdf-min.js"></script>
</head>
<body>
<rapi-pdf
spec-url = "path/of/your/spec/file"
button-bg = "#b44646"
> </rapi-pdf>
</body>
</html> place this html, on a server from where you can access your spec. |
I used the quickstart section as a guide. if I have <!doctype html>
<html>
<head>
<script src="https://unpkg.com/rapipdf/dist/rapipdf-min.js"></script>
</head>
<body>
<rapi-pdf
spec-url = "file:///home/me/docs/openapi.yml"
button-bg = "#b44646"
> </rapi-pdf>
</body>
</html> It doesn't work. Nor does The page is displayed with a button. Clicking the button does nothing. Error in console is
Changing the spec-url to https://docs.ops.zinc.systems/authentication.yml (only I can see this url) gives
So, your fetch mechanism doesn't recognise a local file. That will make the app difficult to use in a build chain. CORS is more problematic and is possibly due to the browser, rather than your code. Do you have a way of running this locally in a script? I don't see any tests so cannot determine how to run it locally. |
can you try a relative url something like this <!doctype html>
<html>
<head>
<script src="https://unpkg.com/rapipdf/dist/rapipdf-min.js"></script>
</head>
<body>
<rapi-pdf spec-url = "./openapi.yml"> </rapi-pdf>
</body>
</html> |
Same issue using relative path:
So for a file path, it is still trying to do a CORS request |
I disabled CORS in the browser as per https://alfilatov.com/posts/run-chrome-without-cors/ and still get the CORS error above. This perhaps suggest that CORS is being handled in the code rather than the browser. |
I found a (not automated) way to generate docs, if your spec does not contain any sensitive data you can upload your file as a JSON bin on a site such as: https://www.npoint.io/ With your content uploaded and available through a public URL with properly-set CORS restrictions in response headers, the lib should work as expected. Hope it helps someone! |
Just tried your home page demo with a file:/// uri and with a https:// url that only I can see from my location.
neither works.
Does that mean that hidden behind the scenes your javascript is calling a server that want's to connect to those resources?
Not finding anything here to help me use this locally (or within a build chain, my main priority).
Any suggestions gratefully received.
Thanks
The text was updated successfully, but these errors were encountered: