From aca1102ca7d1483de8c385b203c1c6e4a680bfd6 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Sat, 2 Apr 2022 17:14:55 +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=E6=8E=A5=E5=8F=A3json=E8=AF=B7=E6=B1=82?= =?UTF-8?q?=E4=BD=93=E9=87=8C=E4=BD=BF=E7=94=A8=E5=87=BD=E6=95=B0=E4=B8=8D?= =?UTF-8?q?=E7=94=9F=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1011871 --user=赵勇 【接口测试】github#12203,有的接口json请求体里使用函数不生效 https://www.tapd.cn/55049933/s/1129643 --- .../src/main/java/io/metersphere/api/dto/scenario/Body.java | 3 ++- .../components/common/json-schema/schema/editor/main.vue | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java index ddeb5d9698..7bab3ae75f 100644 --- a/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java +++ b/backend/src/main/java/io/metersphere/api/dto/scenario/Body.java @@ -2,6 +2,7 @@ package io.metersphere.api.dto.scenario; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.alibaba.fastjson.parser.Feature; import com.alibaba.fastjson.serializer.SerializerFeature; import io.metersphere.api.dto.scenario.request.BodyFile; import io.metersphere.commons.json.JSONSchemaRunTest; @@ -96,7 +97,7 @@ public class Body { } else { try { if (StringUtils.isNotEmpty(this.getRaw())) { - JSONObject jsonObject = JSON.parseObject(this.getRaw()); + JSONObject jsonObject = JSON.parseObject(this.getRaw(), Feature.OrderedField); if (!this.getRaw().contains("$ref")) { jsonMockParse(jsonObject); } diff --git a/frontend/src/business/components/common/json-schema/schema/editor/main.vue b/frontend/src/business/components/common/json-schema/schema/editor/main.vue index ce36842790..936028acb4 100644 --- a/frontend/src/business/components/common/json-schema/schema/editor/main.vue +++ b/frontend/src/business/components/common/json-schema/schema/editor/main.vue @@ -207,7 +207,7 @@ export default { }, created() { if (this.pickValue) { - this.hidden = this.pickValue.hidden; + this.hidden = this.root ? false : this.pickValue.hidden; } }, methods: {