{"record":{"id":"e7666035f13b3063","repo":"OpenAPITools/openapi-generator","slug":"invalid-model-property-naming-name-must-be-o-e76660","errorCode":null,"errorMessage":"Invalid model property naming '{name}'. Must be 'original', 'camelCase', 'PascalCase' or 'snake_case'","messagePattern":"Invalid model property naming '(.+?)'\\. Must be 'original', 'camelCase', 'PascalCase' or 'snake_case'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/K6ClientCodegen.java","lineNumber":768,"sourceCode":"        return reference.toString();\n    }\n\n    private String getTemplateVariable(String input) {\n        return \"${\" + input + \"}\";\n    }\n\n    private String getNameUsingModelPropertyNaming(String name) {\n        switch (CodegenConstants.MODEL_PROPERTY_NAMING_TYPE.valueOf(getModelPropertyNaming())) {\n            case original:\n                return name;\n            case camelCase:\n                return camelize(name, LOWERCASE_FIRST_LETTER);\n            case PascalCase:\n                return camelize(name);\n            case snake_case:\n                return underscore(name);\n            default:\n                throw new IllegalArgumentException(\"Invalid model property naming '\" +\n                        name + \"'. Must be 'original', 'camelCase', \" +\n                        \"'PascalCase' or 'snake_case'\");\n        }\n    }\n\n    @Override\n    public String toVarName(String name) {\n        // sanitize name\n        name = sanitizeName(name);  // FIXME parameter should not be assigned. Also declare it as \"final\"\n\n        if (\"_\".equals(name)) {\n            name = \"_u\";\n        }\n\n        // if it's all upper case, do nothing\n        if (name.matches(\"^[A-Z_]*$\")) {\n            return name;\n        }","sourceCodeStart":750,"sourceCodeEnd":786,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/K6ClientCodegen.java#L750-L786","documentation":"Defensive default arm inside getNameUsingModelPropertyNaming of the k6 generator, which converts property names per the configured convention. The switch covers exactly the four MODEL_PROPERTY_NAMING_TYPE constants (original, camelCase, PascalCase, snake_case), making the default arm unreachable in practice — invalid values fail earlier in setModelPropertyNaming (K6ClientCodegen.java:853) or at valueOf(). The message also reports the property name being converted rather than the bad convention value, which is misleading.","triggerScenarios":"Not reachable through supported inputs: `-p modelPropertyNaming=<bad>` is rejected by the setter first. Only direct field assignment in a subclass or a future enum constant without a case could trigger it.","commonSituations":"Essentially never fires; the same wording thrown from K6ClientCodegen.java:853 is what developers actually encounter.","solutions":["Check the `modelPropertyNaming` option value — the setter at K6ClientCodegen.java:853 is the realistic throw site.","Use exactly original, camelCase, PascalCase, or snake_case.","In subclasses, always use the setter rather than assigning the field."],"exampleFix":"# before\nopenapi-generator-cli generate -g k6 -i api.yaml -p modelPropertyNaming=camel_case\n# after\nopenapi-generator-cli generate -g k6 -i api.yaml -p modelPropertyNaming=camelCase","handlingStrategy":"validation","validationCode":"# validate the option; this branch is defensive, the setter at K6ClientCodegen:853 is the gate\nmpn=\"${MODEL_PROPERTY_NAMING:-}\"\n[ -z \"$mpn\" ] || case \"$mpn\" in\n  original|camelCase|PascalCase|snake_case) ;;\n  *) echo \"modelPropertyNaming must be original|camelCase|PascalCase|snake_case, got: $mpn\" >&2; exit 2 ;;\nesac","typeGuard":"private static final java.util.Set<String> NAMING_CONVENTIONS =\n        java.util.Set.of(\"original\", \"camelCase\", \"PascalCase\", \"snake_case\");\n\nboolean isValidNamingConvention(String v) {\n    return v != null && NAMING_CONVENTIONS.contains(v);\n}","tryCatchPattern":"try {\n    new DefaultGenerator().opts(clientOptInput).generate();\n} catch (RuntimeException e) {\n    failBuild(\"k6 naming config rejected: \" + e.getMessage());\n}","preventionTips":["Validate modelPropertyNaming against the four constants before generation.","Suspect the setter throw site when this wording appears.","Use the setter in subclasses; never assign the field."],"tags":["openapi-generator","k6","javascript","configuration","naming"],"backgroundTag":"invalid-model-property-naming","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}