Skip to content

Commit 377b7b3

Browse files
committed
Publishing OpenAPI specs on Github Pages
Signed-off-by: Vacha Shah <vachshah@amazon.com>
1 parent 8be5d4e commit 377b7b3

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

index.html

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<html>
2+
<head>
3+
<!-- Load the latest Swagger UI code and style from npm using unpkg.com -->
4+
<script src="https://unpkg.com/swagger-ui-dist@4/swagger-ui-bundle.js"></script>
5+
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/>
6+
<title>My New API</title>
7+
</head>
8+
<body>
9+
<div id="swagger-ui"></div> <!-- Div to hold the UI component -->
10+
<script>
11+
window.onload = function () {
12+
// Begin Swagger UI call region
13+
const ui = SwaggerUIBundle({
14+
url: "swagger.json", //Location of Open API spec in the repo
15+
dom_id: '#swagger-ui',
16+
deepLinking: true,
17+
presets: [
18+
SwaggerUIBundle.presets.apis,
19+
SwaggerUIBundle.SwaggerUIStandalonePreset
20+
],
21+
plugins: [
22+
SwaggerUIBundle.plugins.DownloadUrl
23+
],
24+
})
25+
window.ui = ui
26+
}
27+
</script>
28+
</body>
29+
</html>

0 commit comments

Comments
 (0)