Skip to content

Commit 69723b4

Browse files
committed
1 parent 20c815b commit 69723b4

File tree

3 files changed

+611
-591
lines changed

3 files changed

+611
-591
lines changed

lib/swagger-client.js

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,6 @@ SwaggerClient.prototype.initialize = function (url, options) {
325325

326326
if (typeof options.success === 'function') {
327327
this.build();
328-
// this.isBuilt = true;
329328
}
330329
};
331330

@@ -1214,7 +1213,6 @@ Model.prototype.getMockSignature = function(modelsToIgnore) {
12141213
prop = this.properties[i];
12151214
propertiesStr.push(prop.toString());
12161215
}
1217-
12181216
var strong = '<span class="strong">';
12191217
var stronger = '<span class="stronger">';
12201218
var strongClose = '</span>';
@@ -1326,8 +1324,10 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
13261324

13271325
getStringSignature = function(obj) {
13281326
var str = '';
1329-
if(typeof obj.type === 'undefined')
1330-
str += obj;
1327+
if(typeof obj.$ref !== 'undefined')
1328+
str += simpleRef(obj.$ref);
1329+
else if(typeof obj.type === 'undefined')
1330+
str += 'object';
13311331
else if(obj.type === 'array') {
13321332
str += 'Array[';
13331333
str += getStringSignature((obj.items || obj.$ref || {}));
@@ -1383,9 +1383,27 @@ Property.prototype.toString = function() {
13831383
if(typeof this.description !== 'undefined')
13841384
str += ': ' + this.description;
13851385

1386+
if (this['enum']) {
1387+
str += ' = <span class="propVals">[\'' + this['enum'].join('\' or \'') + '\']</span>';
1388+
}
1389+
if (this.descr) {
1390+
str += ': <span class="propDesc">' + this.descr + '</span>';
1391+
}
1392+
1393+
13861394
var options = '';
13871395
var isArray = this.schema.type === 'array';
1388-
var type = isArray ? this.schema.items.type : this.schema.type;
1396+
var type;
1397+
1398+
if(isArray) {
1399+
if(this.schema.items)
1400+
type = this.schema.items.type;
1401+
else
1402+
type = '';
1403+
}
1404+
else {
1405+
this.schema.type;
1406+
}
13891407

13901408
if (this.default)
13911409
options += optionHtml('Default', this.default);
@@ -1973,7 +1991,7 @@ SwaggerModelProperty.prototype.toString = function () {
19731991
}
19741992
str += ')';
19751993
if (this.values) {
1976-
str += ' = <span class="propVals">["' + this.values.join('\' or \'') + '\']</span>';
1994+
str += ' = <span class="propVals">[\'' + this.values.join('\' or \'') + '\']</span>';
19771995
}
19781996
if (this.descr) {
19791997
str += ': <span class="propDesc">' + this.descr + '</span>';

0 commit comments

Comments
 (0)