fix for #640
This commit is contained in:
30
dist/lib/swagger-client.js
vendored
30
dist/lib/swagger-client.js
vendored
@@ -325,7 +325,6 @@ SwaggerClient.prototype.initialize = function (url, options) {
|
|||||||
|
|
||||||
if (typeof options.success === 'function') {
|
if (typeof options.success === 'function') {
|
||||||
this.build();
|
this.build();
|
||||||
// this.isBuilt = true;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1214,7 +1213,6 @@ Model.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
prop = this.properties[i];
|
prop = this.properties[i];
|
||||||
propertiesStr.push(prop.toString());
|
propertiesStr.push(prop.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
var strong = '<span class="strong">';
|
var strong = '<span class="strong">';
|
||||||
var stronger = '<span class="stronger">';
|
var stronger = '<span class="stronger">';
|
||||||
var strongClose = '</span>';
|
var strongClose = '</span>';
|
||||||
@@ -1326,8 +1324,10 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
|||||||
|
|
||||||
getStringSignature = function(obj) {
|
getStringSignature = function(obj) {
|
||||||
var str = '';
|
var str = '';
|
||||||
if(typeof obj.type === 'undefined')
|
if(typeof obj.$ref !== 'undefined')
|
||||||
str += obj;
|
str += simpleRef(obj.$ref);
|
||||||
|
else if(typeof obj.type === 'undefined')
|
||||||
|
str += 'object';
|
||||||
else if(obj.type === 'array') {
|
else if(obj.type === 'array') {
|
||||||
str += 'Array[';
|
str += 'Array[';
|
||||||
str += getStringSignature((obj.items || obj.$ref || {}));
|
str += getStringSignature((obj.items || obj.$ref || {}));
|
||||||
@@ -1383,9 +1383,27 @@ Property.prototype.toString = function() {
|
|||||||
if(typeof this.description !== 'undefined')
|
if(typeof this.description !== 'undefined')
|
||||||
str += ': ' + this.description;
|
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 options = '';
|
||||||
var isArray = this.schema.type === 'array';
|
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)
|
if (this.default)
|
||||||
options += optionHtml('Default', this.default);
|
options += optionHtml('Default', this.default);
|
||||||
@@ -1973,7 +1991,7 @@ SwaggerModelProperty.prototype.toString = function () {
|
|||||||
}
|
}
|
||||||
str += ')';
|
str += ')';
|
||||||
if (this.values) {
|
if (this.values) {
|
||||||
str += ' = <span class="propVals">["' + this.values.join('\' or \'') + '\']</span>';
|
str += ' = <span class="propVals">[\'' + this.values.join('\' or \'') + '\']</span>';
|
||||||
}
|
}
|
||||||
if (this.descr) {
|
if (this.descr) {
|
||||||
str += ': <span class="propDesc">' + this.descr + '</span>';
|
str += ': <span class="propDesc">' + this.descr + '</span>';
|
||||||
|
|||||||
1140
dist/swagger-ui.js
vendored
1140
dist/swagger-ui.js
vendored
File diff suppressed because it is too large
Load Diff
4
dist/swagger-ui.min.js
vendored
4
dist/swagger-ui.min.js
vendored
File diff suppressed because one or more lines are too long
@@ -325,7 +325,6 @@ SwaggerClient.prototype.initialize = function (url, options) {
|
|||||||
|
|
||||||
if (typeof options.success === 'function') {
|
if (typeof options.success === 'function') {
|
||||||
this.build();
|
this.build();
|
||||||
// this.isBuilt = true;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -1214,7 +1213,6 @@ Model.prototype.getMockSignature = function(modelsToIgnore) {
|
|||||||
prop = this.properties[i];
|
prop = this.properties[i];
|
||||||
propertiesStr.push(prop.toString());
|
propertiesStr.push(prop.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
var strong = '<span class="strong">';
|
var strong = '<span class="strong">';
|
||||||
var stronger = '<span class="stronger">';
|
var stronger = '<span class="stronger">';
|
||||||
var strongClose = '</span>';
|
var strongClose = '</span>';
|
||||||
@@ -1326,8 +1324,10 @@ Property.prototype.sampleValue = function(isArray, ignoredModels) {
|
|||||||
|
|
||||||
getStringSignature = function(obj) {
|
getStringSignature = function(obj) {
|
||||||
var str = '';
|
var str = '';
|
||||||
if(typeof obj.type === 'undefined')
|
if(typeof obj.$ref !== 'undefined')
|
||||||
str += obj;
|
str += simpleRef(obj.$ref);
|
||||||
|
else if(typeof obj.type === 'undefined')
|
||||||
|
str += 'object';
|
||||||
else if(obj.type === 'array') {
|
else if(obj.type === 'array') {
|
||||||
str += 'Array[';
|
str += 'Array[';
|
||||||
str += getStringSignature((obj.items || obj.$ref || {}));
|
str += getStringSignature((obj.items || obj.$ref || {}));
|
||||||
@@ -1383,9 +1383,27 @@ Property.prototype.toString = function() {
|
|||||||
if(typeof this.description !== 'undefined')
|
if(typeof this.description !== 'undefined')
|
||||||
str += ': ' + this.description;
|
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 options = '';
|
||||||
var isArray = this.schema.type === 'array';
|
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)
|
if (this.default)
|
||||||
options += optionHtml('Default', this.default);
|
options += optionHtml('Default', this.default);
|
||||||
@@ -1973,7 +1991,7 @@ SwaggerModelProperty.prototype.toString = function () {
|
|||||||
}
|
}
|
||||||
str += ')';
|
str += ')';
|
||||||
if (this.values) {
|
if (this.values) {
|
||||||
str += ' = <span class="propVals">["' + this.values.join('\' or \'') + '\']</span>';
|
str += ' = <span class="propVals">[\'' + this.values.join('\' or \'') + '\']</span>';
|
||||||
}
|
}
|
||||||
if (this.descr) {
|
if (this.descr) {
|
||||||
str += ': <span class="propDesc">' + this.descr + '</span>';
|
str += ': <span class="propDesc">' + this.descr + '</span>';
|
||||||
|
|||||||
@@ -91,16 +91,14 @@ class OperationView extends Backbone.View
|
|||||||
if typeof @model.responseMessages is 'undefined'
|
if typeof @model.responseMessages is 'undefined'
|
||||||
@model.responseMessages = []
|
@model.responseMessages = []
|
||||||
|
|
||||||
$(@el).html(Handlebars.templates.operation(@model))
|
|
||||||
|
|
||||||
# 2.0
|
# 2.0
|
||||||
signatureModel = null
|
signatureModel = null
|
||||||
if @model.successResponse
|
if @model.successResponse
|
||||||
successResponse = @model.successResponse
|
successResponse = @model.successResponse
|
||||||
for key of successResponse
|
for key of successResponse
|
||||||
value = successResponse[key]
|
value = successResponse[key]
|
||||||
|
@model.successCode = key
|
||||||
if typeof value is 'object' and typeof value.createJSONSample is 'function'
|
if typeof value is 'object' and typeof value.createJSONSample is 'function'
|
||||||
foo = 'bar'
|
|
||||||
signatureModel =
|
signatureModel =
|
||||||
sampleJSON: JSON.stringify(value.createJSONSample(), undefined, 2)
|
sampleJSON: JSON.stringify(value.createJSONSample(), undefined, 2)
|
||||||
isParam: false
|
isParam: false
|
||||||
@@ -112,6 +110,9 @@ class OperationView extends Backbone.View
|
|||||||
isParam: false
|
isParam: false
|
||||||
signature: @model.responseClassSignature
|
signature: @model.responseClassSignature
|
||||||
|
|
||||||
|
|
||||||
|
$(@el).html(Handlebars.templates.operation(@model))
|
||||||
|
|
||||||
if signatureModel
|
if signatureModel
|
||||||
responseSignatureView = new SignatureView({model: signatureModel, tagName: 'div'})
|
responseSignatureView = new SignatureView({model: signatureModel, tagName: 'div'})
|
||||||
$('.model-signature', $(@el)).append responseSignatureView.render().el
|
$('.model-signature', $(@el)).append responseSignatureView.render().el
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{{/oauth}}
|
{{/oauth}}
|
||||||
{{#if type}}
|
{{#if type}}
|
||||||
<h4>Response Class</h4>
|
<h4>Response Class (Status {{successCode}})</h4>
|
||||||
<p><span class="model-signature" /></p>
|
<p><span class="model-signature" /></p>
|
||||||
<br/>
|
<br/>
|
||||||
<div class="response-content-type" />
|
<div class="response-content-type" />
|
||||||
|
|||||||
Reference in New Issue
Block a user