fix(接口定义): 修复 boolean类型使用json-schema会导致对应boolean类型转换为string
--bug=1007685 --user=赵勇 【github#7448】如果json里面存在boolean类型使用json-schema会导致对应boolean类型转换为string https://www.tapd.cn/55049933/s/1063706
This commit is contained in:
parent
b05b1a5dd3
commit
63f083f9cf
|
@ -155,7 +155,16 @@ public class JSONSchemaGenerator {
|
|||
}
|
||||
if (object.has("mock") && object.get("mock").getAsJsonObject() != null && StringUtils.isNotEmpty(object.get("mock").getAsJsonObject().get("mock").getAsString())) {
|
||||
String value = ScriptEngineUtils.buildFunctionCallString(object.get("mock").getAsJsonObject().get("mock").toString());
|
||||
concept.put(propertyName, value);
|
||||
try {
|
||||
if (StringUtils.isNotEmpty(value)) {
|
||||
if (value.indexOf("\"") != -1) {
|
||||
value = value.replaceAll("\"", "");
|
||||
}
|
||||
concept.put(propertyName, Boolean.valueOf(value));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
concept.put(propertyName, value);
|
||||
}
|
||||
}
|
||||
} else if (propertyObjType.equals("array")) {
|
||||
// 先设置空值
|
||||
|
|
Loading…
Reference in New Issue