Contributions
Re: error while deployed locally Failed to fetch. Possible Reasons: CORS Network Failure
Hiarjunrajas1231, Can you describe how did you "deployed Swagger locally"? Did you use npm scripts from swagger-ui repository (`npm run start`) or are you running your own server where built swagger-ui is being served? From the information that I currently have I don't think CORS is causing requests failure. I can clearly see that you're doing request from the same IP as the swagger-ui is being served. Could you also open developer console in your browser and inspect how the actual request was made and what was the actual response?4.3KViews0likes0CommentsRe: Creating SwaggerUI with pre existing swagger.json document
Allow your swagger.json file to be servable as static asset via your HAPI.js server. Let's say your server runs on https://pre-existing-swagger.com/and your swagger.json file is accesible onhttps://pre-existing-swagger.com/static/swagger.json.Then create a following HTML file called api.html and again make it servable as static asset via your HAPI.js server. Now when you access https://pre-existing-swagger.com/static/api.html,SwaggerUI will render the swagger.json file. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>My Api</title> <link rel="stylesheet" href="//unpkg.com/swagger-ui-dist@3.26.0/swagger-ui.css" /> <script src="//unpkg.com/swagger-ui-dist@3.26.0/swagger-ui-bundle.js"></script> </head> <body> <div id="root" class="swagger-ui" /> <script> const ui = SwaggerUIBundle({ url: 'https://pre-existing-swagger.com/static/swagger.json', dom_id: '#root' }); </script> </body> </html>4KViews1like1CommentRe: How we can display single API inside Swagger UI or Swagger Widget? Swagger Widget for Web available?
If I understand correctly, you goal is to customize SwaggerUIso that it looks like on attached screenshot? If yes, then the SwaggerUI has a plugginable API that allows you to modify how it renders your API.1.3KViews2likes1Comment