I'm having trouble implementing swagger-ui in remote server. Throwing can't read file error.
See original GitHub issueQ&A (please complete the following information)
- OS: Windows
- Browser: Chrome, Safari, IE
- Version: [e.g. 22]
- Method of installation: dist
- Swagger-UI version:3.0.21
- Swagger/OpenAPI version: OpenAPI 3.0
Content & configuration
Swagger/OpenAPI definition:
# your YAML here
Swagger-UI configuration options:
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
urls: [
{
url: "../OASDoc/v1_apidoc.json",
name:"Version 1.0.0"
}
],
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
?yourQueryStringConfig
Screenshots
https://i.stack.imgur.com/5hYMz.png
How can we help?
The swagger-ui is throwing can’t read the file error from the ui. But it is working from local IIS. The details of the issue along with the sample code is also given below in my stackoverflow questions https://stackoverflow.com/questions/51778578/swagger-ui-is-unable-to-load-the-json-specification-file-in-serve
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Can't read from file issue in Swagger UI - Stack Overflow
I am guessing "http://MYIP/swagger/docs/v1" is not publicly accessible. By default swagger ui uses an online validator: online.swagger.io. If it cannot ...
Read more >Troubleshooting issues when using Swagger as a REST API ...
The Swagger UI provides a sample request response that helps to integrate AR System server with the REST service.
Read more >CORS - Swagger Documentation
Swagger UI is hosted on the same server as the application itself (same host and port). The application is located behind a proxy...
Read more >Spring Boot File Upload / Download Rest API Example
Configuring Server and File Storage Properties. First thing First! Let's configure our Spring Boot application to enable Multipart file uploads, ...
Read more >Deploying NGINX as an API Gateway, Part 1
As the leading high‑performance, lightweight reverse proxy and load balancer, NGINX has the advanced HTTP processing capabilities needed for ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@shockey thank you for helping me! Your directions were very helpful. I figured it out now and I have fixed it. The issue was the server was not serving static JSON file by default. I added the mime type mapping to me web.config file and it worked.
<system.webServer> <staticContent> <mimeMap fileExtension=".json" mimeType="application/json"/> </staticContent> </system.webServer>
@rbipin, that would be a problem with your server then - if your server isn’t serving up your Swagger document at the right URL (which, based on the config and URL you shared, is the URL I mentioned above), Swagger UI won’t be able to do anything 😄