swagger-ui
swagger-ui copied to clipboard
Fetch error: Failed to fetch file I can run on the swagger website, but cannot run locally with a copy of this repo
Q&A:
- OS: macOS
- Browser: chrome
- Version: Version 109.0.5414.119 (Official Build)
- Method of installation:
git clone - Swagger-UI version: 4.15.5
- Swagger/OpenAPI version: OpenAPI 3.0.1
Content & configuration
- copy working openapi.json from the swagger editor into a file with the same name in my local copy of the
swagger-ui/dist/repo;swagger-ui/dist/openapi.json - edit
swagger-initiailizer.jsto point to local file instead of the petstore URL example;file:///absolute/path/to/local/file open index.htmlfromswagger-ui/dist/folder- errors abound. I've tried running with
http-server --corsas well but get the same results. I've also tried changing from absolute to relative but that doesn't seem to work either. (ie.Failed to fetch file:///...etc.)
How can we help?
How can I serve my openapi.json file locally?
@dinoDayo have you found any solution?
@Ghayour-vialogic I was able to test & tune my openapi.json configuration directly in the swagger editor, which got me to where I needed to be in terms of documentation.
My use-case was statically hosting some API documentation in an s3 bucket via a serverless application. I think the bugs I was seeing were associated with something in that implementation and not with this specific repo. Closing this issue with this comment, lmk if you think I can be helpful.