From 75f46c6c668a764c8382df31ed0524ec45c4b68e Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Tue, 11 May 2021 16:23:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9C=BA=E6=99=AF=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8C=96):=20=E4=BF=AE=E5=A4=8DJSONSchema=20integer=E5=8F=96?= =?UTF-8?q?=E5=80=BC=E9=97=AE=E9=A2=98=EF=BC=9B=E4=BC=98=E5=8C=96=E6=AD=A5?= =?UTF-8?q?=E9=AA=A4=E5=88=A0=E9=99=A4=E6=97=B6=E6=8A=96=E5=8A=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/commons/json/JSONSchemaGenerator.java | 9 +++++++-- .../api/automation/scenario/EditApiScenario.vue | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/backend/src/main/java/io/metersphere/commons/json/JSONSchemaGenerator.java b/backend/src/main/java/io/metersphere/commons/json/JSONSchemaGenerator.java index e9fbf06ba3..9c9321abb0 100644 --- a/backend/src/main/java/io/metersphere/commons/json/JSONSchemaGenerator.java +++ b/backend/src/main/java/io/metersphere/commons/json/JSONSchemaGenerator.java @@ -150,8 +150,13 @@ public class JSONSchemaGenerator { concept.put(propertyName, object.get("default")); } if (object.has("mock") && object.get("mock").getAsJsonObject() != null && StringUtils.isNotEmpty(object.get("mock").getAsJsonObject().get("mock").getAsString())) { - String value = ScriptEngineUtils.calculate(object.get("mock").getAsJsonObject().get("mock").toString()); - concept.put(propertyName, value); + try { + int value = object.get("mock").getAsJsonObject().get("mock").getAsInt(); + concept.put(propertyName, value); + } catch (Exception e) { + String value = ScriptEngineUtils.calculate(object.get("mock").getAsJsonObject().get("mock").getAsString()); + concept.put(propertyName, value); + } } if (object.has("multipleOf")) { diff --git a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue index e1eb4c14d8..5e01f4cdaa 100644 --- a/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue +++ b/frontend/src/business/components/api/automation/scenario/EditApiScenario.vue @@ -621,7 +621,6 @@ recursiveSorting(arr, scenarioProjectId) { for (let i in arr) { arr[i].index = Number(i) + 1; - arr[i].active = this.expandedStatus; if (arr[i].type === ELEMENT_TYPE.LoopController && arr[i].loopType === "LOOP_COUNT" && arr[i].hashTree && arr[i].hashTree.length > 1) { arr[i].countController.proceed = true; } @@ -648,7 +647,6 @@ for (let i in this.scenarioDefinition) { // 排序 this.scenarioDefinition[i].index = Number(i) + 1; - this.scenarioDefinition[i].active = this.expandedStatus; // 设置循环控制 if (this.scenarioDefinition[i].type === ELEMENT_TYPE.LoopController && this.scenarioDefinition[i].hashTree && this.scenarioDefinition[i].hashTree.length > 1) {