Created
June 16, 2015 15:41
-
-
Save jerzyn/bb68d6e2fd1a6714e138 to your computer and use it in GitHub Desktop.
Loading two Swagger 2.0 Specs on one page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{% active_docs version: "2.0" services: "oauth" %} | |
<div class="swagger-section"> | |
<div id="another-swagger-ui-container" class="swagger-ui-wrap"></div> | |
</div> | |
<script type="text/javascript"> | |
$(function () { | |
window.swaggerUi.load(); // <-- loads first swagger-ui | |
// do second swagger-ui | |
var url = "/swagger/spec/sentiment.json"; | |
window.anotherSwaggerUi = new SwaggerUi({ | |
url: url, | |
dom_id: "another-swagger-ui-container", | |
supportedSubmitMethods: ['get', 'post', 'put', 'delete', 'patch'], | |
onComplete: function(swaggerApi, swaggerUi) { | |
$('#another-swagger-ui-container pre code').each(function(i, e) {hljs.highlightBlock(e)}); | |
}, | |
onFailure: function(data) { | |
log("Unable to Load Sentiment-SwaggerUI"); | |
}, | |
docExpansion: "list", | |
transport: function(httpClient, obj) { | |
log("[swagger-ui]>>> custom transport."); | |
return ApiDocsProxy.execute(httpClient, obj); | |
} | |
}); | |
window.anotherSwaggerUi.load(); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment