Merge branch 'master' of github.com:swagger-api/swagger-ui into ft/linting-and-testing

This commit is contained in:
Kyle Shockey
2017-03-23 16:43:37 -07:00
5 changed files with 72 additions and 8 deletions

View File

@@ -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)
}
}
}
}