{"record":{"id":"baf9f359dbeb602d","repo":"OpenAPITools/openapi-generator","slug":"s-is-an-invalid-enum-property-naming-option-plea-baf9f3","errorCode":null,"errorMessage":"%s is an invalid enum property naming option. Please choose from:","messagePattern":"(.+?) is an invalid enum property naming option\\. Please choose from:","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java","lineNumber":383,"sourceCode":"    public String escapeUnsafeCharacters(String input) {\n        return input.replace(\"*/\", \"*_/\").replace(\"/*\", \"/_*\");\n    }\n\n\n    /**\n     * Sets the naming convention for Kotlin enum properties\n     *\n     * @param enumPropertyNamingType The string representation of the naming convention, as defined by {@link KotlinEnumNamingType}\n     */\n    public void setEnumPropertyNaming(final String enumPropertyNamingType) {\n        try {\n            this.enumPropertyNaming = KotlinEnumNamingType.valueOf(enumPropertyNamingType);\n        } catch (IllegalArgumentException ex) {\n            StringBuilder sb = new StringBuilder(enumPropertyNamingType + \" is an invalid enum property naming option. Please choose from:\");\n            for (KotlinEnumNamingType t : KotlinEnumNamingType.values()) {\n                sb.append(\"\\n  \").append(t.name());\n            }\n            throw new RuntimeException(sb.toString());\n        }\n    }\n\n    @Override\n    public String toExampleValue(Schema schema) {\n        if (schema.getExample() != null) {\n            return super.toExampleValue(schema);\n        }\n        return null;\n    }\n\n    /**\n     * returns the OpenAPI type for the property\n     *\n     * @param p OpenAPI property object\n     * @return string presentation of the type\n     **/\n    @Override","sourceCodeStart":365,"sourceCodeEnd":401,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractKotlinCodegen.java#L365-L401","documentation":"AbstractKotlinCodegen.setEnumPropertyNaming parses the enumPropertyNaming option into the Kotlin-specific KotlinEnumNamingType enum instead of the shared CodegenConstants enum. Values include camelCase, PascalCase, snake_case, original, UPPERCASE plus Kotlin-only variants (a backtick-escaped original mode); anything else throws RuntimeException with the full valid list appended.","triggerScenarios":"Passing -p enumPropertyNaming=macro_case or another non-Kotlin value to a Kotlin generator (kotlin, kotlin-spring). KotlinEnumNamingType.valueOf throws IllegalArgumentException and the wrapper RuntimeException aborts.","commonSituations":"Copying a Java generator's enumPropertyNaming value (MACRO_CASE/legacy) into a Kotlin build; casing or hyphenation slips; assuming the shared CodegenConstants list applies.","solutions":["Use one of the values listed in the error message — e.g. camelCase, PascalCase, snake_case, original, UPPERCASE (plus Kotlin-specific backtick variants).","Do not reuse Java's MACRO_CASE/legacy values with Kotlin generators; keep per-language option sets.","Verify casing exactly — the match is case-sensitive valueOf lookup."],"exampleFix":"# before:\nopenapi-generator-cli generate -g kotlin -i api.yaml -p enumPropertyNaming=MACRO_CASE\n# after:\nopenapi-generator-cli generate -g kotlin -i api.yaml -p enumPropertyNaming=UPPERCASE","handlingStrategy":"type-guard","validationCode":"// Validate before passing the option to a Kotlin generator\nif (!isKotlinEnumPropertyNaming(opts.enumPropertyNaming)) {\n    throw new Error('Kotlin enumPropertyNaming must be one of camelCase, PascalCase, snake_case, original, UPPERCASE (or Kotlin backtick variants)');\n}","typeGuard":"const KOTLIN_ENUM_PROPERTY_NAMING = ['camelCase', 'PascalCase', 'snake_case', 'original', 'UPPERCASE'] as const;\nexport type KotlinEnumPropertyNaming = typeof KOTLIN_ENUM_PROPERTY_NAMING[number];\nexport function isKotlinEnumPropertyNaming(v: string): v is KotlinEnumPropertyNaming {\n    return (KOTLIN_ENUM_PROPERTY_NAMING as readonly string[]).includes(v);\n}","tryCatchPattern":null,"preventionTips":["Kotlin uses its own KotlinEnumNamingType list, not Java's MACRO_CASE/legacy.","Do not share an options template between Java and Kotlin generation steps.","Check the error message's appended list for the exact Kotlin-specific values (backtick variants included)."],"tags":["openapi","kotlin","enum","naming","configuration"],"backgroundTag":"invalid-enum-property-naming","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}