From 4e384680ff8f8f82851c670cab0d4c96b2946098 Mon Sep 17 00:00:00 2001 From: fit2-zhao Date: Fri, 10 Dec 2021 13:19:28 +0800 Subject: [PATCH] =?UTF-8?q?fix=20(=E6=8E=A5=E5=8F=A3=E6=B5=8B=E8=AF=95):?= =?UTF-8?q?=20=E4=BF=AE=E5=A4=8D=E8=AF=B7=E6=B1=82=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E6=95=B0=E5=AD=97=E7=B1=BB=E5=9E=8B=E8=BD=AC=E6=8D=A2=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1008475 --user=赵勇 【github#8035】当接口请求中存在一个数字超出integer范围时,会被转换为字符串的形式,不支持大数 https://www.tapd.cn/55049933/s/1079557 --- .../java/io/metersphere/commons/json/JSONSchemaGenerator.java | 2 +- .../java/io/metersphere/commons/json/JSONSchemaRunTest.java | 2 +- 2 files changed, 2 insertions(+), 2 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 fd423fb09d..dccdf3008d 100644 --- a/backend/src/main/java/io/metersphere/commons/json/JSONSchemaGenerator.java +++ b/backend/src/main/java/io/metersphere/commons/json/JSONSchemaGenerator.java @@ -139,7 +139,7 @@ public class JSONSchemaGenerator { try { Number value = object.get("mock").getAsJsonObject().get("mock").getAsNumber(); if (value.toString().indexOf(".") == -1) { - concept.put(propertyName, value.intValue()); + concept.put(propertyName, value.longValue()); } else { concept.put(propertyName, value.floatValue()); } diff --git a/backend/src/main/java/io/metersphere/commons/json/JSONSchemaRunTest.java b/backend/src/main/java/io/metersphere/commons/json/JSONSchemaRunTest.java index 25cfc4e82f..c67f1356ab 100644 --- a/backend/src/main/java/io/metersphere/commons/json/JSONSchemaRunTest.java +++ b/backend/src/main/java/io/metersphere/commons/json/JSONSchemaRunTest.java @@ -88,7 +88,7 @@ public class JSONSchemaRunTest { if (object.has("mock") && object.get("mock").getAsJsonObject() != null && StringUtils.isNotEmpty(object.get("mock").getAsJsonObject().get("mock").getAsString())) { Number value = object.get("mock").getAsJsonObject().get("mock").getAsNumber(); if (value.toString().indexOf(".") == -1) { - concept.put(propertyName, value.intValue()); + concept.put(propertyName, value.longValue()); } else { concept.put(propertyName, value.floatValue()); }