Move backward compatibility to swaggerUi.js and warn users about API changes
This commit is contained in:
32
dist/swagger-ui.js
vendored
32
dist/swagger-ui.js
vendored
@@ -203,6 +203,38 @@ window.SwaggerUi = Backbone.Router.extend({
|
||||
|
||||
window.SwaggerUi.Views = {};
|
||||
|
||||
// don't break backward compatibility with previous versions and warn users to upgrade their code
|
||||
(function(){
|
||||
window.authorizations = {
|
||||
add: function() {
|
||||
warn('using window.authorizations is depreciated. Please use waggerUi.api.clientAuthorizations.add().');
|
||||
|
||||
if (typeof window.swaggerUi === 'undefined') {
|
||||
throw new TypeError('window.swaggerUi is not defined');
|
||||
}
|
||||
|
||||
if (window.swaggerUi instanceof SwaggerUi) {
|
||||
window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.ApiKeyAuthorization = function() {
|
||||
warn('window.ApiKeyAuthorization is depreciated. Please use SwaggerClient.ApiKeyAuthorization.');
|
||||
SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
|
||||
};
|
||||
|
||||
window.PasswordAuthorization = function() {
|
||||
warn('window.PasswordAuthorization is depreciated. Please use SwaggerClient.PasswordAuthorization.');
|
||||
SwaggerClient.PasswordAuthorization.apply(window, arguments);
|
||||
};
|
||||
|
||||
function warn(message) {
|
||||
if ('console' in window && typeof window.console.warn === 'function') {
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
})();
|
||||
this["Handlebars"] = this["Handlebars"] || {};
|
||||
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) {
|
||||
|
||||
4
dist/swagger-ui.min.js
vendored
4
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -83,13 +83,6 @@
|
||||
console.log.apply(console, arguments);
|
||||
}
|
||||
}
|
||||
|
||||
// don't break backward compatibility with previous versions
|
||||
window.authorizations = {
|
||||
add: swaggerUi.api.clientAuthorizations.add
|
||||
};
|
||||
window.ApiKeyAuthorization = SwaggerClient.ApiKeyAuthorization;
|
||||
window.PasswordAuthorization = SwaggerClient.PasswordAuthorization;
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -196,3 +196,36 @@ window.SwaggerUi = Backbone.Router.extend({
|
||||
});
|
||||
|
||||
window.SwaggerUi.Views = {};
|
||||
|
||||
// don't break backward compatibility with previous versions and warn users to upgrade their code
|
||||
(function(){
|
||||
window.authorizations = {
|
||||
add: function() {
|
||||
warn('using window.authorizations is depreciated. Please use waggerUi.api.clientAuthorizations.add().');
|
||||
|
||||
if (typeof window.swaggerUi === 'undefined') {
|
||||
throw new TypeError('window.swaggerUi is not defined');
|
||||
}
|
||||
|
||||
if (window.swaggerUi instanceof SwaggerUi) {
|
||||
window.swaggerUi.api.clientAuthorizations.add.apply(window.swaggerUi.api.clientAuthorizations, arguments);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.ApiKeyAuthorization = function() {
|
||||
warn('window.ApiKeyAuthorization is depreciated. Please use SwaggerClient.ApiKeyAuthorization.');
|
||||
SwaggerClient.ApiKeyAuthorization.apply(window, arguments);
|
||||
};
|
||||
|
||||
window.PasswordAuthorization = function() {
|
||||
warn('window.PasswordAuthorization is depreciated. Please use SwaggerClient.PasswordAuthorization.');
|
||||
SwaggerClient.PasswordAuthorization.apply(window, arguments);
|
||||
};
|
||||
|
||||
function warn(message) {
|
||||
if ('console' in window && typeof window.console.warn === 'function') {
|
||||
console.warn(message);
|
||||
}
|
||||
}
|
||||
})();
|
||||
Reference in New Issue
Block a user