Subject: | Improving Swagger ui homepage |
Date: | Tue, 5 Nov 2019 11:50:51 +0530 |
To: | bug-Mojolicious-Plugin-SwaggerUI [...] rt.cpan.org |
From: | Gaurav Rai <gauravrai7860 [...] gmail.com> |
In the current swagger ui homepage 'topbar' is missing. Also certains css
changes are needed to make it make like swagger standard ui.
Request you to change the 'swagger_ui.html.ep' template to something like-
<html>
<head>
<link rel="stylesheet" type="text/css"
href="/swagger-ui/swagger-ui.css">
<style>
html
{
box-sizing: border-box;
overflow: -moz-scrollbars-vertical;
overflow-y: scroll;
}
*,
*:before,
*:after
{
box-sizing: inherit;
}
body
{
margin:0;
background: #fafafa;
}
</style>
</head>
<body>
<div id="swagger-ui"></div>
<script src="/swagger-ui/swagger-ui-bundle.js"></script>
<script src="/swagger-ui/swagger-ui-standalone-preset.js"></script>
<script>
window.onload = function () {
const ui = SwaggerUIBundle({
url: "<%= $url %>",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</html>
I have tested this and its working fine.
Thanks