Skip to content

Commit

Permalink
fix for swagger-api#640
Browse files Browse the repository at this point in the history
  • Loading branch information
fehguy committed Feb 1, 2015
1 parent f6f86a3 commit 5ea2860
Show file tree
Hide file tree
Showing 3 changed files with 611 additions and 591 deletions.
30 changes: 24 additions & 6 deletions lib/swagger-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ SwaggerClient.prototype.initialize = function (url, options) {

if (typeof options.success === 'function') {
this.build();
// this.isBuilt = true;
}
};

Expand Down Expand Up @@ -1214,7 +1213,6 @@ Model.prototype.getMockSignature = function(modelsToIgnore) {
prop = this.properties[i];
propertiesStr.push(prop.toString());
}

var strong = '<span class="strong">';
var stronger = '<span class="stronger">';
var strongClose = '</span>';
Expand Down Expand Up @@ -1326,8 +1324,10 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {

getStringSignature = function(obj) {
var str = '';
if(typeof obj.type === 'undefined')
str += obj;
if(typeof obj.$ref !== 'undefined')
str += simpleRef(obj.$ref);
else if(typeof obj.type === 'undefined')
str += 'object';
else if(obj.type === 'array') {
str += 'Array[';
str += getStringSignature((obj.items || obj.$ref || {}));
Expand Down Expand Up @@ -1383,9 +1383,27 @@ Property.prototype.toString = function() {
if(typeof this.description !== 'undefined')
str += ': ' + this.description;

if (this['enum']) {
str += ' = <span class="propVals">[\'' + this['enum'].join('\' or \'') + '\']</span>';
}
if (this.descr) {
str += ': <span class="propDesc">' + this.descr + '</span>';
}


var options = '';
var isArray = this.schema.type === 'array';
var type = isArray ? this.schema.items.type : this.schema.type;
var type;

if(isArray) {
if(this.schema.items)
type = this.schema.items.type;
else
type = '';
}
else {
this.schema.type;
}

if (this.default)
options += optionHtml('Default', this.default);
Expand Down Expand Up @@ -1973,7 +1991,7 @@ SwaggerModelProperty.prototype.toString = function () {
}
str += ')';
if (this.values) {
str += ' = <span class="propVals">["' + this.values.join('\' or \'') + '\']</span>';
str += ' = <span class="propVals">[\'' + this.values.join('\' or \'') + '\']</span>';
}
if (this.descr) {
str += ': <span class="propDesc">' + this.descr + '</span>';
Expand Down
Loading

0 comments on commit 5ea2860

Please sign in to comment.