{"record":{"id":"d026998c4ce34039","repo":"OpenAPITools/openapi-generator","slug":"invalid-file-naming-must-be-camelcase-or-d02699","errorCode":null,"errorMessage":"Invalid file naming '{}'. Must be 'camelCase' or 'kebab-case'","messagePattern":"Invalid file naming '(.+?)'\\. Must be 'camelCase' or 'kebab-case'","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java","lineNumber":537,"sourceCode":"     */\n    private void validateClassSuffixArgument(String argument, String value) {\n        if (!value.matches(CLASS_NAME_SUFFIX_PATTERN)) {\n            throw new IllegalArgumentException(\n                    String.format(Locale.ROOT, \"%s class suffix only allows alphanumeric characters.\", argument)\n            );\n        }\n    }\n\n    /**\n     * Set the file naming type.\n     *\n     * @param fileNaming the file naming to use\n     */\n    private void setFileNaming(String fileNaming) {\n        if (\"camelCase\".equals(fileNaming) || \"kebab-case\".equals(fileNaming)) {\n            this.fileNaming = fileNaming;\n        } else {\n            throw new IllegalArgumentException(\"Invalid file naming '\" +\n                    fileNaming + \"'. Must be 'camelCase' or 'kebab-case'\");\n        }\n    }\n\n    /**\n     * Converts the original name according to the current <code>fileNaming</code> strategy.\n     *\n     * @param originalName the original name to transform\n     * @return the transformed name\n     */\n    private String convertUsingFileNamingConvention(String originalName) {\n        String name = this.removeModelPrefixSuffix(originalName);\n        if (\"kebab-case\".equals(fileNaming)) {\n            name = dashize(underscore(name));\n        } else {\n            name = camelize(name, LOWERCASE_FIRST_LETTER);\n        }\n        return name;","sourceCodeStart":519,"sourceCodeEnd":555,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptNestjsClientCodegen.java#L519-L555","documentation":"The typescript-nestjs client generator supports exactly two file naming strategies, 'camelCase' and 'kebab-case', enforced by setFileNaming (TypeScriptNestjsClientCodegen.java:533). The 'fileNaming' additional property selects how model file names are derived in convertUsingFileNamingConvention; any other value throws this IllegalArgumentException during processOpts.","triggerScenarios":"Running with -DfileNaming=snake_case, -DfileNaming=PascalCase, or a typo like -DfileNaming=kebabcase. The check is an exact string comparison, so casing matters.","commonSituations":"Porting specs/build scripts from other generators (e.g. typescript-fetch, java) whose file naming options accept different vocabularies like 'snake_case' or 'PascalCase'; assuming kebabcase without the dash works.","solutions":["Set fileNaming to exactly 'camelCase' or 'kebab-case' (case-sensitive, kebab needs the dash).","If you omitted the option but still see the error, search your spec's vendor extensions or config file for a 'fileNaming' key with a stray value."],"exampleFix":"# before\nopenapi-generator-cli generate -g typescript-nestjs -DfileNaming=snake_case\n\n# after\nopenapi-generator-cli generate -g typescript-nestjs -DfileNaming=kebab-case","handlingStrategy":"validation","validationCode":"case \"$FILE_NAMING\" in\n  camelCase|kebab-case|\"\") ;;\n  *) echo \"ERROR: fileNaming must be 'camelCase' or 'kebab-case'\" >&2; exit 1;;\nesac","typeGuard":"const FILE_NAMING_VALUES = ['camelCase', 'kebab-case'] as const;\ntype FileNaming = typeof FILE_NAMING_VALUES[number];\nconst isFileNaming = (v: string): v is FileNaming =>\n  (FILE_NAMING_VALUES as readonly string[]).includes(v);","tryCatchPattern":null,"preventionTips":["Treat fileNaming as an enum, not free text; validate against the two literals in your build tooling.","Copy option values from the generator's own docs (`openapi-generator-cli config-help -g typescript-nestjs`), not from other generators."],"tags":["typescript","nestjs","codegen","file-naming","config-validation"],"backgroundTag":"invalid-option-value","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}