{"record":{"id":"f1127405a2cbab5c","repo":"Tencent/APIJSON","slug":"abstractverifier-enable-verify-content-false","errorCode":null,"errorMessage":"AbstractVerifier.ENABLE_VERIFY_CONTENT == false 时不支持校验请求传参内容！如需支持则设置 AbstractVerifier.ENABLE_VERIFY_CONTENT = true ！","messagePattern":"AbstractVerifier\\.ENABLE_VERIFY_CONTENT == false 时不支持校验请求传参内容！如需支持则设置 AbstractVerifier\\.ENABLE_VERIFY_CONTENT = true ！","errorType":"exception","errorClass":"UnsupportedOperationException","httpStatus":null,"severity":"error","filePath":"APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java","lineNumber":642,"sourceCode":"\t * @param datasource\n\t * @param namespace\n\t * @param catalog\n\t * @param schema\n\t * @param idCallback\n\t * @param parser\n\t * @return\n\t * @param <T>\n\t * @param <M>\n\t * @param <L>\n\t * @throws Exception\n\t */\n\tpublic static <T, M extends Map<String, Object>, L extends List<Object>> M verifyRequest(\n\t\t\t@NotNull final RequestMethod method, final String name, final M target, final M request\n            , final int maxUpdateCount, final String database, final String datasource, final String namespace\n\t\t\t, final String catalog, final String schema, final IdCallback<T> idCallback\n\t\t\t, @NotNull Parser<T, M, L> parser) throws Exception {\n\t\tif (ENABLE_VERIFY_CONTENT == false) {\n\t\t\tthrow new UnsupportedOperationException(\"AbstractVerifier.ENABLE_VERIFY_CONTENT == false\" +\n                    \" 时不支持校验请求传参内容！如需支持则设置 AbstractVerifier.ENABLE_VERIFY_CONTENT = true ！\");\n\t\t}\n\n\t\tLog.i(TAG, \"verifyRequest  method = \" + method  + \"; name = \" + name\n\t\t\t\t+ \"; target = \\n\" + toJSONString(target)\n\t\t\t\t+ \"\\n request = \\n\" + toJSONString(request));\n\n\t\tif (target == null || request == null) {// || request.isEmpty()) {\n\t\t\tLog.i(TAG, \"verifyRequest  target == null || request == null >> return null;\");\n\t\t\treturn null;\n\t\t}\n\n\t\t//已在 Verifier 中处理\n\t\t//\t\tif (get(getString(request, apijson.JSONMap.KEY_ROLE)) == ADMIN) {\n\t\t//\t\t\tthrow new IllegalArgumentException(\"角色设置错误！不允许在写操作Request中传 \" + name +\n\t\t//\t\t\t\t\t\":{ \" + apijson.JSONMap.KEY_ROLE + \":admin } ！\");\n\t\t//\t\t}\n","sourceCodeStart":624,"sourceCodeEnd":660,"githubUrl":"https://github.com/Tencent/APIJSON/blob/5284052872898eddc449a58f629e5c8d588b8e22/APIJSONORM/src/main/java/apijson/orm/AbstractVerifier.java#L624-L660","documentation":"The static verifyRequest(...) — which validates request structure against the target structure (structure.sqlaragna/Request tables) — refuses to run when AbstractVerifier.ENABLE_VERIFY_CONTENT is false, throwing UnsupportedOperationException. Like ENABLE_VERIFY_ROLE, this is an opt-in switch; structure validation is a security feature that must be deliberately enabled.","triggerScenarios":"The framework (or a subclass such as the APIJSON framework's verifier) calls Verifier.verifyRequest(method, name, target, request, ...) — typically because a structure/Request table entry exists for the tag — while ENABLE_VERIFY_CONTENT was never set to true.","commonSituations":"Project relies on Request-table structure validation but the startup static block only enabled ENABLE_VERIFY_ROLE; upgrading APIJSON where defaults changed; copying example Request tables into a project whose verifier never enabled content verification.","solutions":["Set AbstractVerifier.ENABLE_VERIFY_CONTENT = true in your verifier's static initializer (together with ENABLE_VERIFY_ROLE if you also use role checks).","If you do not want structure validation, remove/avoid the Request-table entries that trigger verifyRequest for your tags.","Confirm the flag is set before the first request is served (static-init order in multi-module apps)."],"exampleFix":"// before\nstatic { AbstractVerifier.ENABLE_VERIFY_ROLE = true; }\n\n// after\nstatic {\n    AbstractVerifier.ENABLE_VERIFY_ROLE = true;\n    AbstractVerifier.ENABLE_VERIFY_CONTENT = true;\n}","handlingStrategy":"validation","validationCode":"if (!AbstractVerifier.ENABLE_VERIFY_CONTENT && structureValidationRequired(tag)) {\n    throw new IllegalStateException(\"Request-table structures exist but ENABLE_VERIFY_CONTENT is false\");\n}","typeGuard":null,"tryCatchPattern":"catch (UnsupportedOperationException e) { 500 config error; ops enables ENABLE_VERIFY_CONTENT or removes the triggering structure rows.","preventionTips":["Startup assertion: if any Request-table structure rows exist, require ENABLE_VERIFY_CONTENT == true.","Keep both feature flags set in the same static block and covered by a config test."],"tags":["apijson","configuration","validation","feature-flag"],"backgroundTag":null,"analyzedSha":"5284052872898eddc449a58f629e5c8d588b8e22","analyzedAt":"2026-08-14T15:15:29.577Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}