Browse Source

fixed file param name

bubble
Tony Tam 11 years ago
parent
commit
dbfb1adc26
5 changed files with 36 additions and 29 deletions
  1. +31
    -24
      dist/lib/swagger.js
  2. +1
    -1
      dist/swagger-ui.js
  3. +1
    -1
      dist/swagger-ui.min.js
  4. +2
    -2
      package.json
  5. +1
    -1
      src/main/coffeescript/view/OperationView.coffee

+ 31
- 24
dist/lib/swagger.js View File

@@ -324,7 +324,7 @@
return _results;
};

SwaggerModel.prototype.getMockSignature = function(prefix, modelsToIgnore) {
SwaggerModel.prototype.getMockSignature = function(modelsToIgnore) {
var classClose, classOpen, prop, propertiesStr, returnVal, strong, strongClose, stronger, _i, _j, _len, _len1, _ref, _ref1;
propertiesStr = [];
_ref = this.properties;
@@ -332,15 +332,12 @@
prop = _ref[_i];
propertiesStr.push(prop.toString());
}
strong = '<span style="font-weight: bold; color: #000; font-size: 1.0em">';
stronger = '<span style="font-weight: bold; color: #000; font-size: 1.1em">';
strong = '<span class="strong">';
stronger = '<span class="stronger">';
strongClose = '</span>';
classOpen = strong + 'class ' + this.name + '(' + strongClose;
classClose = strong + ')' + strongClose;
returnVal = classOpen + '<span>' + propertiesStr.join('</span>, <span>') + '</span>' + classClose;
if (prefix != null) {
returnVal = stronger + prefix + strongClose + '<br/>' + returnVal;
}
classOpen = strong + this.name + ' {' + strongClose;
classClose = strong + '}' + strongClose;
returnVal = classOpen + '<div>' + propertiesStr.join(',</div><div>') + '</div>' + classClose;
if (!modelsToIgnore) {
modelsToIgnore = [];
}
@@ -349,19 +346,21 @@
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
prop = _ref1[_j];
if ((prop.refModel != null) && (modelsToIgnore.indexOf(prop.refModel)) === -1) {
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(void 0, modelsToIgnore));
returnVal = returnVal + ('<br>' + prop.refModel.getMockSignature(modelsToIgnore));
}
}
return returnVal;
};

SwaggerModel.prototype.createJSONSample = function(modelToIgnore) {
SwaggerModel.prototype.createJSONSample = function(modelsToIgnore) {
var prop, result, _i, _len, _ref;
result = {};
modelsToIgnore = modelsToIgnore || [];
modelsToIgnore.push(this.name);
_ref = this.properties;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
prop = _ref[_i];
result[prop.name] = prop.getSampleValue(modelToIgnore);
result[prop.name] = prop.getSampleValue(modelsToIgnore);
}
return result;
};
@@ -375,8 +374,9 @@
function SwaggerModelProperty(name, obj) {
this.name = name;
this.dataType = obj.type;
this.isArray = this.dataType.toLowerCase() === 'array';
this.isCollection = this.dataType && (this.dataType.toLowerCase() === 'array' || this.dataType.toLowerCase() === 'list' || this.dataType.toLowerCase() === 'set');
this.descr = obj.description;
this.required = obj.required;
if (obj.items != null) {
if (obj.items.type != null) {
this.refDataType = obj.items.type;
@@ -395,18 +395,18 @@
}
}

SwaggerModelProperty.prototype.getSampleValue = function(modelToIgnore) {
SwaggerModelProperty.prototype.getSampleValue = function(modelsToIgnore) {
var result;
if ((this.refModel != null) && (!(this.refModel === modelToIgnore))) {
result = this.refModel.createJSONSample(this.refModel);
if ((this.refModel != null) && (modelsToIgnore.indexOf(this.refModel.name) === -1)) {
result = this.refModel.createJSONSample(modelsToIgnore);
} else {
if (this.isArray) {
if (this.isCollection) {
result = this.refDataType;
} else {
result = this.dataType;
}
}
if (this.isArray) {
if (this.isCollection) {
return [result];
} else {
return result;
@@ -414,13 +414,18 @@
};

SwaggerModelProperty.prototype.toString = function() {
var str;
str = this.name + ': ' + this.dataTypeWithRef;
var req, str;
req = this.required ? 'propReq' : 'propOpt';
str = '<span class="propName ' + req + '">' + this.name + '</span> (<span class="propType">' + this.dataTypeWithRef + '</span>';
if (!this.required) {
str += ', <span class="propOptKey">optional</span>';
}
str += ')';
if (this.values != null) {
str += " = ['" + this.values.join("' or '") + "']";
str += " = <span class='propVals'>['" + this.values.join("' or '") + "']</span>";
}
if (this.descr != null) {
str += ' {' + this.descr + '}';
str += ': <span class="propDesc">' + this.descr + '</span>';
}
return str;
};
@@ -525,9 +530,9 @@
return dataType;
} else {
if (listType != null) {
return models[listType].getMockSignature(dataType);
return models[listType].getMockSignature();
} else {
return models[dataType].getMockSignature(dataType);
return models[dataType].getMockSignature();
}
}
};
@@ -762,4 +767,6 @@

window.SwaggerRequest = SwaggerRequest;

window.SwaggerModelProperty = SwaggerModelProperty;

}).call(this);

+ 1
- 1
dist/swagger-ui.js View File

@@ -1590,7 +1590,7 @@ templates['status_code'] = template(function (Handlebars,depth0,helpers,partials
_ref2 = this.model.parameters;
for (_k = 0, _len2 = _ref2.length; _k < _len2; _k++) {
param = _ref2[_k];
if ((param.paramType === 'body' || 'form') && param.name !== 'file' && (map[param.name] != null)) {
if ((param.paramType === 'body' || 'form') && param.name !== 'file' && param.name !== 'File' && (map[param.name] != null)) {
bodyParam.append(param.name, map[param.name]);
}
}


+ 1
- 1
dist/swagger-ui.min.js
File diff suppressed because it is too large
View File


+ 2
- 2
package.json View File

@@ -1,6 +1,6 @@
{
"name": "swagger-ui",
"version": "0.1.13",
"version": "0.1.14",
"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.5.0",
"swagger-client": "1.0.2",
"swagger-client": "1.0.3",
"handlebars": "~1.0.10"
}
}

+ 1
- 1
src/main/coffeescript/view/OperationView.coffee View File

@@ -100,7 +100,7 @@ class OperationView extends Backbone.View

# add params except file
for param in @model.parameters
if (param.paramType is 'body' or 'form') and param.name isnt 'file' and map[param.name]?
if (param.paramType is 'body' or 'form') and param.name isnt 'file' and param.name isnt 'File' and map[param.name]?
bodyParam.append(param.name, map[param.name])

# add files


Loading…
Cancel
Save