Skip to content

Commit 0a52e34

Browse files
committed
updated swagger-js, added #507 to dist
1 parent e04b756 commit 0a52e34

File tree

4 files changed

+29
-20
lines changed

4 files changed

+29
-20
lines changed

dist/swagger-ui.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// swagger-ui.js
2-
// version 2.0.19
2+
// version 2.0.20
33
$(function() {
44

55
// Helper function for vertically aligning DOM elements
@@ -1495,7 +1495,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
14951495
model: resource,
14961496
tagName: 'li',
14971497
id: 'resource_' + resource.id,
1498-
className: 'resource'
1498+
className: 'resource',
1499+
swaggerOptions: this.options.swaggerOptions
14991500
});
15001501
return $('#resources').append(resourceView.render().el);
15011502
};
@@ -1545,7 +1546,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
15451546
operationView = new OperationView({
15461547
model: operation,
15471548
tagName: 'li',
1548-
className: 'endpoint'
1549+
className: 'endpoint',
1550+
swaggerOptions: this.options.swaggerOptions
15491551
});
15501552
$('.endpoints', $(this.el)).append(operationView.render().el);
15511553
return this.number++;
@@ -1975,7 +1977,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
19751977
};
19761978

19771979
OperationView.prototype.showStatus = function(response) {
1978-
var code, content, contentType, headers, pre, response_body, url;
1980+
var code, content, contentType, headers, opts, pre, response_body, response_body_el, url;
19791981
if (response.content === void 0) {
19801982
content = response.data;
19811983
url = response.url;
@@ -2011,7 +2013,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
20112013
$(".response", $(this.el)).slideDown();
20122014
$(".response_hider", $(this.el)).show();
20132015
$(".response_throbber", $(this.el)).hide();
2014-
return hljs.highlightBlock($('.response_body', $(this.el))[0]);
2016+
response_body_el = $('.response_body', $(this.el))[0];
2017+
opts = this.options.swaggerOptions;
2018+
if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
2019+
return response_body_el;
2020+
} else {
2021+
return hljs.highlightBlock(response_body_el);
2022+
}
20152023
};
20162024

20172025
OperationView.prototype.toggleOperationContent = function() {

dist/swagger-ui.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/swagger.js

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// swagger.js
2-
// version 2.0.34
2+
// version 2.0.35
33

44
var __bind = function(fn, me){
55
return function(){
@@ -1203,20 +1203,20 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
12031203
// if any form params, content type must be set
12041204
if(definedFormParams.length > 0) {
12051205
if(definedFileParams.length > 0)
1206-
accepts = "multipart/form-data";
1206+
consumes = "multipart/form-data";
12071207
else
1208-
accepts = "application/x-www-form-urlencoded";
1208+
consumes = "application/x-www-form-urlencoded";
12091209
}
12101210
else if (this.type == "DELETE")
12111211
body = "{}";
12121212
else if (this.type != "DELETE")
12131213
accepts = null;
12141214
}
12151215

1216-
if (contentType && this.operation.consumes) {
1217-
if (this.operation.consumes.indexOf(contentType) === -1) {
1218-
log("server doesn't consume " + contentType + ", try " + JSON.stringify(this.operation.consumes));
1219-
contentType = this.operation.consumes[0];
1216+
if (consumes && this.operation.consumes) {
1217+
if (this.operation.consumes.indexOf(consumes) === -1) {
1218+
log("server doesn't consume " + consumes + ", try " + JSON.stringify(this.operation.consumes));
1219+
consumes = this.operation.consumes[0];
12201220
}
12211221
}
12221222

@@ -1231,13 +1231,13 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
12311231
accepts = this.operation.produces[0];
12321232
}
12331233
}
1234-
if (contentType && contentType.indexOf("application/x-www-form-urlencoded") === 0) {
1234+
if (consumes && consumes.indexOf("application/x-www-form-urlencoded") === 0) {
12351235
var fields = {};
12361236
var possibleParams = {};
12371237
var values = {};
12381238
var key;
1239-
for(key in formParams){
1240-
var param = formParams[key];
1239+
for(key in definedFormParams){
1240+
var param = definedFormParams[key];
12411241
values[param.name] = param;
12421242
}
12431243

@@ -1253,8 +1253,8 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
12531253
}
12541254
body = encoded;
12551255
}
1256-
if ((contentType && body !== "") || (contentType === "application/x-www-form-urlencoded"))
1257-
headers["Content-Type"] = contentType;
1256+
if ((consumes && body !== "") || (consumes === "application/x-www-form-urlencoded"))
1257+
headers["Content-Type"] = consumes;
12581258
if (accepts)
12591259
headers["Accept"] = accepts;
12601260

@@ -1603,3 +1603,4 @@ e.SwaggerModel = SwaggerModel;
16031603
e.SwaggerModelProperty = SwaggerModelProperty;
16041604
e.SwaggerResource = SwaggerResource;
16051605
e.SwaggerApi = SwaggerApi;
1606+

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "swagger-ui",
3-
"version": "2.0.19",
3+
"version": "2.0.20",
44
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
55
"scripts": {
66
"build": "PATH=$PATH:./node_modules/.bin cake dist",
@@ -19,7 +19,7 @@
1919
"readmeFilename": "README.md",
2020
"dependencies": {
2121
"coffee-script": "~1.6.3",
22-
"swagger-client": "2.0.34",
22+
"swagger-client": "2.0.35",
2323
"handlebars": "~1.0.10",
2424
"less": "~1.4.2"
2525
}

0 commit comments

Comments
 (0)