Search code examples
swaggerswagger-uiswagger-2.0

Swagger UI - Try it Out Button Not Showing


I am using Swagger 2.0 and the Try It Out button is not showing for my methods. My HTML is same as Petstore Swagger.

I am not getting any console errors. My Swagger.json is here: https://raw.githubusercontent.com/novastorm123/abapswaggerNW7.0/master/swagger_70.json

<body>
<div id="swagger-ui"></div>
<script type="text/javascript">
window.onload = function() {
const ui = SwaggerUIBundle({
 url: https://raw.githubusercontent.com/novastorm123/abapswaggerNW7.0/master/swagger_70.json",
dom_id: "#swagger-ui",
supportedSubmitMethods: ['get'],
presets: [
SwaggerUIBundle.presets.apis,
Array.isArray(SwaggerUIStandalonePreset) ? SwaggerUIStandalonePreset :       SwaggerUIStandalonePreset.default
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>

Solution

  • The host setting might be missing in your Swagger configuration file, as @alexvetter also pointed out in the comments. Logically, no host, no need of "Try it out" button as it has no domain to make a request to.