#1911 Fixed Missing model name in response section

This commit is contained in:
Anna Bodnia
2016-01-25 18:53:50 +02:00
parent 01085edac1
commit 4f4cddd491
9 changed files with 28 additions and 16 deletions

2
dist/css/print.css vendored
View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #8888ff; color: #88F;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

2
dist/css/screen.css vendored
View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #8888ff; color: #88F;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

14
dist/swagger-ui.js vendored
View File

@@ -25453,7 +25453,8 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
code: code, code: code,
message: value.description, message: value.description,
responseModel: schema, responseModel: schema,
headers: value.headers headers: value.headers,
schema: schemaObj
}); });
} }
} }
@@ -26987,6 +26988,10 @@ SwaggerUi.partials.signature = (function () {
return ' ' + attr.name + '="' + attr.value + '"'; return ' ' + attr.name + '="' + attr.value + '"';
}).join(''); }).join('');
if (!name) {
return getErrorMessage('Node name is not provided');
}
str = [ str = [
'<', name, '<', name,
attributes, attributes,
@@ -27153,8 +27158,9 @@ SwaggerUi.partials.signature = (function () {
return '<!-- Infinite loop $ref:' + name + ' -->'; return '<!-- Infinite loop $ref:' + name + ' -->';
} }
function getErrorMessage () { function getErrorMessage (details) {
return '<!-- invalid XML -->'; details = details ? ': ' + details : '';
return '<!-- invalid XML' + details + ' -->';
} }
function createSchemaXML (name, definition, models, config) { function createSchemaXML (name, definition, models, config) {
@@ -27429,7 +27435,7 @@ SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
if (this.router.api.models.hasOwnProperty(this.model.responseModel)) { if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
var responseModel = { var responseModel = {
sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2), sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2),
sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample(value.definition, value.models) : false, sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample(this.model.schema, value.models) : false,
isParam: false, isParam: false,
signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models), signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models),
defaultRendering: this.model.defaultRendering defaultRendering: this.model.defaultRendering

File diff suppressed because one or more lines are too long

View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #8888ff; color: #88F;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

View File

@@ -82,7 +82,7 @@
.swagger-section pre .vhdl .attribute, .swagger-section pre .vhdl .attribute,
.swagger-section pre .clojure .attribute, .swagger-section pre .clojure .attribute,
.swagger-section pre .coffeescript .property { .swagger-section pre .coffeescript .property {
color: #8888ff; color: #88F;
} }
.swagger-section pre .keyword, .swagger-section pre .keyword,
.swagger-section pre .id, .swagger-section pre .id,

View File

@@ -156,7 +156,8 @@ SwaggerUi.Views.OperationView = Backbone.View.extend({
code: code, code: code,
message: value.description, message: value.description,
responseModel: schema, responseModel: schema,
headers: value.headers headers: value.headers,
schema: schemaObj
}); });
} }
} }

View File

@@ -13,7 +13,7 @@ SwaggerUi.Views.StatusCodeView = Backbone.View.extend({
if (this.router.api.models.hasOwnProperty(this.model.responseModel)) { if (this.router.api.models.hasOwnProperty(this.model.responseModel)) {
var responseModel = { var responseModel = {
sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2), sampleJSON: JSON.stringify(SwaggerUi.partials.signature.createJSONSample(value), void 0, 2),
sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample(value.definition, value.models) : false, sampleXML: this.model.isXML ? SwaggerUi.partials.signature.createXMLSample(this.model.schema, value.models) : false,
isParam: false, isParam: false,
signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models), signature: SwaggerUi.partials.signature.getModelSignature(this.model.responseModel, value, this.router.api.models),
defaultRendering: this.model.defaultRendering defaultRendering: this.model.defaultRendering

View File

@@ -661,6 +661,10 @@ SwaggerUi.partials.signature = (function () {
return ' ' + attr.name + '="' + attr.value + '"'; return ' ' + attr.name + '="' + attr.value + '"';
}).join(''); }).join('');
if (!name) {
return getErrorMessage('Node name is not provided');
}
str = [ str = [
'<', name, '<', name,
attributes, attributes,
@@ -827,8 +831,9 @@ SwaggerUi.partials.signature = (function () {
return '<!-- Infinite loop $ref:' + name + ' -->'; return '<!-- Infinite loop $ref:' + name + ' -->';
} }
function getErrorMessage () { function getErrorMessage (details) {
return '<!-- invalid XML -->'; details = details ? ': ' + details : '';
return '<!-- invalid XML' + details + ' -->';
} }
function createSchemaXML (name, definition, models, config) { function createSchemaXML (name, definition, models, config) {