diff --git a/src/core/plugins/samples/fn.js b/src/core/plugins/samples/fn.js
index 068f89f31a3..24298ab566f 100644
--- a/src/core/plugins/samples/fn.js
+++ b/src/core/plugins/samples/fn.js
@@ -234,7 +234,7 @@ export const sampleXmlFromSchema = (schema, config={}) => {
if (additionalProperties) {
value = additionalProperties === true || !Object.getOwnPropertyNames(additionalProperties).length ? "Anything can be here" : primitive(additionalProperties)
- value = (additionalProperties.xml || xml || {}).CDATA ? {_cdata: value} : value
+ value = (additionalProperties.xml || xml || {})['x-cdata'] ? {_cdata: value} : value
res[displayName].push({additionalProp: value})
}
@@ -257,7 +257,7 @@ export const sampleXmlFromSchema = (schema, config={}) => {
value = primitive(schema)
}
- res[displayName] = _attr ? xml.CDATA ? {_attr: _attr, _cdata: value} : [{_attr: _attr}, value] : value
+ res[displayName] = _attr ? xml['x-cdata'] ? {_attr: _attr, _cdata: value} : [{_attr: _attr}, value] : value
return res
}
diff --git a/test/core/plugins/samples/fn.js b/test/core/plugins/samples/fn.js
index bbf25b62b04..e7a14e30ebb 100644
--- a/test/core/plugins/samples/fn.js
+++ b/test/core/plugins/samples/fn.js
@@ -539,13 +539,13 @@ describe("createXMLExample", function () {
expect(sut(definition)).toEqual(expected)
})
- it("returns value wrapped by `CDATA` when passing {CDATA: true}", function () {
+ it("returns value wrapped by `CDATA` when passing {'x-cdata': true}", function () {
var expected = "\n"
var definition = {
type: "string",
example: "foo&bar 1<2",
xml: {
- CDATA: true
+ 'x-cdata': true
}
}
@@ -916,14 +916,14 @@ describe("createXMLExample", function () {
expect(sut(definition)).toEqual(expected)
})
- it("returns array with example values wrapped by `CDATA` when passing {CDATA: true}", function () {
+ it("returns array with example values wrapped by `CDATA` when passing {'x-cdata': true}", function () {
var expected = "\n\n\t\n\t\n"
var definition = {
type: "array",
items: {
type: "string",
xml: {
- CDATA: true,
+ 'x-cdata': true,
name: "animal"
}
},
@@ -1335,7 +1335,7 @@ describe("createXMLExample", function () {
expect(sut(definition)).toEqual(expected)
})
- it("returns object with example value wrapped by `CDATA` when passing {CDATA: true}", function () {
+ it("returns object with example value wrapped by `CDATA` when passing {'x-cdata': true}", function () {
var expected = "\n\n\t\n\t\n"
var definition = {
type: "object",
@@ -1343,13 +1343,13 @@ describe("createXMLExample", function () {
foo: {
type: "string",
xml: {
- CDATA: true
+ 'x-cdata': true
}
},
bar:{
type: "string",
xml: {
- CDATA: true
+ 'x-cdata': true
}
}
},
@@ -1365,20 +1365,20 @@ describe("createXMLExample", function () {
expect(sut(definition)).toEqual(expected)
})
- it("returns object with 2 properties those values wrapped by `CDATA` when passing {CDATA: true}", function () {
+ it("returns object with 2 properties those values wrapped by `CDATA` when passing {'x-cdata': true}", function () {
var expected = "\n\n\t\n\t\n"
var definition = {
properties: {
foo: {
type: "string",
xml: {
- CDATA: true
+ 'x-cdata': true
}
},
bar: {
type: "string",
xml: {
- CDATA: true
+ 'x-cdata': true
}
}
},
@@ -1390,27 +1390,27 @@ describe("createXMLExample", function () {
expect(sut(definition)).toEqual(expected)
})
- it("returns object with additional props equals `true` and those values wrapped by `CDATA` when the defs passing {CDATA: true}", function () {
+ it("returns object with additional props equals `true` and those values wrapped by `CDATA` when the defs passing {'x-cdata': true}", function () {
var expected = "\n\n\t\n"
var definition = {
additionalProperties: true,
xml: {
name: "animals",
wrapped: true,
- CDATA: true
+ 'x-cdata': true
}
}
expect(sut(definition)).toEqual(expected)
})
- it("returns object with additional props those values wrapped by `CDATA` when passing {CDATA: true}", function () {
+ it("returns object with additional props those values wrapped by `CDATA` when passing {'x-cdata': true}", function () {
var expected = "\n\n\t\n"
var definition = {
additionalProperties: {
type: "string",
xml: {
- CDATA: true
+ 'x-cdata': true
}
},
xml: {