Move backward compatibility to swaggerUi.js and warn users about API changes
This commit is contained in:
34
dist/swagger-ui.js
vendored
34
dist/swagger-ui.js
vendored
@@ -202,7 +202,39 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.SwaggerUi.Views = {};
|
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"] = 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) {
|
||||||
|
|||||||
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);
|
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>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -196,3 +196,36 @@ window.SwaggerUi = Backbone.Router.extend({
|
|||||||
});
|
});
|
||||||
|
|
||||||
window.SwaggerUi.Views = {};
|
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