{"record":{"id":"f42349c349aaec6f","repo":"OpenAPITools/openapi-generator","slug":"s-class-suffix-only-allows-alphanumeric-character","errorCode":null,"errorMessage":"%s class suffix only allows alphanumeric characters.","messagePattern":"(.+?) class suffix only allows alphanumeric characters\\.","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java","lineNumber":694,"sourceCode":"     */\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        }\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 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 query param object format.\n     *\n     * @param format the query param object format to use\n     */\n    public void setQueryParamObjectFormat(String format) {\n        try {\n            queryParamObjectFormat = QUERY_PARAM_OBJECT_FORMAT_TYPE.valueOf(format);\n        } catch (IllegalArgumentException e) {\n            String values = Stream.of(QUERY_PARAM_OBJECT_FORMAT_TYPE.values())\n                    .map(value -> \"'\" + value.name() + \"'\")\n                    .collect(Collectors.joining(\", \"));\n","sourceCodeStart":676,"sourceCodeEnd":712,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/TypeScriptAngularClientCodegen.java#L676-L712","documentation":"Class-suffix options (serviceSuffix, modelSuffix) are validated for alphanumeric-only content, since the suffix becomes part of generated class names (e.g. PetService, PetModel). Any non-alphanumeric character in the suffix aborts generation during option processing.","triggerScenarios":"-DserviceSuffix=_Service or -DmodelSuffix=Dto/v2 — any suffix containing characters other than [A-Za-z0-9].","commonSituations":"Teams adding version markers like 'V2' with slashes or dots; snake_case suffix habits; suffixes copied from file-name conventions rather than class-name conventions.","solutions":["Use a purely alphanumeric suffix such as -DserviceSuffix=Service or -DmodelSuffix=DTO.","Omit the suffix option to keep generator defaults.","Put version markers in the prefix or package names, not the class suffix."],"exampleFix":"# before\n-DserviceSuffix=_Service\n\n# after\n-DserviceSuffix=Service","handlingStrategy":"validation","validationCode":"// node: class suffixes must be alphanumeric\nconst ALNUM = /^[A-Za-z0-9]+$/;\nfor (const [k, v] of Object.entries({ serviceSuffix: opts.serviceSuffix, modelSuffix: opts.modelSuffix }))\n  if (v && !ALNUM.test(v)) throw new Error(`${k} must be alphanumeric, got: ${v}`);","typeGuard":"const isValidClassSuffix = (v: string): boolean => /^[A-Za-z0-9]+$/.test(v);","tryCatchPattern":"// Java\ntry { new DefaultGenerator().opts(input).generate(); }\ncatch (IllegalArgumentException e) {\n    // suffix rejected: use a plain word like 'Service' or 'DTO'\n}","preventionTips":["Keep version markers out of class suffixes; use prefixes or package names.","Lint naming options in CI before generation.","Reuse the same suffix conventions across teams to avoid one-off invalid values."],"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"}