{"record":{"id":"4c24a52d55d0e903","repo":"OpenAPITools/openapi-generator","slug":"s-file-suffix-only-allows-and-alphanumer","errorCode":null,"errorMessage":"%s file suffix only allows '.', '-' and alphanumeric characters.","messagePattern":"(.+?) file suffix only allows '\\.', '-' and alphanumeric characters\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java","lineNumber":664,"sourceCode":"            result = result.substring(prefix.length());\n        }\n        if (suffix.length() > 0 && result.endsWith(suffix)) {\n            result = result.substring(0, result.length() - suffix.length());\n        }\n\n        return result;\n    }\n\n    /**\n     * Validates that the given string value only contains '-', '.' and alpha numeric characters.\n     * Throws an IllegalArgumentException, if the string contains any other characters.\n     *\n     * @param argument The name of the argument being validated. This is only used for displaying an error message.\n     * @param value    The value that is being validated.\n     */\n    private void validateFileSuffixArgument(String argument, String value) {\n        if (!value.matches(FILE_NAME_SUFFIX_PATTERN)) {\n            throw new IllegalArgumentException(\n                    String.format(Locale.ROOT, \"%s file suffix only allows '.', '-' and alphanumeric characters.\", argument)\n            );\n        }\n    }\n\n    /**\n     * Validates that the given string value only contains alpha numeric characters.\n     * Throws an IllegalArgumentException, if the string contains any other characters.\n     *\n     * @param argument The name of the argument being validated. This is only used for displaying an error message.\n     * @param value    The value that is being validated.\n     */\n    private void validateClassPrefixArgument(String argument, String value) {\n        if (!value.matches(CLASS_NAME_PREFIX_PATTERN)) {\n            throw new IllegalArgumentException(\n                    String.format(Locale.ROOT, \"%s class prefix only allows alphanumeric characters.\", argument)\n            );\n        }","sourceCodeStart":646,"sourceCodeEnd":682,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java#L646-L682","documentation":"The Angular generator validates file-suffix options (serviceFileSuffix, modelFileSuffix) with a pattern allowing only '.', '-' and alphanumeric characters, because the suffix becomes part of file names. The check runs during option processing; any other character (underscore, space, slash, dot-leading paths) aborts generation.","triggerScenarios":"-DserviceFileSuffix=_service or -DmodelFileSuffix=.gen/models — any suffix containing characters outside [A-Za-z0-9.-].","commonSituations":"Using snake_case suffixes out of habit; trying to smuggle a subdirectory into the suffix; copying suffix conventions from other generators that are more permissive.","solutions":["Restrict the suffix to alphanumerics, '.' and '-' (e.g. -DserviceFileSuffix=Service).","Drop the suffix option entirely to use the generator default.","Use output/library options (apiPackage, modelPackage) for directory placement, not the file suffix."],"exampleFix":"# before\n-DserviceFileSuffix=_service\n\n# after\n-DserviceFileSuffix=Service","handlingStrategy":"validation","validationCode":"// node: validate suffix options against the generator's pattern\nconst FILE_SUFFIX = /^[A-Za-z0-9.-]+$/;\nconst assertSuffix = (name, v) => { if (!FILE_SUFFIX.test(v)) throw new Error(`${name} invalid: ${v}`); };\nassertSuffix('serviceFileSuffix', opts.serviceFileSuffix ?? 'Service');\nassertSuffix('modelFileSuffix', opts.modelFileSuffix ?? 'Model');","typeGuard":"const isValidFileSuffix = (v: string): boolean => /^[A-Za-z0-9.-]+$/.test(v);","tryCatchPattern":"// Java\ntry { new DefaultGenerator().opts(input).generate(); }\ncatch (IllegalArgumentException e) {\n    // strip illegal characters from suffix options and rerun\n}","preventionTips":["Remember suffixes name files: alphanumerics, '.' and '-' only.","Validate naming options in a pre-flight check shared by all generation jobs.","Use package options for directory structure instead of suffix hacks."],"tags":["typescript","angular","configuration","naming"],"backgroundTag":"invalid-option-value","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}