{"record":{"id":"92b96a59444b4780","repo":"Tencent/APIJSON","slug":"value-value-string-sql-jsonobj","errorCode":null,"errorMessage":"{}/{}:value 中 value 必须为 依赖路径String 或 SQL子查询JSONObject ！","messagePattern":"(.+?)/(.+?):value 中 value 必须为 依赖路径String 或 SQL子查询JSONObject ！","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java","lineNumber":534,"sourceCode":"//\t\t\t\t\t//非查询关键词 @key 不影响查询，直接跳过\n//\t\t\t\t\tif (isTable && (key.startsWith(\"@\") == false || apijson.JSONMap.TABLE_KEY_LIST.contains(key))) {\n//\t\t\t\t\t\tLog.e(TAG, \"onParse  isTable && (key.startsWith(@) == false\"\n//\t\t\t\t\t\t\t\t+ \" || apijson.JSONMap.TABLE_KEY_LIST.contains(key)) >>  return null;\");\n//\t\t\t\t\t\treturn false;//获取不到就不用再做无效的query了。不考虑 Table:{Table:{}}嵌套\n//\t\t\t\t\t} else {\n//\t\t\t\t\t\tLog.d(TAG, \"onParse  isTable(table) == false >> return true;\");\n//\t\t\t\t\t\treturn true;//舍去，对Table无影响\n//\t\t\t\t\t}\n//\t\t\t\t}\n\n\t\t\t\t// 直接替换原来的 key@: path 为 key: target\n\t\t\t\tLog.i(TAG, \"onParse    >>  key = replaceKey; value = target;\");\n\t\t\t\tkey = replaceKey;\n\t\t\t\tvalue = target;\n\t\t\t\tLog.d(TAG, \"onParse key = \" + key + \"; value = \" + value);\n\t\t\t}\n\t\t\telse {\n\t\t\t\tthrow new IllegalArgumentException(path + \"/\" + key + \":value 中 value 必须为 依赖路径String 或 SQL子查询JSONObject ！\");\n\t\t\t}\n\t\t}\n\n\t\tif (key.endsWith(\"()\")) {\n\t\t\tif (value instanceof String == false) {\n\t\t\t\tthrow new IllegalArgumentException(path + \"/\" + key + \":value 中 value 必须为函数String！\");\n\t\t\t}\n\n\t\t\tString k = key.substring(0, key.length() - 2);\n\n\t\t\tString type; //远程函数比较少用，一般一个Table:{}内用到也就一两个，所以这里用 \"-\",\"0\",\"+\" 更直观，转用 -1,0,1 对性能提升不大。\n\t\t\tboolean isMinus = k.endsWith(\"-\");\n            boolean isPlus = isMinus == false && k.endsWith(\"+\");\n\t\t\tif (isMinus) { //不能封装到functionMap后批量执行，否则会导致非Table内的 key-():function() 在onChildParse后执行！\n\t\t\t\ttype = \"-\";\n\t\t\t\tk = k.substring(0, k.length() - 1);\n\t\t\t}\n\t\t\telse if (isPlus) {","sourceCodeStart":516,"sourceCodeEnd":552,"githubUrl":"https://github.com/Tencent/APIJSON/blob/5284052872898eddc449a58f629e5c8d588b8e22/APIJSONORM/src/main/java/apijson/orm/AbstractObjectParser.java#L516-L552","documentation":"The 'key@' reference syntax expects its value to be either a String dependency path (e.g. \"/User/userId\") or a JSONObject SQL subquery. This error is thrown in the else branch when the value is any other type — typically a number, boolean, JSONArray, or null.","triggerScenarios":"\"userId@\": 123, \"userId@\": [\"a\",\"b\"], or \"userId@\": true inside any table object. Only String values (path references) and Map values (subqueries with key ending in '{}@' handled earlier) are accepted here.","commonSituations":"Confusing 'key@' (reference/association) with plain 'key' assignment; sending an array expecting IN-behavior (that is 'key{}@' with a subquery, or 'key{}': []); client serializers emitting null for missing values.","solutions":["Use 'key@': \"/Path/to/field\" for path references, or a subquery object for 'key{}@'.","For plain values just drop the '@': \"userId\": 123.","For IN conditions use 'key{}': [...] or a 'key{}@' subquery object instead of an array under 'key@'."],"exampleFix":"// before\n\"Comment\": { \"userId@\": [1, 2] }\n// after\n\"Comment\": { \"userId{}\": [1, 2] }","handlingStrategy":"type-guard","validationCode":"Object v = request.get(key + \"@\");\nif (v != null && !(v instanceof String) && !(v instanceof Map)) {\n  throw new IllegalArgumentException(\"key@ value must be a path String or subquery JSONObject\");\n}","typeGuard":"function isValidRefValue(v: unknown): boolean {\n  return typeof v === 'string' || (v !== null && typeof v === 'object' && !Array.isArray(v));\n}","tryCatchPattern":null,"preventionTips":["Use 'key@' only with \"/path/to/field\" strings or subquery objects.","For plain values drop the '@'; for IN-lists use 'key{}'.","Lint requests for non-string values under keys ending in '@'."],"tags":["apijson","reference","key-at","validation","request-syntax"],"backgroundTag":null,"analyzedSha":"5284052872898eddc449a58f629e5c8d588b8e22","analyzedAt":"2026-08-14T15:15:29.577Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}