From 8fc7fb5261b1f15cd8fedaa01913a86c886da030 Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Wed, 30 Aug 2023 17:44:06 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AF=BC=E5=85=A5=E7=9A=84=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E6=96=AD=E8=A8=80=E5=AF=BC=E5=85=A5=E6=95=B0=E7=BB=84=E6=A0=BC?= =?UTF-8?q?=E5=BC=8F=E7=9A=84=E6=95=B0=E6=8D=AE=EF=BC=8C=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E4=B8=8D=E6=98=AF=E4=B8=8B=E6=A0=87=E5=80=BC=E7=9A=84=E7=BC=BA?= =?UTF-8?q?=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1029217 --user=王孝刚 【接口测试】文档断言-导入-字段为数组类型-参数名可编辑 https://www.tapd.cn/55049933/s/1410058 --- .../java/io/metersphere/commons/utils/JSONToDocumentUtil.java | 1 + .../definition/components/assertion/document/DocumentBody.vue | 3 +++ 2 files changed, 4 insertions(+) diff --git a/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java b/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java index 42664566d5..53c8861afa 100644 --- a/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java +++ b/api-test/backend/src/main/java/io/metersphere/commons/utils/JSONToDocumentUtil.java @@ -26,6 +26,7 @@ public class JSONToDocumentUtil { List childrenElements = new LinkedList<>(); DocumentElement documentElement = new DocumentElement(StringUtils.EMPTY, PropertyConstant.ARRAY, StringUtils.EMPTY, childrenElements); documentElement.setArrayVerification(true); + documentElement.setName(String.valueOf(i)); children.add(documentElement); jsonDataFormatting((JSONArray) value, childrenElements); } else { diff --git a/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue b/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue index b861034c78..b6e80b94b6 100644 --- a/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue +++ b/api-test/frontend/src/business/definition/components/assertion/document/DocumentBody.vue @@ -618,6 +618,9 @@ export default { row.type = 'object'; } let newRow = this.getNewRow(); + if (row.type === 'array') { + newRow.name = !this.mapData.get(row.id) ? 0 : this.mapData.get(row.id).length; + } newRow.idList = [row.id, newRow.id]; newRow.parentId = row.id; if (this.mapData.has(row.id)) {