fix(接口测试): 修复文档断言数组结构的数据,拿不到下标值的缺陷

--bug=1028311 --user=王孝刚 【接口测试】文档断言-导入-修改字段类型和条件不生效
https://www.tapd.cn/55049933/s/1402901
This commit is contained in:
wxg0103 2023-08-14 14:03:17 +08:00 committed by fit2-zhao
parent 2ccd543d06
commit 69e6f0fe62
1 changed files with 1 additions and 1 deletions

View File

@ -89,7 +89,7 @@ public class Document {
if (StringUtils.isEmpty(item.getGroupId())) { if (StringUtils.isEmpty(item.getGroupId())) {
if (!item.getId().equals(PropertyConstant.ROOT)) { if (!item.getId().equals(PropertyConstant.ROOT)) {
if (parentNode != null) { if (parentNode != null) {
if (parentNode.getType().equals(PropertyConstant.ARRAY) && StringUtils.equalsAnyIgnoreCase(item.getType(), PropertyConstant.STRING, PropertyConstant.INTEGER)) { if (parentNode.getType().equals(PropertyConstant.ARRAY)) {
try { try {
int index = StringUtils.isNotEmpty(item.getName()) ? Integer.parseInt(item.getName()) : i; int index = StringUtils.isNotEmpty(item.getName()) ? Integer.parseInt(item.getName()) : i;
item.setJsonPath(parentNode.getJsonPath() + "[" + index + "]"); item.setJsonPath(parentNode.getJsonPath() + "[" + index + "]");