question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't fetch local file

See original GitHub issue

My apologies if this is spelled out somewhere – I looked through the issues.

I can’t seem to direct ReDoc to load my OpenAPI spec from the local filesystem – only via http. I have tried the following:

<redoc spec-url='swagger.json'></redoc>
<redoc spec-url='file:///Full/Path/swagger.json'></redoc>

in addition to other permutations. However, they all result in this error:

Unable to resolve $ref pointer "file:///<pathname to my spec file>"

Is there any way to have ReDoc load the spec locally?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:8
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

18reactions
nthxcommented, Apr 12, 2017

workaround to have a web server will not work if one needs to send a static html/js documentation to a person that only has a browser …

15reactions
RomanHotsiycommented, Dec 27, 2016

@vishesh1king just serve your spec and html page via any http-server (e.g. python -m SimpleHTTPServer) so url to it will be: http://127.0.0.1:<someport>/swagger.json not file:///<path>/swagger.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fetch request to local file not working - Stack Overflow
Try to place your json file in the public folder like so : public/movies.json. and then fetch using fetch('./movies.json').
Read more >
How to access/fetch the local JSON file to React. - Vahid Akhtar
In this guide, you'll learn how to save and read the local JSON file in the react project. Three ways of accessing the...
Read more >
Fetch request from a local file. - YouTube
Sometimes you need to use the Fetch API to get data from a local file. This video will go cover a quick overview...
Read more >
Reading a File through Related Path Using Fetch API
Fetch is an API to request data through networks using Http request, and we could also use this to request local files!
Read more >
How to Read a JSON File in JavaScript - freeCodeCamp
One standard method we can use to read a JSON file (either a local file or one uploaded to a server) is with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found