{"record":{"id":"b961d78636234ec1","repo":"OpenAPITools/openapi-generator","slug":"invalid-model-property-naming-naming-must-be","errorCode":null,"errorMessage":"Invalid model property naming '{naming}'. Must be 'original', 'camelCase', 'PascalCase' or 'snake_case'","messagePattern":"Invalid model property naming '(.+?)'\\. Must be 'original', 'camelCase', 'PascalCase' or 'snake_case'","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java","lineNumber":270,"sourceCode":"    public void setDateLibrary(String dateLibrary, boolean withLegacy) {\n        if (withLegacy && dateLibrary.equals(DateLibraries.legacy.name())) {\n            this.dateLibrary = dateLibrary;\n            return;\n        }\n        for (DateLibraries dateLib : DateLibraries.values()) {\n            if (dateLib.name().equals(dateLibrary)) {\n                this.dateLibrary = dateLibrary;\n                return;\n            }\n        }\n        throw new IllegalArgumentException(\"Invalid dateLibrary. Must be 'java8' or 'joda'\");\n    }\n\n    public void setModelPropertyNaming(String naming) {\n        try {\n            this.modelPropertyNaming = CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.valueOf(naming).name();\n        } catch (IllegalArgumentException ex) {\n            throw new IllegalArgumentException(\"Invalid model property naming '\" +\n                    naming + \"'. Must be 'original', 'camelCase', \" +\n                    \"'PascalCase' or 'snake_case'\");\n        }\n    }\n\n\n    @Override\n    public String toVarName(String name) {\n        // obtain the name from nameMapping directly if provided\n        if (nameMapping.containsKey(name)) {\n            return nameMapping.get(name);\n        }\n\n        String varName = sanitizeName(name);\n\n        if (\"_\".equals(varName)) {\n            varName = \"_u\";\n        }","sourceCodeStart":252,"sourceCodeEnd":288,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractScalaCodegen.java#L252-L288","documentation":"AbstractScalaCodegen.setModelPropertyNaming calls CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.valueOf(naming). An unrecognized string makes valueOf throw IllegalArgumentException, rethrown with the allowed list 'original', 'camelCase', 'PascalCase', 'snake_case' — matched case-sensitively against the enum constant names.","triggerScenarios":"-p modelPropertyNaming=<bad> on Scala generators: 'snake' (missing _case), 'Pascalcase' or 'pascalcase' (wrong case), 'kebab-case', 'hyphen', 'camel_case'.","commonSituations":"Muscle memory from other tools' naming options; assuming case-insensitive matching; copy-pasting values between generators whose option vocabularies differ.","solutions":["Pass one of the exact values: original, camelCase, PascalCase, snake_case","For underscore naming write it fully: -p modelPropertyNaming=snake_case","Omit the option to keep the generator default while you check the README table"],"exampleFix":"# before\n-p modelPropertyNaming=snake\n\n# after\n-p modelPropertyNaming=snake_case","handlingStrategy":"validation","validationCode":"// Java: validate against the enum before applying\ntry {\n    CodegenConstants.ENUM_PROPERTY_NAMING_TYPE.valueOf(naming);\n} catch (IllegalArgumentException ex) {\n    throw new IllegalArgumentException(\"modelPropertyNaming must be original, camelCase, PascalCase or snake_case\");\n}","typeGuard":null,"tryCatchPattern":"try { generator.generate(); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"Invalid model property naming\")) { /* fix the casing option value */ } throw e; }","preventionTips":["Copy option values from the generator's README table, exactly as printed","Treat naming values as case-sensitive enum names","Centralize generator options in a reviewed config file"],"tags":["scala","configuration","naming","cli-option"],"backgroundTag":"invalid-generator-option","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}