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);
|
||||
});
|
||||
} else if (innerIsObject) {
|
||||
let item = this._value2object(element, `${$id}/items`, key + 'items');
|
||||
// 判断第一项是否是对象,且对象属性不为空
|
||||
// 新增的properties才合并进来
|
||||
item = Object.assign(item, this._json2schema(element, `${$id}/items`));
|
||||
innerItemArr.push(item);
|
||||
//感谢github用户FeatherBlack的贡献
|
||||
element.forEach(f => {
|
||||
let item = this._value2object(f, `${$id}/items`, key + 'items');
|
||||
// 判断第一项是否是对象,且对象属性不为空
|
||||
// 新增的properties才合并进来
|
||||
item = Object.assign(item, this._json2schema(f, `${$id}/items`));
|
||||
innerItemArr.push(item);
|
||||
})
|
||||
} else {
|
||||
element.forEach(f => {
|
||||
let innerItem = this._value2object(f, `${$id}/items`, key + 'items');
|
||||
|
|
Loading…
Reference in New Issue