#1248 Returns single item in XML when passing array specification

This commit is contained in:
Anna Bodnia
2016-01-20 11:17:43 +02:00
parent eefa1c8a54
commit 78a09ea16f
4 changed files with 12 additions and 19 deletions

1
dist/swagger-ui.js vendored
View File

@@ -21114,7 +21114,6 @@ SwaggerUi.partials.signature = (function () {
if (!items) { return getErrorMessage(); } if (!items) { return getErrorMessage(); }
value = createSchemaXML(name, items, models); value = createSchemaXML(name, items, models);
value += value;
xml = xml || {}; xml = xml || {};

File diff suppressed because one or more lines are too long

View File

@@ -721,7 +721,6 @@ SwaggerUi.partials.signature = (function () {
if (!items) { return getErrorMessage(); } if (!items) { return getErrorMessage(); }
value = createSchemaXML(name, items, models); value = createSchemaXML(name, items, models);
value += value;
xml = xml || {}; xml = xml || {};

View File

@@ -177,8 +177,8 @@ describe('SwaggerUi.partials.signature tests', function () {
}); });
describe('array', function () { describe('array', function () {
it('returns tag <tagname>string</tagname><tagname>string</tagname> when passing string items', function () { it('returns tag <tagname>string</tagname> when passing string items', function () {
var expected = '<tagname>string</tagname><tagname>string</tagname>'; var expected = '<tagname>string</tagname>';
var name = 'tagname'; var name = 'tagname';
var definition = { var definition = {
type: 'array', type: 'array',
@@ -190,8 +190,8 @@ describe('SwaggerUi.partials.signature tests', function () {
expect(sut.createSchemaXML(name, definition, models)).to.equal(expected); expect(sut.createSchemaXML(name, definition, models)).to.equal(expected);
}); });
it('returns tag <animal>string</animal><animal>string</animal> when passing string items with name', function () { it('returns tag <animal>string</animal> when passing string items with name', function () {
var expected = '<animal>string</animal><animal>string</animal>'; var expected = '<animal>string</animal>';
var name = 'animals'; var name = 'animals';
var definition = { var definition = {
type: 'array', type: 'array',
@@ -206,8 +206,8 @@ describe('SwaggerUi.partials.signature tests', function () {
expect(sut.createSchemaXML(name, definition, models)).to.equal(expected); expect(sut.createSchemaXML(name, definition, models)).to.equal(expected);
}); });
it('returns tag <animals><animal>string</animal><animal>string</animal></animals> when passing string items with name', function () { it('returns tag <animals><animal>string</animal></animals> when passing string items with name', function () {
var expected = '<animals><animal>string</animal><animal>string</animal></animals>'; var expected = '<animals><animal>string</animal></animals>';
var name = 'animals'; var name = 'animals';
var definition = { var definition = {
type: 'array', type: 'array',
@@ -225,8 +225,8 @@ describe('SwaggerUi.partials.signature tests', function () {
expect(sut.createSchemaXML(name, definition, models)).to.equal(expected); expect(sut.createSchemaXML(name, definition, models)).to.equal(expected);
}); });
it('returns tag <aliens><animal>string</animal><animal>string</animal></aliens> when passing string items with name and {wrapped: true}', function () { it('returns tag <aliens><animal>string</animal></aliens> when passing string items with name and {wrapped: true}', function () {
var expected = '<aliens><animal>string</animal><animal>string</animal></aliens>'; var expected = '<aliens><animal>string</animal></aliens>';
var name = 'animals'; var name = 'animals';
var definition = { var definition = {
type: 'array', type: 'array',
@@ -246,7 +246,7 @@ describe('SwaggerUi.partials.signature tests', function () {
}); });
it('return correct nested wrapped array', function () { it('return correct nested wrapped array', function () {
var expected = '<aliens><cat>string</cat><cat>string</cat><cat>string</cat><cat>string</cat></aliens>'; var expected = '<aliens><cat>string</cat></aliens>';
var name = 'animals'; var name = 'animals';
var definition = { var definition = {
type: 'array', type: 'array',
@@ -270,8 +270,7 @@ describe('SwaggerUi.partials.signature tests', function () {
it('return correct nested wrapped array', function () { it('return correct nested wrapped array', function () {
var expected = '<aliens>' + var expected = '<aliens>' +
'<cats><cat>string</cat><cat>string</cat></cats>' + '<cats><cat>string</cat></cats>' +
'<cats><cat>string</cat><cat>string</cat></cats>' +
'</aliens>'; '</aliens>';
var name = 'animals'; var name = 'animals';
var definition = { var definition = {
@@ -326,7 +325,6 @@ describe('SwaggerUi.partials.signature tests', function () {
it('returns object with integer property and array property', function () { it('returns object with integer property and array property', function () {
var expected = '<animals>' + var expected = '<animals>' +
'<aliens>string</aliens>' +
'<aliens>string</aliens>' + '<aliens>string</aliens>' +
'<cat>1</cat>' + '<cat>1</cat>' +
'</animals>'; '</animals>';
@@ -354,7 +352,7 @@ describe('SwaggerUi.partials.signature tests', function () {
it('returns object with integer property and array property', function () { it('returns object with integer property and array property', function () {
var expected = '<animals>' + var expected = '<animals>' +
'<aliens><alien>string</alien><alien>string</alien></aliens>' + '<aliens><alien>string</alien></aliens>' +
'<cat>1</cat>' + '<cat>1</cat>' +
'</animals>'; '</animals>';
var name = 'animals'; var name = 'animals';
@@ -474,7 +472,6 @@ describe('SwaggerUi.partials.signature tests', function () {
it('returns array of Tags wrapped into Tags', function () { it('returns array of Tags wrapped into Tags', function () {
var expected = '<Tags>' + var expected = '<Tags>' +
'<Tag><id>1</id><name>string</name></Tag>' +
'<Tag><id>1</id><name>string</name></Tag>' + '<Tag><id>1</id><name>string</name></Tag>' +
'</Tags>'; '</Tags>';
var schema = { var schema = {
@@ -501,11 +498,9 @@ describe('SwaggerUi.partials.signature tests', function () {
'<name>doggie</name>' + '<name>doggie</name>' +
'<photoUrl>' + '<photoUrl>' +
'<photoUrl>string</photoUrl>' + '<photoUrl>string</photoUrl>' +
'<photoUrl>string</photoUrl>' +
'</photoUrl>' + '</photoUrl>' +
'<tag>' + '<tag>' +
'<Tag><id>1</id><name>string</name></Tag>' + '<Tag><id>1</id><name>string</name></Tag>' +
'<Tag><id>1</id><name>string</name></Tag>' +
'</tag>' + '</tag>' +
'<status>available</status>' + '<status>available</status>' +
'</Pet>'; '</Pet>';