Tencent/APIJSON · error · UnsupportedOperationException

@raw:value 中 {} 不合法!@raw 不支持 key$ 这种功能符 !只支持 key, key!, key<

Error message

@raw:value 中 {} 不合法!@raw 不支持 key$ 这种功能符 !只支持 key, key!, key<, key{} 等比较运算 和 @column, @having !

What it means

Thrown by gainSearchString when @raw is applied to a key with the '$' search suffix. @raw only supports plain comparison keys (key, key!, key<, key{}, etc.) and @column/@having; the fuzzy-search operator key$ requires the library to build LIKE patterns itself and cannot be mixed with raw SQL.

Source

Thrown at APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java:4183

	}
	@Override
	public AbstractSQLConfig<T, M, L> setPreparedValueList(List<Object> preparedValueList) {
		this.preparedValueList = preparedValueList;
		return this;
	}

	//$ search <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
	/**search key match value
	* @param key
	* @param column
	* @param value
	* @param rawSQL
	* @return {@link #gainSearchString(String, String, Object[], int)}
	* @throws IllegalArgumentException
	*/
	public String gainSearchString(String key, String column, Object value, String rawSQL) throws IllegalArgumentException {
		if (rawSQL != null) {
			throw new UnsupportedOperationException("@raw:value 中 "
					+ key + " 不合法!@raw 不支持 key$ 这种功能符 !只支持 key, key!, key<, key{} 等比较运算 和 @column, @having !");
		}
		if (value == null) {
			return "";
		}

		Logic logic = new Logic(column);
		column = logic.getKey();
		Log.i(TAG, "getSearchString column = " + column);

		List<Object> arr = newJSONArray(value);
		if (arr.isEmpty()) {
			return "";
		}
		return gainSearchString(key, column, arr.toArray(), logic.getType());
	}
	/**search key match values
	* @param key

View on GitHub (pinned to 5284052872)

Solutions

  1. Remove the key$ entry from @raw and use plain key$ with a normal search string so APIJSON builds the LIKE itself.
  2. If a custom expression is required, put it in @column/@having where @raw is supported.
  3. Check the @raw list for stale key names after refactoring request bodies.

Example fix

// before
{"User": {"name$": "%a%", "@raw": "name$"}}
// after
{"User": {"name$": "%a%"}}
Defensive patterns

Strategy: validation

Validate before calling

const raw = req[table]['@raw'];
if (raw) {
  const list = Array.isArray(raw) ? raw : Object.keys(raw);
  const bad = list.filter(k => k.endsWith('$'));
  if (bad.length) throw new Error('@raw does not support key$ : ' + bad.join(','));
}

Prevention

When it happens

Trigger: A request with "@raw": ["name$"] (or a raw map naming a key$) together with "name$": "%a%" — asking APIJSON to treat the search operator's value as raw SQL.

Common situations: Developers trying to inject a custom LIKE/REGEXP expression via @raw on the search key instead of using key$ normally or moving the expression into @column/@having.

Related errors


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