Tencent/APIJSON · error · UnsupportedOperationException

joinType + "/.../" + table + "/" + originKey + " 中字符 " + k +

Error message

joinType + "/.../" + table + "/" + originKey + " 中字符 " + k + " 不合法!与或非逻辑符仅支持 '!' 非逻辑符 !

What it means

After operator suffixes are stripped, the remaining join key k must not contain '&' or '|'. In normal where conditions APIJSON supports key&{} / key|{} combining logic, but inside a @join reference map only the negation prefix '!' is implemented, so any other logic operator in a join key throws UnsupportedOperationException ('与或非逻辑符仅支持 ! 非逻辑符').

Source

Thrown at APIJSONORM/src/main/java/apijson/orm/Join.java:340

			else if (originKey.endsWith("<=")) {
				setRelateType("<=");
				k = originKey.substring(0, originKey.length() - 2);
			}
			else if (originKey.endsWith(">")) {
				setRelateType(">");
				k = originKey.substring(0, originKey.length() - 1);
			}
			else if (originKey.endsWith("<")) {
				setRelateType("<");
				k = originKey.substring(0, originKey.length() - 1);
			}
			else {
				setRelateType("");
				k = originKey;
			}

			if (k != null && (k.contains("&") || k.contains("|"))) {
				throw new UnsupportedOperationException(joinType + "/.../" + table + "/" + originKey + " 中字符 " + k + " 不合法!与或非逻辑符仅支持 '!' 非逻辑符 !");
			}

			//TODO if (c3 == '-') { // 表示 key 和 value 顺序反过来: value LIKE key

			Logic l = new Logic(k);
			setLogic(l);

			if (StringUtil.isName(l.getKey()) == false) {
				throw new IllegalArgumentException(joinType + "/.../" + table + "/" + originKey + " 中字符 " + l.getKey() + " 不合法!必须符合字段命名格式!");
			}

			setKey(l.getKey());
		}

  }

}

View on GitHub (pinned to 5284052872)

Solutions

  1. Remove & / | from join keys; express the OR condition on the main table object instead of inside the join reference.
  2. Use '!' negation where applicable: "key!@" is supported inside join maps.
  3. If you need OR across joined fields, issue two requests or use a server-side custom SQL/service (SQLConfig custom) — join keys cannot carry & / |.

Example fix

// before
"join":"/User/id@",
"User":{"id@":"/Moment/userId","name|{}@":"/Moment/tags"}  // '|' rejected
// after
"join":"/User/id@",
"User":{"id@":"/Moment/userId"}  // move OR condition elsewhere, e.g.
// "Moment":{"tag|{}":["a","b"]} on the main table
Defensive patterns

Strategy: validation

Validate before calling

for (String k : joinObj.keySet()) {
  String bare = k.replaceAll("(\\{\\}|\\[\\]|<>|\\$|\\*?~|>=|<=|>|<|\?|%)$", "");
  if (bare.contains("&") || bare.contains("|"))
    throw new IllegalArgumentException("join key '" + k + "': only '!' logic is supported in join maps");
}

Type guard

function isJoinKeyLogicFree(k) { const bare = k.replace(/[\{\}\[\]<>$~%_?|&>=!*]+$/, ''); return !/[&|]/.test(bare) || bare.startsWith('!'); }

Prevention

When it happens

Trigger: A join table object uses a key like "tag|{}@":"/Moment/tagList" or "a&{}@":... — i.e. & or | logic inside the join field key. The check k.contains("&") || k.contains("|") runs after relate-type parsing, before Logic wrapping, and throws.

Common situations: Copy-pasting a working top-level condition key (e.g. 'id|{}') into a joined table's object expecting the same semantics; trying to express OR-match against the referenced field; upgrading from a version that silently ignored such keys.

Related errors


AI-assisted analysis of Tencent/APIJSON@5284052872 (2026-08-14). Data as JSON: /api/errors/16508f6e3c2193cc. Report an issue: GitHub.