@@ -324,7 +324,7 @@
return _results;
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;
var classClose, classOpen, prop, propertiesStr, returnVal, strong, strongClose, stronger, _i, _j, _len, _len1, _ref, _ref1;
propertiesStr = [];
propertiesStr = [];
_ref = this.properties;
_ref = this.properties;
@@ -332,15 +332,12 @@
prop = _ref[_i];
prop = _ref[_i];
propertiesStr.push(prop.toString());
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>';
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) {
if (!modelsToIgnore) {
modelsToIgnore = [];
modelsToIgnore = [];
}
}
@@ -349,19 +346,21 @@
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
prop = _ref1[_j];
prop = _ref1[_j];
if ((prop.refModel != null) && (modelsToIgnore.indexOf(prop.refModel)) === -1) {
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;
return returnVal;
};
};
SwaggerModel.prototype.createJSONSample = function(modelToIgnore) {
SwaggerModel.prototype.createJSONSample = function(models ToIgnore) {
var prop, result, _i, _len, _ref;
var prop, result, _i, _len, _ref;
result = {};
result = {};
modelsToIgnore = modelsToIgnore || [];
modelsToIgnore.push(this.name);
_ref = this.properties;
_ref = this.properties;
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
for (_i = 0, _len = _ref.length; _i < _len; _i++) {
prop = _ref[_i];
prop = _ref[_i];
result[prop.name] = prop.getSampleValue(modelToIgnore);
result[prop.name] = prop.getSampleValue(models ToIgnore);
}
}
return result;
return result;
};
};
@@ -375,8 +374,9 @@
function SwaggerModelProperty(name, obj) {
function SwaggerModelProperty(name, obj) {
this.name = name;
this.name = name;
this.dataType = obj.type;
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.descr = obj.description;
this.required = obj.required;
if (obj.items != null) {
if (obj.items != null) {
if (obj.items.type != null) {
if (obj.items.type != null) {
this.refDataType = obj.items.type;
this.refDataType = obj.items.type;
@@ -395,18 +395,18 @@
}
}
}
}
SwaggerModelProperty.prototype.getSampleValue = function(modelToIgnore) {
SwaggerModelProperty.prototype.getSampleValue = function(models ToIgnore) {
var result;
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 {
} else {
if (this.isArray ) {
if (this.isCollection ) {
result = this.refDataType;
result = this.refDataType;
} else {
} else {
result = this.dataType;
result = this.dataType;
}
}
}
}
if (this.isArray ) {
if (this.isCollection ) {
return [result];
return [result];
} else {
} else {
return result;
return result;
@@ -414,13 +414,18 @@
};
};
SwaggerModelProperty.prototype.toString = function() {
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) {
if (this.values != null) {
str += " = ['" + this.values.join("' or '") + "']";
str += " = <span class='propVals'> ['" + this.values.join("' or '") + "']</span> ";
}
}
if (this.descr != null) {
if (this.descr != null) {
str += ' {' + this.descr + '}';
str += ': <span class="propDesc">' + this.descr + '</span> ';
}
}
return str;
return str;
};
};
@@ -525,9 +530,9 @@
return dataType;
return dataType;
} else {
} else {
if (listType != null) {
if (listType != null) {
return models[listType].getMockSignature(dataType );
return models[listType].getMockSignature();
} else {
} else {
return models[dataType].getMockSignature(dataType );
return models[dataType].getMockSignature();
}
}
}
}
};
};
@@ -762,4 +767,6 @@
window.SwaggerRequest = SwaggerRequest;
window.SwaggerRequest = SwaggerRequest;
window.SwaggerModelProperty = SwaggerModelProperty;
}).call(this);
}).call(this);