fix(xml): example generation if an array has an example (#6634)

ref: #6627
This commit is contained in:
Tim Lai
2020-11-18 15:19:52 -08:00
committed by GitHub
parent d7c97404c1
commit 24225e47bf
3 changed files with 56 additions and 0 deletions

View File

@@ -202,6 +202,10 @@ export const sampleFromSchemaGeneric = (schema, config={}, exampleOverride = und
if (schema && props[propName] && props[propName].writeOnly && !includeWriteOnly) {
continue
}
if (schema && props[propName] && props[propName].xml && props[propName].xml.attribute && !(example && example[propName])) {
_attr[props[propName].xml.name || propName] = sample[propName]
continue
}
if (schema && props[propName] && props[propName].xml && props[propName].xml.attribute) {
_attr[props[propName].xml.name || propName] = example[propName]
continue