describe("simple types with xml property", function () {
it("returns tag <newtagname>string</newtagname> when passing type string and xml:{name: \"newtagname\"}", function () {
var definition = {
let definition = {
type: "string",
xml: {
name: "newtagname"
@@ -530,7 +530,7 @@ describe("createXMLExample", function () {
})
it("returns tag <test:newtagname>string</test:newtagname> when passing type string and xml:{name: \"newtagname\", prefix:\"test\"}", function () {
var definition = {
let definition = {
type: "string",
xml: {
name: "newtagname",
@@ -542,7 +542,7 @@ describe("createXMLExample", function () {
})
it("returns tag <test:tagname xmlns:sample=\"http://swagger.io/schema/sample\">string</test:tagname> when passing type string and xml:{\"namespace\": \"http://swagger.io/schema/sample\", \"prefix\": \"sample\"}", function () {
var definition = {
let definition = {
type: "string",
xml: {
namespace: "http://swagger.io/schema/sample",
@@ -555,7 +555,7 @@ describe("createXMLExample", function () {
})
it("returns tag <test:tagname >string</test:tagname> when passing type string and xml:{\"namespace\": \"http://swagger.io/schema/sample\"}", function () {
var definition = {
let definition = {
type: "string",
xml: {
namespace: "http://swagger.io/schema/sample",
@@ -567,8 +567,8 @@ describe("createXMLExample", function () {
})
it("returns tag <newtagname>test</newtagname> when passing default value", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>test</newtagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>test</newtagname>"
let definition = {
type: "string",
"default": "test",
xml: {
@@ -580,8 +580,8 @@ describe("createXMLExample", function () {
})
it("returns default value when enum provided", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
let definition = {
type: "string",
"default": "one",
"enum": ["two", "one"],
@@ -594,8 +594,8 @@ describe("createXMLExample", function () {
})
it("returns example value when provided", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>two</newtagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>two</newtagname>"
let definition = {
type: "string",
"default": "one",
"example": "two",
@@ -609,8 +609,8 @@ describe("createXMLExample", function () {
})
it("sets first enum if provided", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<newtagname>one</newtagname>"
let definition = {
type: "string",
"enum": ["one", "two"],
xml: {
@@ -624,8 +624,8 @@ describe("createXMLExample", function () {
describe("array", function () {
it("returns tag <tagname>string</tagname> when passing string items", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tagname>string</tagname>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tagname>string</tagname>"
let definition = {
type: "array",
items: {
type: "string"
@@ -639,8 +639,8 @@ describe("createXMLExample", function () {
})
it("returns tag <animal>string</animal> when passing string items with name", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>string</animal>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>string</animal>"
let definition = {
type: "array",
items: {
type: "string",
@@ -657,8 +657,8 @@ describe("createXMLExample", function () {
})
it("returns tag <animals><animal>string</animal></animals> when passing string items with name", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
let definition = {
type: "array",
items: {
type: "string",
@@ -676,8 +676,8 @@ describe("createXMLExample", function () {
})
it("return correct nested wrapped array", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dog>string</dog>\n</aliens>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dog>string</dog>\n</aliens>"
let definition = {
type: "array",
items: {
type: "array",
@@ -698,8 +698,8 @@ describe("createXMLExample", function () {
})
it("return correct nested wrapped array with xml", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dogs>\n\t\t<dog>string</dog>\n\t</dogs>\n</aliens>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<dogs>\n\t\t<dog>string</dog>\n\t</dogs>\n</aliens>"
let definition = {
type: "array",
items: {
type: "array",
@@ -724,8 +724,8 @@ describe("createXMLExample", function () {
})
it("adds namespace to array", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
let definition = {
type: "array",
items: {
type: "string",
@@ -744,8 +744,8 @@ describe("createXMLExample", function () {
})
it("adds prefix to array", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
let definition = {
type: "array",
items: {
type: "string",
@@ -764,8 +764,8 @@ describe("createXMLExample", function () {
})
it("adds prefix to array with no xml in items", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:dog>string</test:dog>"
let definition = {
type: "array",
items: {
type: "string"
@@ -780,8 +780,8 @@ describe("createXMLExample", function () {
})
it("adds namespace to array with no xml in items", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<dog xmlns=\"test\">string</dog>"
let definition = {
type: "array",
items: {
type: "string"
@@ -796,8 +796,8 @@ describe("createXMLExample", function () {
})
it("adds namespace to array with wrapped", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens xmlns=\"test\">\n\t<dog>string</dog>\n</aliens>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens xmlns=\"test\">\n\t<dog>string</dog>\n</aliens>"
let definition = {
type: "array",
items: {
type: "string",
@@ -816,8 +816,8 @@ describe("createXMLExample", function () {
})
it("adds prefix to array with wrapped", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:aliens>\n\t<dog>string</dog>\n</test:aliens>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<test:aliens>\n\t<dog>string</dog>\n</test:aliens>"
let definition = {
type: "array",
items: {
type: "string",
@@ -836,8 +836,8 @@ describe("createXMLExample", function () {
})
it("returns wrapped array when type is not passed", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>string</animal>\n</animals>"
let definition = {
items: {
type: "string",
xml: {
@@ -854,8 +854,8 @@ describe("createXMLExample", function () {
})
it("returns array with default values", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>\n<animal>two</animal>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>\n<animal>two</animal>"
let definition = {
items: {
type: "string",
xml: {
@@ -872,8 +872,8 @@ describe("createXMLExample", function () {
})
it("returns array with default values with wrapped=true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n\t<animal>two</animal>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>one</animal>\n\t<animal>two</animal>\n</animals>"
let definition = {
items: {
type: "string",
xml: {
@@ -891,8 +891,8 @@ describe("createXMLExample", function () {
})
it("returns array with default values", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animal>one</animal>"
let definition = {
items: {
type: "string",
"enum": ["one", "two"],
@@ -909,8 +909,8 @@ describe("createXMLExample", function () {
})
it("returns array with default values with wrapped=true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
let definition = {
items: {
"enum": ["one", "two"],
type: "string",
@@ -929,8 +929,8 @@ describe("createXMLExample", function () {
})
it("returns array with example values with ", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
let definition = {
type: "object",
properties: {
"animal": {
@@ -953,8 +953,8 @@ describe("createXMLExample", function () {
})
it("returns array with example values with wrapped=true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<animal>1</animal>\n\t<animal>2</animal>\n</animals>"
let definition = {
type: "array",
items: {
type: "string",
@@ -973,8 +973,8 @@ describe("createXMLExample", function () {
})
it("returns array of objects with example values with wrapped=true", function () {
var expected = `<?xml version="1.0" encoding="UTF-8"?>\n<users>\n\t<user>\n\t\t<id>1</id>\n\t\t<name>Arthur Dent</name>\n\t</user>\n\t<user>\n\t\t<id>2</id>\n\t\t<name>Ford Prefect</name>\n\t</user>\n</users>`
var definition = {
let expected = `<?xml version="1.0" encoding="UTF-8"?>\n<users>\n\t<user>\n\t\t<id>1</id>\n\t\t<name>Arthur Dent</name>\n\t</user>\n\t<user>\n\t\t<id>2</id>\n\t\t<name>Ford Prefect</name>\n\t</user>\n</users>`
let definition = {
"type": "array",
"items": {
"type": "object",
@@ -1013,8 +1013,8 @@ describe("createXMLExample", function () {
describe("object", function () {
it("returns object with 2 properties", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
let definition = {
type: "object",
properties: {
alien: {
@@ -1033,8 +1033,8 @@ describe("createXMLExample", function () {
})
it("returns object with integer property and array property", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>string</aliens>\n\t<dog>0</dog>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>string</aliens>\n\t<dog>0</dog>\n</animals>"
let definition = {
type: "object",
properties: {
aliens: {
@@ -1056,8 +1056,8 @@ describe("createXMLExample", function () {
})
it("returns nested objects", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>\n\t\t<alien>string</alien>\n\t</aliens>\n\t<dog>string</dog>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<aliens>\n\t\t<alien>string</alien>\n\t</aliens>\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
aliens: {
@@ -1084,8 +1084,8 @@ describe("createXMLExample", function () {
})
it("returns object with no readonly fields for parameter", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1105,8 +1105,8 @@ describe("createXMLExample", function () {
})
it("returns object with readonly fields for parameter, with includeReadOnly", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1126,8 +1126,8 @@ describe("createXMLExample", function () {
})
it("returns object without writeonly fields for parameter", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1147,8 +1147,8 @@ describe("createXMLExample", function () {
})
it("returns object with writeonly fields for parameter, with includeWriteOnly", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<id>0</id>\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1168,8 +1168,8 @@ describe("createXMLExample", function () {
})
it("returns object with passed property as attribute", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals id=\"0\">\n\t<dog>string</dog>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals id=\"0\">\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1191,8 +1191,8 @@ describe("createXMLExample", function () {
})
it("returns object with passed property as attribute with custom name", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals test=\"0\">\n\t<dog>string</dog>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals test=\"0\">\n\t<dog>string</dog>\n</animals>"
let definition = {
type: "object",
properties: {
id: {
@@ -1215,8 +1215,8 @@ describe("createXMLExample", function () {
})
it("returns object with example values in attribute", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"42\">\n\t<role>admin</role>\n</user>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"42\">\n\t<role>admin</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1242,8 +1242,8 @@ describe("createXMLExample", function () {
})
it("returns object with enum values in attribute", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1266,8 +1266,8 @@ describe("createXMLExample", function () {
})
it("returns object with default values in attribute", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1290,8 +1290,8 @@ describe("createXMLExample", function () {
})
it("returns object with default values in attribute", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user id=\"one\">\n\t<role>string</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1314,8 +1314,8 @@ describe("createXMLExample", function () {
})
it("returns object with example value", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n\t<id>42</id>\n\t<role>admin</role>\n</user>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<user>\n\t<id>42</id>\n\t<role>admin</role>\n</user>"
let definition = {
type: "object",
properties: {
id: {
@@ -1338,8 +1338,8 @@ describe("createXMLExample", function () {
})
it("returns object with additional props", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>string</additionalProp>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>string</additionalProp>\n</animals>"
let definition = {
type: "object",
properties: {
dog: {
@@ -1358,8 +1358,8 @@ describe("createXMLExample", function () {
})
it("returns object with additional props =true", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>Anything can be here</additionalProp>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<dog>string</dog>\n\t<additionalProp>Anything can be here</additionalProp>\n</animals>"
let definition = {
type: "object",
properties: {
dog: {
@@ -1376,8 +1376,8 @@ describe("createXMLExample", function () {
})
it("returns object with 2 properties with no type passed but properties", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<aliens>\n\t<alien>string</alien>\n\t<dog>0</dog>\n</aliens>"
let definition = {
properties: {
alien: {
type: "string"
@@ -1395,8 +1395,8 @@ describe("createXMLExample", function () {
})
it("returns object with additional props with no type passed", function () {
var expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<additionalProp>string</additionalProp>\n</animals>"
var definition = {
let expected = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<animals>\n\t<additionalProp>string</additionalProp>\n</animals>"