fixes for XML render
This commit is contained in:
@@ -127,8 +127,12 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
|
||||
if (xml.wrapped) {
|
||||
res[displayName] = []
|
||||
if (Array.isArray(defaultValue)) {
|
||||
|
||||
if (Array.isArray(example)) {
|
||||
example.forEach((v)=>{
|
||||
items.example = v
|
||||
res[displayName].push(sampleXmlFromSchema(items, config))
|
||||
})
|
||||
} else if (Array.isArray(defaultValue)) {
|
||||
defaultValue.forEach((v)=>{
|
||||
items.default = v
|
||||
res[displayName].push(sampleXmlFromSchema(items, config))
|
||||
@@ -145,14 +149,20 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
|
||||
let _res = []
|
||||
|
||||
if (Array.isArray(defaultValue)) {
|
||||
if (Array.isArray(example)) {
|
||||
example.forEach((v)=>{
|
||||
items.example = v
|
||||
_res.push(sampleXmlFromSchema(items, config))
|
||||
})
|
||||
return _res
|
||||
} else if (Array.isArray(defaultValue)) {
|
||||
defaultValue.forEach((v)=>{
|
||||
items.default = v
|
||||
_res.push(sampleXmlFromSchema(items, config))
|
||||
})
|
||||
return _res
|
||||
|
||||
}
|
||||
|
||||
return sampleXmlFromSchema(items, config)
|
||||
}
|
||||
}
|
||||
@@ -176,7 +186,13 @@ export const sampleXmlFromSchema = (schema, config={}) => {
|
||||
} else {
|
||||
props[propName].xml.name = props[propName].xml.name || propName
|
||||
props[propName].example = props[propName].example !== undefined ? props[propName].example : example[propName]
|
||||
res[displayName].push(sampleXmlFromSchema(props[propName]))
|
||||
let t = sampleXmlFromSchema(props[propName])
|
||||
if (Array.isArray(t)) {
|
||||
res[displayName] = res[displayName].concat(t)
|
||||
} else {
|
||||
res[displayName].push(t)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user