fix(接口测试): 修复json和json-schema转换时多层数组结构出现的问题
--bug=1017919 --user=宋天阳 【接口测试】github#18406,JSON格式转JSON SCHEMA时,数组套数组的字段会被错误解析 https://www.tapd.cn/55049933/s/1261426
This commit is contained in:
parent
f743d5be2b
commit
09548e18d1
|
@ -180,11 +180,14 @@ class Convert {
|
||||||
innerItemArr.push(innerArr);
|
innerItemArr.push(innerArr);
|
||||||
});
|
});
|
||||||
} else if (innerIsObject) {
|
} else if (innerIsObject) {
|
||||||
let item = this._value2object(element, `${$id}/items`, key + 'items');
|
//感谢github用户FeatherBlack的贡献
|
||||||
// 判断第一项是否是对象,且对象属性不为空
|
element.forEach(f => {
|
||||||
// 新增的properties才合并进来
|
let item = this._value2object(f, `${$id}/items`, key + 'items');
|
||||||
item = Object.assign(item, this._json2schema(element, `${$id}/items`));
|
// 判断第一项是否是对象,且对象属性不为空
|
||||||
innerItemArr.push(item);
|
// 新增的properties才合并进来
|
||||||
|
item = Object.assign(item, this._json2schema(f, `${$id}/items`));
|
||||||
|
innerItemArr.push(item);
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
element.forEach(f => {
|
element.forEach(f => {
|
||||||
let innerItem = this._value2object(f, `${$id}/items`, key + 'items');
|
let innerItem = this._value2object(f, `${$id}/items`, key + 'items');
|
||||||
|
|
Loading…
Reference in New Issue