updated swagger-js, added #507 to dist

This commit is contained in:
Tony Tam
2014-08-02 09:31:17 -07:00
parent e04b756521
commit 0a52e344e7
4 changed files with 29 additions and 20 deletions

18
dist/swagger-ui.js vendored
View File

@@ -1,5 +1,5 @@
// swagger-ui.js
// version 2.0.19
// version 2.0.20
$(function() {
// Helper function for vertically aligning DOM elements
@@ -1495,7 +1495,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
model: resource,
tagName: 'li',
id: 'resource_' + resource.id,
className: 'resource'
className: 'resource',
swaggerOptions: this.options.swaggerOptions
});
return $('#resources').append(resourceView.render().el);
};
@@ -1545,7 +1546,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
operationView = new OperationView({
model: operation,
tagName: 'li',
className: 'endpoint'
className: 'endpoint',
swaggerOptions: this.options.swaggerOptions
});
$('.endpoints', $(this.el)).append(operationView.render().el);
return this.number++;
@@ -1975,7 +1977,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
};
OperationView.prototype.showStatus = function(response) {
var code, content, contentType, headers, pre, response_body, url;
var code, content, contentType, headers, opts, pre, response_body, response_body_el, url;
if (response.content === void 0) {
content = response.data;
url = response.url;
@@ -2011,7 +2013,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
$(".response", $(this.el)).slideDown();
$(".response_hider", $(this.el)).show();
$(".response_throbber", $(this.el)).hide();
return hljs.highlightBlock($('.response_body', $(this.el))[0]);
response_body_el = $('.response_body', $(this.el))[0];
opts = this.options.swaggerOptions;
if (opts.highlightSizeThreshold && response.data.length > opts.highlightSizeThreshold) {
return response_body_el;
} else {
return hljs.highlightBlock(response_body_el);
}
};
OperationView.prototype.toggleOperationContent = function() {

File diff suppressed because one or more lines are too long

View File

@@ -1,5 +1,5 @@
// swagger.js
// version 2.0.34
// version 2.0.35
var __bind = function(fn, me){
return function(){
@@ -1203,9 +1203,9 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
// if any form params, content type must be set
if(definedFormParams.length > 0) {
if(definedFileParams.length > 0)
accepts = "multipart/form-data";
consumes = "multipart/form-data";
else
accepts = "application/x-www-form-urlencoded";
consumes = "application/x-www-form-urlencoded";
}
else if (this.type == "DELETE")
body = "{}";
@@ -1213,10 +1213,10 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
accepts = null;
}
if (contentType && this.operation.consumes) {
if (this.operation.consumes.indexOf(contentType) === -1) {
log("server doesn't consume " + contentType + ", try " + JSON.stringify(this.operation.consumes));
contentType = this.operation.consumes[0];
if (consumes && this.operation.consumes) {
if (this.operation.consumes.indexOf(consumes) === -1) {
log("server doesn't consume " + consumes + ", try " + JSON.stringify(this.operation.consumes));
consumes = this.operation.consumes[0];
}
}
@@ -1231,13 +1231,13 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
accepts = this.operation.produces[0];
}
}
if (contentType && contentType.indexOf("application/x-www-form-urlencoded") === 0) {
if (consumes && consumes.indexOf("application/x-www-form-urlencoded") === 0) {
var fields = {};
var possibleParams = {};
var values = {};
var key;
for(key in formParams){
var param = formParams[key];
for(key in definedFormParams){
var param = definedFormParams[key];
values[param.name] = param;
}
@@ -1253,8 +1253,8 @@ SwaggerRequest.prototype.setHeaders = function(params, operation) {
}
body = encoded;
}
if ((contentType && body !== "") || (contentType === "application/x-www-form-urlencoded"))
headers["Content-Type"] = contentType;
if ((consumes && body !== "") || (consumes === "application/x-www-form-urlencoded"))
headers["Content-Type"] = consumes;
if (accepts)
headers["Accept"] = accepts;
@@ -1603,3 +1603,4 @@ e.SwaggerModel = SwaggerModel;
e.SwaggerModelProperty = SwaggerModelProperty;
e.SwaggerResource = SwaggerResource;
e.SwaggerApi = SwaggerApi;

View File

@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "2.0.19",
"version": "2.0.20",
"description": "Swagger UI is a dependency-free collection of HTML, Javascript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API",
"scripts": {
"build": "PATH=$PATH:./node_modules/.bin cake dist",
@@ -19,7 +19,7 @@
"readmeFilename": "README.md",
"dependencies": {
"coffee-script": "~1.6.3",
"swagger-client": "2.0.34",
"swagger-client": "2.0.35",
"handlebars": "~1.0.10",
"less": "~1.4.2"
}