Merge branch 'develop_2.0'

This commit is contained in:
Tony Tam
2015-04-16 12:29:38 -07:00
17 changed files with 80 additions and 43 deletions

11
.gitattributes vendored
View File

@@ -1,4 +1,11 @@
* text eol=lf * text eol=lf
dist/**/* binary dist/**/*.js binary
src/main/html/images/* binary dist/**/*.map binary
dist/**/*.eot binary
dist/**/*.svg binary
dist/**/*.ttf binary
dist/**/*.woff binary
dist/**/*.woff2 binary
dist/**/*.png binary
dist/*.html text

View File

@@ -20,7 +20,7 @@ The Swagger Specification has undergone 4 revisions since initial creation in 20
Swagger UI Version | Release Date | Swagger Spec compatibility | Notes | Status Swagger UI Version | Release Date | Swagger Spec compatibility | Notes | Status
------------------ | ------------ | -------------------------- | ----- | ------ ------------------ | ------------ | -------------------------- | ----- | ------
2.1.0-M2 | 2015-03-28 | 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-ui) | 2.1.1-M2 | 2015-04-16 | 1.1, 1.2, 2.0 | [master](https://github.com/swagger-api/swagger-ui) |
2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) | 2.0.24 | 2014-09-12 | 1.1, 1.2 | [tag v2.0.24](https://github.com/swagger-api/swagger-ui/tree/v2.0.24) |
1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) | 1.0.13 | 2013-03-08 | 1.1, 1.2 | [tag v1.0.13](https://github.com/swagger-api/swagger-ui/tree/v1.0.13) |
1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) | 1.0.1 | 2011-10-11 | 1.0, 1.1 | [tag v1.0.1](https://github.com/swagger-api/swagger-ui/tree/v1.0.1) |

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 645 B

After

Width:  |  Height:  |  Size: 644 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 770 B

After

Width:  |  Height:  |  Size: 769 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 823 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 980 B

After

Width:  |  Height:  |  Size: 979 B

6
dist/index.html vendored
View File

@@ -42,9 +42,12 @@
}); });
*/ */
} }
$('pre code').each(function(i, e) { $('pre code').each(function(i, e) {
hljs.highlightBlock(e) hljs.highlightBlock(e)
}); });
addApiKeyAuthorization();
}, },
onFailure: function(data) { onFailure: function(data) {
log("Unable to Load SwaggerUI"); log("Unable to Load SwaggerUI");
@@ -53,9 +56,8 @@
sorter : "alpha" sorter : "alpha"
}); });
function addApiKeyAuthorization() { function addApiKeyAuthorization(){
var key = encodeURIComponent($('#input_apiKey')[0].value); var key = encodeURIComponent($('#input_apiKey')[0].value);
log("key: " + key);
if(key && key.trim() != "") { if(key && key.trim() != "") {
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query"); var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query");
window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth); window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth);

View File

@@ -277,7 +277,7 @@ window.onOAuthComplete = function onOAuthComplete(token) {
} }
} }
}); });
window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header')); window.swaggerUi.api.clientAuthorizations.add(oauth2KeyName, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
} }
} }
} }

59
dist/swagger-ui.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -277,7 +277,7 @@ window.onOAuthComplete = function onOAuthComplete(token) {
} }
} }
}); });
window.authorizations.add(oauth2KeyName, new ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header')); window.swaggerUi.api.clientAuthorizations.add(oauth2KeyName, new SwaggerClient.ApiKeyAuthorization('Authorization', 'Bearer ' + b, 'header'));
} }
} }
} }

View File

@@ -6,7 +6,7 @@
"email": "me@azimi.me" "email": "me@azimi.me"
}], }],
"description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API", "description": "Swagger UI is a dependency-free collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"version": "2.1.0-M2", "version": "2.1.1-M2",
"homepage": "http://swagger.io", "homepage": "http://swagger.io",
"license": "Apache 2.0", "license": "Apache 2.0",
"scripts": { "scripts": {
@@ -45,6 +45,6 @@
"less": "^2.4.0", "less": "^2.4.0",
"mocha": "^2.1.0", "mocha": "^2.1.0",
"selenium-webdriver": "^2.45.0", "selenium-webdriver": "^2.45.0",
"swagger-client": "2.1.0-M2" "swagger-client": "2.1.2-M2"
} }
} }

View File

@@ -42,9 +42,12 @@
}); });
*/ */
} }
$('pre code').each(function(i, e) { $('pre code').each(function(i, e) {
hljs.highlightBlock(e) hljs.highlightBlock(e)
}); });
addApiKeyAuthorization();
}, },
onFailure: function(data) { onFailure: function(data) {
log("Unable to Load SwaggerUI"); log("Unable to Load SwaggerUI");
@@ -53,9 +56,8 @@
sorter : "alpha" sorter : "alpha"
}); });
function addApiKeyAuthorization() { function addApiKeyAuthorization(){
var key = encodeURIComponent($('#input_apiKey')[0].value); var key = encodeURIComponent($('#input_apiKey')[0].value);
log("key: " + key);
if(key && key.trim() != "") { if(key && key.trim() != "") {
var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query"); var apiKeyAuth = new SwaggerClient.ApiKeyAuthorization("api_key", key, "query");
window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth); window.swaggerUi.api.clientAuthorizations.add("api_key", apiKeyAuth);

View File

@@ -68,7 +68,7 @@ SwaggerUi.Views.MainView = Backbone.View.extend({
} else { } else {
// Default validator // Default validator
this.model.validatorUrl = 'http://online.swagger.io/validator'; this.model.validatorUrl = window.location.protocol + '//online.swagger.io/validator';
} }
} }
}, },

View File

@@ -325,7 +325,7 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
// Note: This is compiled code // Note: This is compiled code
// TODO: Refactor // TODO: Refactor
handleFileUpload: function(map, form) { handleFileUpload: function(map, form) {
var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, obj, p, param, params, ref1, ref2, ref3, ref4; var bodyParam, el, headerParams, l, len, len1, len2, len3, m, n, o, p, param, params, ref1, ref2, ref3, ref4;
ref1 = form.serializeArray(); ref1 = form.serializeArray();
for (l = 0, len = ref1.length; l < len; l++) { for (l = 0, len = ref1.length; l < len; l++) {
o = ref1[l]; o = ref1[l];
@@ -363,7 +363,9 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true); this.invocationUrl = this.model.supportHeaderParams() ? (headerParams = this.model.getHeaderParams(map), delete headerParams['Content-Type'], this.model.urlify(map, false)) : this.model.urlify(map, true);
$('.request_url', $(this.el)).html('<pre></pre>'); $('.request_url', $(this.el)).html('<pre></pre>');
$('.request_url pre', $(this.el)).text(this.invocationUrl); $('.request_url pre', $(this.el)).text(this.invocationUrl);
obj = {
// TODO: don't use jQuery. Use SwaggerJS for handling the call.
var obj = {
type: this.model.method, type: this.model.method,
url: this.invocationUrl, url: this.invocationUrl,
headers: headerParams, headers: headerParams,
@@ -387,9 +389,6 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
}; };
})(this) })(this)
}; };
if (window.authorizations) {
window.authorizations.apply(obj);
}
jQuery.ajax(obj); jQuery.ajax(obj);
return false; return false;
// end of file-upload nastiness // end of file-upload nastiness
@@ -594,6 +593,12 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
code = $('<code />').html(_.escape(content)); code = $('<code />').html(_.escape(content));
pre = $('<pre class="xml" />').append(code); pre = $('<pre class="xml" />').append(code);
// Plain Text
} else if (/text\/plain/.test(contentType)) {
code = $('<code />').text(content);
pre = $('<pre class="plain" />').append(code);
// Image // Image
} else if (/^image\//.test(contentType)) { } else if (/^image\//.test(contentType)) {
pre = $('<img>').attr('src', url); pre = $('<img>').attr('src', url);