Make SwaggerUi UMD compatible
BIN
dist/fonts/droid-sans-v6-latin-700.eot
vendored
BIN
dist/fonts/droid-sans-v6-latin-700.ttf
vendored
BIN
dist/fonts/droid-sans-v6-latin-regular.ttf
vendored
BIN
dist/images/explorer_icons.png
vendored
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
BIN
dist/images/favicon-16x16.png
vendored
|
Before Width: | Height: | Size: 645 B After Width: | Height: | Size: 644 B |
BIN
dist/images/favicon-32x32.png
vendored
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
BIN
dist/images/logo_small.png
vendored
|
Before Width: | Height: | Size: 770 B After Width: | Height: | Size: 769 B |
BIN
dist/images/pet_store_api.png
vendored
|
Before Width: | Height: | Size: 824 B After Width: | Height: | Size: 823 B |
BIN
dist/images/wordnik_api.png
vendored
|
Before Width: | Height: | Size: 980 B After Width: | Height: | Size: 979 B |
82
dist/swagger-ui.js
vendored
@@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
(function(){'use strict';
|
(function(){'use strict';
|
||||||
|
|
||||||
window.SwaggerUi = Backbone.Router.extend({
|
var SwaggerUi = Backbone.Router.extend({
|
||||||
|
|
||||||
dom_id: 'swagger_ui',
|
dom_id: 'swagger_ui',
|
||||||
|
|
||||||
@@ -201,13 +201,14 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.SwaggerUi = SwaggerUi;
|
||||||
window.SwaggerUi.Views = {};
|
window.SwaggerUi.Views = {};
|
||||||
|
|
||||||
// don't break backward compatibility with previous versions and warn users to upgrade their code
|
// don't break backward compatibility with previous versions and warn users to upgrade their code
|
||||||
(function(){
|
(function(){
|
||||||
window.authorizations = {
|
window.authorizations = {
|
||||||
add: function() {
|
add: function() {
|
||||||
warn('using window.authorizations is depreciated. Please use waggerUi.api.clientAuthorizations.add().');
|
warn('Using window.authorizations is deprecated. Please use SwaggerUi.api.clientAuthorizations.add().');
|
||||||
|
|
||||||
if (typeof window.swaggerUi === 'undefined') {
|
if (typeof window.swaggerUi === 'undefined') {
|
||||||
throw new TypeError('window.swaggerUi is not defined');
|
throw new TypeError('window.swaggerUi is not defined');
|
||||||
@@ -220,12 +221,12 @@ window.SwaggerUi.Views = {};
|
|||||||
};
|
};
|
||||||
|
|
||||||
window.ApiKeyAuthorization = function() {
|
window.ApiKeyAuthorization = function() {
|
||||||
warn('window.ApiKeyAuthorization is depreciated. Please use SwaggerClient.ApiKeyAuthorization.');
|
warn('window.ApiKeyAuthorization is deprecated. Please use SwaggerClient.ApiKeyAuthorization.');
|
||||||
SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
|
SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
window.PasswordAuthorization = function() {
|
window.PasswordAuthorization = function() {
|
||||||
warn('window.PasswordAuthorization is depreciated. Please use SwaggerClient.PasswordAuthorization.');
|
warn('window.PasswordAuthorization is deprecated. Please use SwaggerClient.PasswordAuthorization.');
|
||||||
SwaggerClient.PasswordAuthorization.apply(window, arguments);
|
SwaggerClient.PasswordAuthorization.apply(window, arguments);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -235,6 +236,27 @@ window.SwaggerUi.Views = {};
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
// UMD
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define(['b'], function (b) {
|
||||||
|
return (root.SwaggerUi = factory(b));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object') {
|
||||||
|
// Node. Does not work with strict CommonJS, but
|
||||||
|
// only CommonJS-like enviroments that support module.exports,
|
||||||
|
// like Node.
|
||||||
|
module.exports = factory(require('b'));
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
root.SwaggerUi = factory(root.b);
|
||||||
|
}
|
||||||
|
}(this, function () {
|
||||||
|
return SwaggerUi;
|
||||||
|
}));
|
||||||
this["Handlebars"] = this["Handlebars"] || {};
|
this["Handlebars"] = this["Handlebars"] || {};
|
||||||
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
|
this["Handlebars"]["templates"] = this["Handlebars"]["templates"] || {};
|
||||||
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
this["Handlebars"]["templates"]["apikey_button_view"] = Handlebars.template({"compiler":[6,">= 2.0.0-beta.1"],"main":function(depth0,helpers,partials,data) {
|
||||||
@@ -572,10 +594,10 @@ this["Handlebars"]["templates"]["operation"] = Handlebars.template({"1":function
|
|||||||
},"3":function(depth0,helpers,partials,data) {
|
},"3":function(depth0,helpers,partials,data) {
|
||||||
return " <h4>Warning: Deprecated</h4>\n";
|
return " <h4>Warning: Deprecated</h4>\n";
|
||||||
},"5":function(depth0,helpers,partials,data) {
|
},"5":function(depth0,helpers,partials,data) {
|
||||||
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <p class=\"markdown\">";
|
var stack1, helper, functionType="function", helperMissing=helpers.helperMissing, buffer = " <h4>Implementation Notes</h4>\n <div class=\"markdown\">";
|
||||||
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
stack1 = ((helper = (helper = helpers.description || (depth0 != null ? depth0.description : depth0)) != null ? helper : helperMissing),(typeof helper === functionType ? helper.call(depth0, {"name":"description","hash":{},"data":data}) : helper));
|
||||||
if (stack1 != null) { buffer += stack1; }
|
if (stack1 != null) { buffer += stack1; }
|
||||||
return buffer + "</p>\n";
|
return buffer + "</div>\n";
|
||||||
},"7":function(depth0,helpers,partials,data) {
|
},"7":function(depth0,helpers,partials,data) {
|
||||||
return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
|
return " <div class=\"auth\">\n <span class=\"api-ic ic-error\"></span>";
|
||||||
},"9":function(depth0,helpers,partials,data) {
|
},"9":function(depth0,helpers,partials,data) {
|
||||||
@@ -1212,21 +1234,48 @@ SwaggerUi.Views.HeaderView = Backbone.View.extend({
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
SwaggerUi.Views.MainView = Backbone.View.extend({
|
SwaggerUi.Views.MainView = Backbone.View.extend({
|
||||||
|
apisSorters : {
|
||||||
// TODO: sorters were not used in any place, do we need them?
|
alpha : function(a,b){ return a.name.localeCompare(b.name); }
|
||||||
// sorters = {
|
},
|
||||||
// alpha : function(a,b){ return a.path.localeCompare(b.path); },
|
operationsSorters : {
|
||||||
// method : function(a,b){ return a.method.localeCompare(b.method); },
|
alpha : function(a,b){ return a.path.localeCompare(b.path); },
|
||||||
// },
|
method : function(a,b){ return a.method.localeCompare(b.method); }
|
||||||
|
},
|
||||||
initialize: function(opts){
|
initialize: function(opts){
|
||||||
|
var sorterOption, sorterFn, key, value;
|
||||||
opts = opts || {};
|
opts = opts || {};
|
||||||
|
|
||||||
this.router = opts.router;
|
this.router = opts.router;
|
||||||
|
|
||||||
|
// Sort APIs
|
||||||
|
if (opts.swaggerOptions.apisSorter) {
|
||||||
|
sorterOption = opts.swaggerOptions.apisSorter;
|
||||||
|
if (_.isFunction(sorterOption)) {
|
||||||
|
sorterFn = sorterOption;
|
||||||
|
} else {
|
||||||
|
sorterFn = this.apisSorters[sorterOption];
|
||||||
|
}
|
||||||
|
if (_.isFunction(sorterFn)) {
|
||||||
|
this.model.apisArray.sort(sorterFn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Sort operations of each API
|
||||||
|
if (opts.swaggerOptions.operationsSorter) {
|
||||||
|
sorterOption = opts.swaggerOptions.operationsSorter;
|
||||||
|
if (_.isFunction(sorterOption)) {
|
||||||
|
sorterFn = sorterOption;
|
||||||
|
} else {
|
||||||
|
sorterFn = this.operationsSorters[sorterOption];
|
||||||
|
}
|
||||||
|
if (_.isFunction(sorterFn)) {
|
||||||
|
for (key in this.model.apisArray) {
|
||||||
|
this.model.apisArray[key].operationsArray.sort(sorterFn);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// set up the UI for input
|
// set up the UI for input
|
||||||
this.model.auths = [];
|
this.model.auths = [];
|
||||||
var key, value;
|
|
||||||
|
|
||||||
for (key in this.model.securityDefinitions) {
|
for (key in this.model.securityDefinitions) {
|
||||||
value = this.model.securityDefinitions[key];
|
value = this.model.securityDefinitions[key];
|
||||||
@@ -1321,6 +1370,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
|
|||||||
$(this.el).html('');
|
$(this.el).html('');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
SwaggerUi.Views.OperationView = Backbone.View.extend({
|
SwaggerUi.Views.OperationView = Backbone.View.extend({
|
||||||
@@ -1392,9 +1442,6 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
|
|||||||
this.model.isReadOnly = true;
|
this.model.isReadOnly = true;
|
||||||
}
|
}
|
||||||
this.model.description = this.model.description || this.model.notes;
|
this.model.description = this.model.description || this.model.notes;
|
||||||
if (this.model.description) {
|
|
||||||
this.model.description = this.model.description.replace(/(?:\r\n|\r|\n)/g, '<br />');
|
|
||||||
}
|
|
||||||
this.model.oauth = null;
|
this.model.oauth = null;
|
||||||
modelAuths = this.model.authorizations || this.model.security;
|
modelAuths = this.model.authorizations || this.model.security;
|
||||||
if (modelAuths) {
|
if (modelAuths) {
|
||||||
@@ -1950,6 +1997,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({
|
SwaggerUi.Views.ParameterContentTypeView = Backbone.View.extend({
|
||||||
|
|||||||
4
dist/swagger-ui.min.js
vendored
@@ -1,6 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
window.SwaggerUi = Backbone.Router.extend({
|
var SwaggerUi = Backbone.Router.extend({
|
||||||
|
|
||||||
dom_id: 'swagger_ui',
|
dom_id: 'swagger_ui',
|
||||||
|
|
||||||
@@ -195,6 +195,7 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.SwaggerUi = SwaggerUi;
|
||||||
window.SwaggerUi.Views = {};
|
window.SwaggerUi.Views = {};
|
||||||
|
|
||||||
// don't break backward compatibility with previous versions and warn users to upgrade their code
|
// don't break backward compatibility with previous versions and warn users to upgrade their code
|
||||||
@@ -229,3 +230,24 @@ window.SwaggerUi.Views = {};
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
||||||
|
// UMD
|
||||||
|
(function (root, factory) {
|
||||||
|
if (typeof define === 'function' && define.amd) {
|
||||||
|
// AMD. Register as an anonymous module.
|
||||||
|
define(['b'], function (b) {
|
||||||
|
return (root.SwaggerUi = factory(b));
|
||||||
|
});
|
||||||
|
} else if (typeof exports === 'object') {
|
||||||
|
// Node. Does not work with strict CommonJS, but
|
||||||
|
// only CommonJS-like enviroments that support module.exports,
|
||||||
|
// like Node.
|
||||||
|
module.exports = factory(require('b'));
|
||||||
|
} else {
|
||||||
|
// Browser globals
|
||||||
|
root.SwaggerUi = factory(root.b);
|
||||||
|
}
|
||||||
|
}(this, function () {
|
||||||
|
return SwaggerUi;
|
||||||
|
}));
|
||||||