fix(接口测试): 修复JSON-SCHEMA转化数组格式数据时出错的问题

--bug=1010076 --user=宋天阳 【接口测试】json请求体里带数组,开启json-schema数组内容会消失
https://www.tapd.cn/55049933/s/1100348
This commit is contained in:
song-tianyang 2022-01-28 14:48:01 +08:00 committed by fit2-zhao
parent a511362258
commit 4766fa8b4c
1 changed files with 2 additions and 3 deletions

View File

@ -127,10 +127,9 @@ class Convert {
if (isArray(elementItem)) { if (isArray(elementItem)) {
let innerItemArr = this._deepTraversal(elementItem, `${$id}/items`, key + 'items'); let innerItemArr = this._deepTraversal(elementItem, `${$id}/items`, key + 'items');
itemArr.push(innerItemArr); itemArr.push(innerItemArr);
} else if (isObject(elementItem) && !isEmpty(elementItem)) { }else {
//item不是Array进行统一处理
let item = this._value2object(elementItem, `${$id}/items`, key + 'items'); let item = this._value2object(elementItem, `${$id}/items`, key + 'items');
// 判断第一项是否是对象,且对象属性不为空
// 新增的properties才合并进来
item = Object.assign(item, this._json2schema(elementItem, `${$id}/items`)); item = Object.assign(item, this._json2schema(elementItem, `${$id}/items`));
itemArr.push(item); itemArr.push(item);
} }