parent
450fc9a120
commit
38b4c23d24
1 changed files with 26 additions and 15 deletions
|
@ -71,9 +71,18 @@
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
// Build a system
|
// Fetch the Swagger JSON specs
|
||||||
|
var url = "{{AppUrl}}swagger.{{.APIJSONVersion}}.json"
|
||||||
|
fetch(url)
|
||||||
|
.then(function(response) {
|
||||||
|
response.json()
|
||||||
|
.then(function(spec) {
|
||||||
|
// Make the page's protocol be at the top of the schemes list
|
||||||
|
var protocol = window.location.protocol.slice(0, -1)
|
||||||
|
spec.schemes.sort(function(x,y){ return x == protocol ? -1 : y == protocol ? 1 : 0 })
|
||||||
|
// Build the Swagger UI
|
||||||
const ui = SwaggerUIBundle({
|
const ui = SwaggerUIBundle({
|
||||||
url: "{{AppUrl}}swagger.{{.APIJSONVersion}}.json",
|
spec: spec,
|
||||||
dom_id: '#swagger-ui',
|
dom_id: '#swagger-ui',
|
||||||
deepLinking: true,
|
deepLinking: true,
|
||||||
presets: [
|
presets: [
|
||||||
|
@ -87,6 +96,8 @@ window.onload = function() {
|
||||||
})
|
})
|
||||||
|
|
||||||
window.ui = ui
|
window.ui = ui
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
Loading…
Reference in a new issue