From e0ef45198dc29693ad656ec6188cdd00f95bfedd Mon Sep 17 00:00:00 2001 From: wxg0103 <727495428@qq.com> Date: Fri, 24 Mar 2023 18:57:57 +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=8F=A6=E5=AD=98=E4=B8=BA=E6=96=B0=E7=94=A8?= =?UTF-8?q?=E4=BE=8B=E9=80=A0=E6=88=90=E6=B5=8F=E8=A7=88=E5=99=A8=E6=B2=A1?= =?UTF-8?q?=E5=8F=8D=E5=BA=94=E7=9A=84=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/metersphere/api/exec/generator/TestDataGenerator.java | 4 ++-- .../commons/json-schema/schema/editor/mock/MockComplete.vue | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/api-test/backend/src/main/java/io/metersphere/api/exec/generator/TestDataGenerator.java b/api-test/backend/src/main/java/io/metersphere/api/exec/generator/TestDataGenerator.java index 7be2f2538d..971bba5af0 100644 --- a/api-test/backend/src/main/java/io/metersphere/api/exec/generator/TestDataGenerator.java +++ b/api-test/backend/src/main/java/io/metersphere/api/exec/generator/TestDataGenerator.java @@ -147,7 +147,7 @@ public class TestDataGenerator { if (object.has(MINLENGTH)) { minLength = object.get(MINLENGTH).getAsInt(); } - String value = RandomStringUtils.randomAlphanumeric(minLength, maxLength); + String value = minLength > maxLength ? mockValue.toString() : RandomStringUtils.randomAlphanumeric(minLength, maxLength); Object enumObj = analyzeEnumProperty(object); String v = enumObj == null ? "" : String.valueOf(enumObj); value = StringUtils.isNotBlank(v) ? v : value; @@ -174,7 +174,7 @@ public class TestDataGenerator { } catch (Exception e) { return value; } - } + } public static Object analyzeInteger(JsonObject object) { // 先设置空值 diff --git a/api-test/frontend/src/business/commons/json-schema/schema/editor/mock/MockComplete.vue b/api-test/frontend/src/business/commons/json-schema/schema/editor/mock/MockComplete.vue index 2edda6aa63..ea87ad897e 100644 --- a/api-test/frontend/src/business/commons/json-schema/schema/editor/mock/MockComplete.vue +++ b/api-test/frontend/src/business/commons/json-schema/schema/editor/mock/MockComplete.vue @@ -58,7 +58,7 @@ export default { }; }, watch: { - schema: { + "schema.type": { handler() { this.schema.mock = this.mock; },