{"record":{"id":"af35e8b44e1f4b52","repo":"OpenAPITools/openapi-generator","slug":"empty-method-name-operationid-not-allowed-af35e8","errorCode":null,"errorMessage":"Empty method name (operationId) not allowed","messagePattern":"Empty method name \\(operationId\\) not allowed","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftCombineClientCodegen.java","lineNumber":460,"sourceCode":"\n    @Override\n    public String toModelDocFilename(String name) {\n        return toModelName(name);\n    }\n\n    @Override\n    public String toApiDocFilename(String name) {\n        return toApiName(name);\n    }\n\n    @Override\n    public String toOperationId(String operationId) {\n        operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);\n\n        // Throw exception if method name is empty.\n        // This should not happen but keep the check just in case\n        if (StringUtils.isEmpty(operationId)) {\n            throw new RuntimeException(\"Empty method name (operationId) not allowed\");\n        }\n\n        // method name cannot use reserved keyword, e.g. return\n        if (isReservedWord(operationId)) {\n            String newOperationId = camelize((\"call_\" + operationId), LOWERCASE_FIRST_LETTER);\n            LOGGER.warn(\"{} (reserved word) cannot be used as method name. Renamed to {}\", operationId, newOperationId);\n            return newOperationId;\n        }\n\n        // operationId starts with a number\n        if (operationId.matches(\"^\\\\d.*\")) {\n            LOGGER.warn(\"{} (starting with a number) cannot be used as method name. Renamed to {}\", operationId, camelize(sanitizeName(\"call_\" + operationId), LOWERCASE_FIRST_LETTER));\n            operationId = camelize(sanitizeName(\"call_\" + operationId), LOWERCASE_FIRST_LETTER);\n        }\n\n\n        return operationId;\n    }","sourceCodeStart":442,"sourceCodeEnd":478,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/SwiftCombineClientCodegen.java#L442-L478","documentation":"The Swift Combine generator applies the same guard as the other Swift generators: the method name is computed from operationId by sanitization and camelization, and an empty result throws because a valid Swift identifier is required for the generated API method.","triggerScenarios":"An operation with a missing, blank, or symbol-only operationId whose sanitized and camelized form is the empty string.","commonSituations":"Switching the Combine generator on for an old spec that lacks operationIds; specs edited by hand where an operationId was accidentally emptied; API-portal exports that omit operationId for auto-generated routes.","solutions":["Give the failing operation an explicit alphanumeric operationId.","Fix or remove placeholder operationIds made of symbols.","Run a spec linter that requires operationId before invoking the generator."],"exampleFix":"# before\npaths:\n  /feed:\n    get:\n      operationId: ''\n\n# after\npaths:\n  /feed:\n    get:\n      operationId: getFeed","handlingStrategy":"validation","validationCode":"// node\nconst requiresId = (op) => Boolean(op && op.responses);\nObject.values(spec.paths).forEach(item =>\n  Object.values(item).forEach(op => {\n    if (requiresId(op) && !/[a-zA-Z0-9]/.test(String(op.operationId ?? '')))\n      throw new Error('operation missing usable operationId');\n  }));","typeGuard":"const isValidOperationId = (id: unknown): id is string =>\n  typeof id === 'string' && /[a-zA-Z0-9]/.test(id);","tryCatchPattern":"// Java\ntry { new DefaultGenerator().opts(input).generate(); }\ncatch (RuntimeException e) {\n    // empty operationId after sanitize: patch spec and regenerate once\n}","preventionTips":["Run the same operationId lint for every Swift generator variant (5, 6, Combine).","Reject placeholder ids (symbols only) in spec review.","Generate clients from the same linted spec artifact for all target languages."],"tags":["swift","combine","openapi","spec-validation","naming"],"backgroundTag":"missing-operation-id","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}