Browse Source

added authorization support from swagger-js 2.0

bubble
Tony Tam 11 years ago
parent
commit
58746157b3
6 changed files with 43 additions and 13 deletions
  1. +16
    -2
      dist/lib/swagger.js
  2. +4
    -4
      dist/swagger-ui.js
  3. +1
    -1
      dist/swagger-ui.min.js
  4. +16
    -2
      lib/swagger.js
  5. +4
    -2
      src/main/coffeescript/SwaggerUi.coffee
  6. +2
    -2
      src/main/coffeescript/view/HeaderView.coffee

+ 16
- 2
dist/lib/swagger.js View File

@@ -44,7 +44,7 @@
}

SwaggerApi.prototype.build = function() {
var obj,
var e, obj,
_this = this;
this.progress('fetching resource list: ' + this.url);
console.log('getting ' + this.url);
@@ -112,6 +112,13 @@
}
}
};
e = {};
if (typeof window !== 'undefined') {
e = window;
} else {
e = exports;
}
e.authorizations.apply(obj);
new SwaggerHttp().execute(obj);
return this;
};
@@ -196,7 +203,7 @@
SwaggerResource.prototype.consumes = null;

function SwaggerResource(resourceObj, api) {
var consumes, obj, parts, produces,
var consumes, e, obj, parts, produces,
_this = this;
this.api = api;
this.api = this.api;
@@ -233,6 +240,13 @@
}
}
};
e = {};
if (typeof window !== 'undefined') {
e = window;
} else {
e = exports;
}
e.authorizations.apply(obj);
new SwaggerHttp().execute(obj);
}
}


+ 4
- 4
dist/swagger-ui.js View File

@@ -1394,7 +1394,9 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
_ref.clear();
}
this.headerView.update(this.options.url);
return this.api = new SwaggerApi(this.options);
this.api = new SwaggerApi(this.options);
this.api.build();
return this.api;
};

SwaggerUi.prototype.render = function() {
@@ -1500,11 +1502,9 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
trigger = false;
}
$('#input_baseUrl').val(url);
$('#input_apiKey').val(apiKey);
if (trigger) {
return this.trigger('update-swagger-ui', {
url: url,
apiKey: apiKey
url: url
});
}
};


+ 1
- 1
dist/swagger-ui.min.js
File diff suppressed because it is too large
View File


+ 16
- 2
lib/swagger.js View File

@@ -44,7 +44,7 @@
}

SwaggerApi.prototype.build = function() {
var obj,
var e, obj,
_this = this;
this.progress('fetching resource list: ' + this.url);
console.log('getting ' + this.url);
@@ -112,6 +112,13 @@
}
}
};
e = {};
if (typeof window !== 'undefined') {
e = window;
} else {
e = exports;
}
e.authorizations.apply(obj);
new SwaggerHttp().execute(obj);
return this;
};
@@ -196,7 +203,7 @@
SwaggerResource.prototype.consumes = null;

function SwaggerResource(resourceObj, api) {
var consumes, obj, parts, produces,
var consumes, e, obj, parts, produces,
_this = this;
this.api = api;
this.api = this.api;
@@ -233,6 +240,13 @@
}
}
};
e = {};
if (typeof window !== 'undefined') {
e = window;
} else {
e = exports;
}
e.authorizations.apply(obj);
new SwaggerHttp().execute(obj);
}
}


+ 4
- 2
src/main/coffeescript/SwaggerUi.coffee View File

@@ -43,6 +43,8 @@ class SwaggerUi extends Backbone.Router
@mainView?.clear()
@headerView.update(@options.url)
@api = new SwaggerApi(@options)
@api.build()
@api
# This is bound to success handler for SwaggerApi
# so it gets called when SwaggerApi completes loading
@@ -51,8 +53,8 @@ class SwaggerUi extends Backbone.Router
@mainView = new MainView({model: @api, el: $('#' + @dom_id)}).render()
@showMessage()
switch @options.docExpansion
when "full" then Docs.expandOperationsForResource('')
when "list" then Docs.collapseOperationsForResource('')
when "full" then Docs.expandOperationsForResource('')
when "list" then Docs.collapseOperationsForResource('')
@options.onComplete(@api, @) if @options.onComplete
setTimeout(
=>


+ 2
- 2
src/main/coffeescript/view/HeaderView.coffee View File

@@ -33,5 +33,5 @@ class HeaderView extends Backbone.View

update: (url, apiKey, trigger = false) ->
$('#input_baseUrl').val url
$('#input_apiKey').val apiKey
@trigger 'update-swagger-ui', {url:url, apiKey:apiKey} if trigger
#$('#input_apiKey').val apiKey
@trigger 'update-swagger-ui', {url:url} if trigger

Loading…
Cancel
Save