Skip to content

Instantly share code, notes, and snippets.

@buzztaiki
Last active November 29, 2019 04:59
Show Gist options
  • Save buzztaiki/e243ccc3203f96777e2e8141d4993664 to your computer and use it in GitHub Desktop.
Save buzztaiki/e243ccc3203f96777e2e8141d4993664 to your computer and use it in GitHub Desktop.
Swagger UI
<!-- HTML for static distribution bundle build -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Swagger UI</title>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/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="https://unpkg.com/swagger-ui-dist@3/swagger-ui-bundle.js"> </script>
<script src="https://unpkg.com/swagger-ui-dist@3/swagger-ui-standalone-preset.js"> </script>
<script>
window.onload = function() {
// Build a system
const ui = SwaggerUIBundle({
url: "swagger.yml",
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout"
})
window.ui = ui
}
</script>
</body>
</html>
@buzztaiki
Copy link
Author

buzztaiki commented Aug 18, 2018

https://github.com/swagger-api/swagger-ui/blob/master/dist/index.html を cdn を使うように変えて、spec への参照も変えたもの。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment