OpenAPITools/openapi-generator · error · IllegalArgumentException
Invalid file naming '{}'. Must be 'camelCase' or 'kebab-case
Error message
Invalid file naming '{}'. Must be 'camelCase' or 'kebab-case' What it means
fileNaming for the Angular generator accepts exactly 'camelCase' or 'kebab-case' (unlike some other TypeScript generators it has no PascalCase support). An unsupported value throws during option processing.
Source
Thrown at modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java:727
String values = Stream.of(QUERY_PARAM_OBJECT_FORMAT_TYPE.values())
.map(value -> "'" + value.name() + "'")
.collect(Collectors.joining(", "));
String msg = String.format(Locale.ROOT, "Invalid query param object format '%s'. Must be one of %s.", format, values);
throw new IllegalArgumentException(msg);
}
}
/**
* Set the file naming type.
*
* @param fileNaming the file naming to use
*/
private void setFileNaming(String fileNaming) {
if ("camelCase".equals(fileNaming) || "kebab-case".equals(fileNaming)) {
this.fileNaming = fileNaming;
} else {
throw new IllegalArgumentException("Invalid file naming '" +
fileNaming + "'. Must be 'camelCase' or 'kebab-case'");
}
}
/**
* Converts the original name according to the current <code>fileNaming</code> strategy.
*
* @param originalName the original name to transform
* @return the transformed name
*/
private String convertUsingFileNamingConvention(String originalName) {
String name = this.removeModelPrefixSuffix(originalName);
if ("kebab-case".equals(fileNaming)) {
name = dashize(underscore(name));
} else {
name = camelize(name, LOWERCASE_FIRST_LETTER);
}
return name;View on GitHub (pinned to fcec517be3)
Solutions
- Set fileNaming to 'camelCase' or 'kebab-case'.
- If PascalCase file names are required, use a generator that supports it (e.g. typescript-fetch) or post-process the output.
Example fix
# before openapi-generator generate -g typescript-angular -i api.yaml -DfileNaming=PascalCase # after openapi-generator generate -g typescript-angular -i api.yaml -DfileNaming=kebab-case
Defensive patterns
Strategy: validation
Validate before calling
// node: Angular accepts only these two file naming values
const NAMING = ['camelCase', 'kebab-case'];
if (opts.fileNaming && !NAMING.includes(opts.fileNaming))
throw new Error(`fileNaming must be one of ${NAMING.join('|')}`); Type guard
const isAngularFileNaming = (v: string): v is 'camelCase' | 'kebab-case' => v === 'camelCase' || v === 'kebab-case';
Try / catch
// Java
try { new DefaultGenerator().opts(input).generate(); }
catch (IllegalArgumentException e) {
// unsupported naming value: switch to camelCase/kebab-case and rerun
} Prevention
- Do not share fileNaming options between different TypeScript generators.
- Keep a per-generator allowlist of option values in the pipeline.
- Prefer kebab-case for Angular file names to match CLI conventions.
When it happens
Trigger: -DfileNaming=PascalCase, snake_case, or any string other than the two accepted values.
Common situations: Copying fileNaming options from the typescript-fetch generator (which supports PascalCase) into an Angular job; assuming snake_case is available because it is common in other tools.
Related errors
- %s file suffix only allows '.', '-' and alphanumeric charact
- %s class prefix only allows alphanumeric characters.
- %s class suffix only allows alphanumeric characters.
- Invalid ngVersion: " + ngVersion + ". Only Angular v9+ is su
- Invalid query param object format '%s'. Must be one of %s.
AI-assisted analysis of OpenAPITools/openapi-generator@fcec517be3 (2026-08-22).
Data as JSON: /api/errors/75ded544aab2297b.
Report an issue: GitHub.