fix(接口测试): 修复json-schema转json类型报错的缺陷

--bug=1027618 --user=王孝刚
【接口测试】github#25412,接口测试json请求体使用json-schema格式化之后再关闭schema,请求体内容发生了很奇怪的变化
https://www.tapd.cn/55049933/s/1390774
This commit is contained in:
wxg0103 2023-07-10 14:35:51 +08:00 committed by fit2-zhao
parent 1d1b43b35c
commit 7ec09170a2
2 changed files with 8 additions and 1 deletions

View File

@ -125,7 +125,7 @@ public class JSONSchemaParser {
if (FormatterUtil.isNumber(FormatterUtil.getStrValue(object))) {
String value = FormatterUtil.getElementValue(object).getAsString();
if (value.indexOf(".") == -1) {
concept.put(propertyName, Integer.valueOf(value));
concept.put(propertyName, Long.valueOf(value));
} else {
concept.put(propertyName, new BigDecimal(value));
}

View File

@ -4,6 +4,10 @@ export const jsonParse = (jsonStr) => {
let index = 0;
function parseValue() {
let char = jsonStr[index];
while (char === ' ' || char === '\n') {
index++;
char = jsonStr[index];
}
if (char === '{') {
return parseObject();
} else if (char === '[') {
@ -47,6 +51,9 @@ export const jsonParse = (jsonStr) => {
if (jsonStr[index] === ',') {
index++;
}
while(jsonStr[index] === ' ' || jsonStr[index] === '\n'){
index++;
}
}
index++;
return arr;