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 // swagger-ui.js
// version 2.0.19 // version 2.0.20
$(function() { $(function() {
// Helper function for vertically aligning DOM elements // Helper function for vertically aligning DOM elements
@@ -1495,7 +1495,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
model: resource, model: resource,
tagName: 'li', tagName: 'li',
id: 'resource_' + resource.id, id: 'resource_' + resource.id,
className: 'resource' className: 'resource',
swaggerOptions: this.options.swaggerOptions
}); });
return $('#resources').append(resourceView.render().el); return $('#resources').append(resourceView.render().el);
}; };
@@ -1545,7 +1546,8 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
operationView = new OperationView({ operationView = new OperationView({
model: operation, model: operation,
tagName: 'li', tagName: 'li',
className: 'endpoint' className: 'endpoint',
swaggerOptions: this.options.swaggerOptions
}); });
$('.endpoints', $(this.el)).append(operationView.render().el); $('.endpoints', $(this.el)).append(operationView.render().el);
return this.number++; return this.number++;
@@ -1975,7 +1977,7 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
}; };
OperationView.prototype.showStatus = function(response) { 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) { if (response.content === void 0) {
content = response.data; content = response.data;
url = response.url; url = response.url;
@@ -2011,7 +2013,13 @@ helpers = this.merge(helpers, Handlebars.helpers); data = data || {};
$(".response", $(this.el)).slideDown(); $(".response", $(this.el)).slideDown();
$(".response_hider", $(this.el)).show(); $(".response_hider", $(this.el)).show();
$(".response_throbber", $(this.el)).hide(); $(".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() { OperationView.prototype.toggleOperationContent = function() {

File diff suppressed because one or more lines are too long

View File

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

View File

@@ -1,6 +1,6 @@
{ {
"name": "swagger-ui", "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", "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": { "scripts": {
"build": "PATH=$PATH:./node_modules/.bin cake dist", "build": "PATH=$PATH:./node_modules/.bin cake dist",
@@ -19,7 +19,7 @@
"readmeFilename": "README.md", "readmeFilename": "README.md",
"dependencies": { "dependencies": {
"coffee-script": "~1.6.3", "coffee-script": "~1.6.3",
"swagger-client": "2.0.34", "swagger-client": "2.0.35",
"handlebars": "~1.0.10", "handlebars": "~1.0.10",
"less": "~1.4.2" "less": "~1.4.2"
} }