{"record":{"id":"3c75c362a18f6c3e","repo":"OpenAPITools/openapi-generator","slug":"must-be-one-of-skip-fail-or-none-to-emit-no","errorCode":null,"errorMessage":"{} must be one of SKIP, FAIL, or NONE (to emit no annotation), but was: {}","messagePattern":"(.+?) must be one of SKIP, FAIL, or NONE \\(to emit no annotation\\), but was: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/JsonAnnotationPolicyUtils.java","lineNumber":343,"sourceCode":"     *\n     * @param rawValue      the raw vendor extension value set directly on the property in the spec\n     * @param extensionName the vendor extension key, used in the error message\n     * @return the normalized {@link JsonSetterNullsMode}: {@code SKIP}/{@code FAIL} to emit that annotation, or\n     * {@link JsonSetterNullsMode#NONE} when the override means \"emit no annotation\" ({@code NONE}/blank)\n     * @throws IllegalArgumentException when the override is not {@code SKIP}, {@code FAIL}, or {@code NONE}\n     */\n    public static JsonSetterNullsMode resolveManualJsonSetterNulls(Object rawValue, String extensionName) {\n        if (rawValue == null) {\n            return JsonSetterNullsMode.NONE;\n        }\n        String trimmed = rawValue.toString().trim();\n        if (trimmed.isEmpty()) {\n            return JsonSetterNullsMode.NONE;\n        }\n        try {\n            return JsonSetterNullsMode.valueOf(trimmed.toUpperCase(java.util.Locale.ROOT));\n        } catch (IllegalArgumentException e) {\n            throw new IllegalArgumentException(extensionName\n                    + \" must be one of SKIP, FAIL, or NONE (to emit no annotation), but was: \" + rawValue);\n        }\n    }\n\n    /**\n     * Resolve the {@code @JsonSetter(nulls = ...)} annotation for a property into the\n     * {@code x-has-json-setter-nulls-skip}/{@code -fail} vendor extension the templates emit, mutating\n     * {@code property.vendorExtensions} and {@code model.imports} in place. Precedence (mirrors\n     * {@link #resolveJsonIncludePolicy}):\n     * <ol>\n     *   <li>A per-property {@code x-jackson-json-setter-nulls} override in the spec always wins and is honored\n     *       unconditionally (regardless of {@code generateJsonSetterNullsAnnotations}, required/nullable,\n     *       {@code openApiNullable}, or {@code failModeSupported}).</li>\n     *   <li>Otherwise the automatic optional-non-nullable mode from\n     *       {@link #resolveJsonSetterNullsMode(TriStateBoolean, boolean, boolean, boolean, boolean, JsonSetterNullsMode)}.</li>\n     * </ol>\n     *\n     * @param model                              the model owning {@code property}, whose imports may be extended","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/utils/JsonAnnotationPolicyUtils.java#L325-L361","documentation":"JsonAnnotationPolicyUtils.resolveManualJsonSetterNulls validates the per-property 'x-jackson-json-setter-nulls' vendor extension used by the spring and kotlin-spring generators. Valid values are SKIP, FAIL, or NONE (emit no @JsonSetter annotation); null or blank also means NONE. Any other token throws IllegalArgumentException, prefixed with the extension name so the offending spec location is identifiable.","triggerScenarios":"Adding x-jackson-json-setter-nulls: skip-nulls, ignore, or ALWAYS to a schema property and generating with -g spring / -g kotlin-spring. Matching is trim + uppercase + valueOf, so 'skip' and 'Skip' parse, but hyphenated or free-text values do not.","commonSituations":"Spec authors paraphrasing Jackson documentation ('nulls = Nulls.SKIP' pasted verbatim); consistent-value policies where one property in a big spec has a typo; converting JSON examples with lowercase-hyphen style into YAML extension values.","solutions":["Set the extension to SKIP, FAIL, or NONE exactly (underscores not needed; case-insensitive).","Remove the extension to inherit the generator-wide optionalNonNullPropertyJsonSetterNulls / openApiNullable-derived behavior.","Grep the spec for x-jackson-json-setter-nulls and check each value against the three allowed tokens."],"exampleFix":"# before (openapi.yaml)\n          x-jackson-json-setter-nulls: skip-nulls\n\n# after\n          x-jackson-json-setter-nulls: SKIP","handlingStrategy":"validation","validationCode":"// Node: validate x-jackson-json-setter-nulls values in the spec\nconst ALLOWED = new Set(['SKIP','FAIL','NONE','']);\nconst check = (o) => { for (const [k, v] of Object.entries(o ?? {})) {\n  if (k === 'x-jackson-json-setter-nulls' && !ALLOWED.has(String(v).trim().toUpperCase()))\n    throw new Error(`invalid x-jackson-json-setter-nulls: ${v}`);\n  if (v && typeof v === 'object') check(v);\n}};\ncheck(require('./openapi.json'));","typeGuard":"const isJsonSetterNulls = (v: unknown): v is 'SKIP' | 'FAIL' | 'NONE' =>\n  typeof v === 'string' && ['SKIP','FAIL','NONE'].includes(v.trim().toUpperCase());","tryCatchPattern":null,"preventionTips":["Only three tokens are valid: SKIP, FAIL, NONE — no hyphens or prose.","Remove the extension when you want inherited behavior instead of writing 'default'."],"tags":["jackson","spring","vendor-extension","codegen","validation"],"backgroundTag":"invalid-vendor-extension-value","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}