Skip to content

Commit

Permalink
implemented swagger ui action
Browse files Browse the repository at this point in the history
  • Loading branch information
Legion2 committed Aug 23, 2020
1 parent b600d1b commit 6466c3e
Show file tree
Hide file tree
Showing 13 changed files with 13,945 additions and 3,384 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,15 @@ jobs:
- uses: actions/checkout@v2
- uses: ./
with:
milliseconds: 1000
output: swagger-ui-output
url: https://petstore.swagger.io/v2/swagger.json
- name: "Verify swagger-ui was created"
run: |
test -f swagger-ui-output/index.html
test -f swagger-ui-output/swagger-config.json
test -f swagger-ui-output/swagger-ui-bundle.js
- name: Upload generated Swagger UI
uses: actions/upload-artifact@v2
with:
name: swagger-ui-output
path: swagger-ui-output
2 changes: 1 addition & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": false,
"semi": true,
"singleQuote": true,
"trailingComma": "none",
"bracketSpacing": false,
Expand Down
24 changes: 18 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
name: 'Your name here'
description: 'Provide a description here'
author: 'Your name or organization here'
name: 'Swagger UI Action'
description: 'Generate Swagger UI for API documentation'
author: 'Leon Kiefer'
inputs:
milliseconds: # change this
output:
description: 'Path of the generated Swagger UI files'
required: true
description: 'input description here'
default: 'default value if applicable'
version:
description: 'Swagger UI version'
required: true
default: '^3.0.0'
specFile:
description: 'A file containing the API definition'
required: false
url:
description: 'A URL pointing to the API definition'
required: false
swagger-config:
description: 'A swagger-config file which is copied and added to configUrl'
required: false
runs:
using: 'node12'
main: 'dist/index.js'
51 changes: 51 additions & 0 deletions dist/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!-- 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="./swagger-ui.css" >
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
<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-bundle.js" charset="UTF-8"> </script>
<script src="./swagger-ui-standalone-preset.js" charset="UTF-8"> </script>
<script>
window.onload = function() {
// Begin Swagger UI call region
const ui = SwaggerUIBundle({
configUrl: "<swaggerConfig>",
dom_id: '#swagger-ui'
})
// End Swagger UI call region

window.ui = ui
}
</script>
</body>
</html>
Loading

0 comments on commit 6466c3e

Please sign in to comment.