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

Get spec-url locally from different project #2052

Closed
testgagaga opened this issue Jun 13, 2022 · 3 comments
Closed

Get spec-url locally from different project #2052

testgagaga opened this issue Jun 13, 2022 · 3 comments
Labels

Comments

@testgagaga
Copy link

Hi!

Is it possible to point a spec-url to a json file that is present in a different folder/project locally?

I tried doing this:

<redoc spec-url='file:///Deskptop/spec.json'></redoc>
<script src="node_modules/redoc/bundles/redoc.standalone.js"> </script>

but get this error:
image

Please let me know how to fix this issue, thanks!

@AlexVarchuk
Copy link
Collaborator

Hi @testgagaga, thank you for the question.
I think your local server doesn't have access to the file. You can create a symlink to the file or try to use CLI.

npx @redocly/cli@latest preview-docs ~/Desktop/spec.yaml

or with your template

npx redoc-cli serve ~/Desktop/spec.yaml -t cli/template.hbs

@RomanHotsiy
Copy link
Member

Local files do not work due to same-origin policy restrictions: #149

@arLevi
Copy link

arLevi commented Jun 19, 2023

In my case it's behind a proxy ... I can't use a sym-link, and forcing users to download a 3rd party from a CDN w/o a verification has, it's a bit not secure ...

<script src="https://cdn.jsdelivr.net/npm/redoc/bundles/redoc.standalone.js"> </script>

I think, that this row:

<redoc spec-url='/api/v2/swagger.json' suppressWarnings=true></redoc>

Should take the URL it came from vs using a relative path to swagger.json file ...

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

No branches or pull requests

4 participants