2 //There can only be a single swagger UI in a dom tree
3 //at a time - this is a limitation of the swagger API
4 //This method takes a URL which is the root of the swagger
5 //documentation, as well as the ID of the dom where we should
7 //See the swagger documentation for more information.
8 var loadSwagger = function(url, dom_id) {
9 $("#" + dom_id).empty();
10 $("#" + dom_id).append("Loading " + url);
11 window.swaggerUi = new SwaggerUi({
14 supportedSubmitMethods : [ 'get', 'post', 'put', 'delete' ],
15 onComplete : function(swaggerApi, swaggerUi) {
17 console.log("Loaded SwaggerUI")
19 $('pre code').each(function(i, e) {
20 hljs.highlightBlock(e)
23 onFailure : function(data) {
25 console.log("Unable to Load SwaggerUI");
32 $('#input_apiKey').change(
34 var key = $('#input_apiKey')[0].value;
35 console.log("key: " + key);
36 if (key && key.trim() != "") {
37 console.log("added key " + key);
39 .add("key", new ApiKeyAuthorization("api_key",
43 window.swaggerUi.load();