Skip to content

Commit

Permalink
Publishing OpenAPI specs to Github Pages (#75)
Browse files Browse the repository at this point in the history
* Publishing OpenAPI specs on Github Pages

Signed-off-by: Vacha Shah <vachshah@amazon.com>
  • Loading branch information
VachaShah authored Apr 7, 2023
1 parent 8be5d4e commit a401d1e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/update_specs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
update:
if: github.repository == 'opensearch-project/opensearch-api-specification'
runs-on: ubuntu-latest
steps:
- name: GitHub App token
Expand Down
29 changes: 29 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<html>
<head>
<!-- Load the latest Swagger UI code and style from npm using unpkg.com -->
<script src="https://unpkg.com/swagger-ui-dist@4/swagger-ui-bundle.js"></script>
<link rel="stylesheet" type="text/css" href="https://unpkg.com/swagger-ui-dist@3/swagger-ui.css"/>
<title>My New API</title>
</head>
<body>
<div id="swagger-ui"></div> <!-- Div to hold the UI component -->
<script>
window.onload = function () {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
url: "swagger.json", //Location of Open API spec in the repo
dom_id: '#swagger-ui',
deepLinking: true,
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIBundle.SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
})
window.ui = ui
}
</script>
</body>
</html>

0 comments on commit a401d1e

Please sign in to comment.