@@ -118,7 +118,7 @@ public JSONObject onParseJSONObject(String key, JSONObject tobj, JSONObject robj
118118 });
119119
120120 }
121-
121+
122122 /**
123123 * @param method
124124 * @param name
@@ -137,10 +137,10 @@ private static void verifyId(@NotNull String method, @NotNull String name, @NotN
137137 throw new IllegalArgumentException (method + "请求," + name + "/" + key
138138 + " 里面的 " + idKey + ":value 中value的类型只能是 Long !" );
139139 }
140-
140+
141141 //批量修改或删除
142142 String idInKey = idKey + "{}" ;
143-
143+
144144 JSONArray idIn = null ;
145145 try {
146146 idIn = robj .getJSONArray (idInKey ); //如果必须传 id{} ,可在Request表中配置NECESSARY
@@ -172,7 +172,7 @@ private static void verifyId(@NotNull String method, @NotNull String name, @NotN
172172 }
173173
174174
175-
175+
176176 /**校验并将response转换为指定的内容和结构
177177 * @param method
178178 * @param name
@@ -444,7 +444,7 @@ private static void type(@NotNull String tk, Object tv, @NotNull JSONObject real
444444 if (rv == null ) {
445445 return ;
446446 }
447-
447+
448448 switch (t ) {
449449 case "Boolean" :
450450 //Boolean.parseBoolean(real.getString(tk)); 只会判断null和true
@@ -481,6 +481,15 @@ private static void type(@NotNull String tk, Object tv, @NotNull JSONObject real
481481 throw new UnsupportedDataTypeException (tk + ":value 的value不合法!类型必须是 [Array] !" );
482482 }
483483 break ;
484+ //目前在业务表中还用不上,单一的类型校验已经够用
485+ // case "JSON":
486+ // try {
487+ // com.alibaba.fastjson.JSON.parse(rv.toString());
488+ // } catch (Exception e) {
489+ // throw new UnsupportedDataTypeException(tk + ":value 的value不合法!类型必须是 JSON !"
490+ // + "也就是 {Object}, [Array] 或 它们对应的字符串 '{Object}', '[Array]' 4种中的一个 !");
491+ // }
492+ // break;
484493 default :
485494 throw new UnsupportedDataTypeException ("服务器内部错误,类型 " + t + " 不合法!Request表校验规则中"
486495 + " TYPE:{ key:value } 中的value类型必须是 [Boolean, Long, Double, String, Object, Array] 中的一个!" );
0 commit comments