{"record":{"id":"3e93c3f08f89ce9d","repo":"OpenAPITools/openapi-generator","slug":"empty-method-operation-name-operationid-not-allo-3e93c3","errorCode":null,"errorMessage":"Empty method/operation name (operationId) not allowed","messagePattern":"Empty method/operation name \\(operationId\\) not allowed","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java","lineNumber":304,"sourceCode":"                }\n            }\n        }\n        return objs;\n    }\n\n    @Override\n    public OperationsMap postProcessOperationsWithModels(OperationsMap objs, List<ModelMap> allModels) {\n        List<Map<String, String>> imports = objs.getImports();\n        imports.sort(Comparator.comparing(o -> o.get(\"import\")));\n        objs.put(\"imports\", imports);\n        return objs;\n    }\n\n    @Override\n    public String toOperationId(String operationId) {\n        // throw exception if method name is empty\n        if (StringUtils.isEmpty(operationId)) {\n            throw new RuntimeException(\"Empty method/operation name (operationId) not allowed\");\n        }\n\n        operationId = camelize(sanitizeName(operationId), LOWERCASE_FIRST_LETTER);\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        return operationId;\n    }\n\n    @Override\n    public String escapeQuotationMark(String input) {\n        // remove ', \" to avoid code injection\n        return input.replace(\"\\\"\", \"\").replace(\"'\", \"\");","sourceCodeStart":286,"sourceCodeEnd":322,"githubUrl":"https://github.com/OpenAPITools/openapi-generator/blob/fcec517be3cf5b7964296bcba25fbc97541484e7/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/JavascriptClosureAngularClientCodegen.java#L286-L322","documentation":"toOperationId of the javascript-closure-angular generator rejects empty/missing operationIds instead of synthesizing one. Like the other JavaScript generators, every operation in the OpenAPI document must carry a non-empty operationId or generation aborts with a RuntimeException at the first offender.","triggerScenarios":"`-g javascript-closure-angular` run against a spec containing an operation without operationId (or an empty string one); typically converted or hand-merged specs.","commonSituations":"Legacy Google Closure Angular projects regenerating from specs that evolved and lost ids; batch conversion scripts that assume all generators tolerate missing ids.","solutions":["Add unique non-empty operationIds to every operation in the spec.","Pre-validate the spec for operationId presence (see validationCode) before invoking the generator.","If the spec is third-party, request/derive ids upstream rather than patching generated code."],"exampleFix":"# before (api.yaml)\n  /orders:\n    post:\n      summary: create order\n# after\n  /orders:\n    post:\n      operationId: createOrder\n      summary: create order","handlingStrategy":"validation","validationCode":"// Java: same pre-check, aimed at javascript-closure-angular\nOpenAPI api = new OpenAPIParser().readLocation(\"api.yaml\", null, new ParseOptions()).getOpenAPI();\napi.getPaths().forEach((path, item) -> item.readOperations().forEach((method, op) -> {\n    if (op == null || op.getOperationId() == null || op.getOperationId().trim().isEmpty())\n        throw new IllegalStateException(\"closure-angular requires operationId on \" + method.toUpperCase() + \" \" + path);\n}));","typeGuard":null,"tryCatchPattern":"try {\n    new DefaultGenerator().opts(clientOptInput).generate();\n} catch (RuntimeException e) {\n    failBuild(\"Spec missing operationId (javascript-closure-angular): \" + e.getMessage());\n}","preventionTips":["Require operationId in every reviewed spec change.","Run the pre-generation id check in the same CI job that invokes the generator.","For legacy Closure Angular projects, script a one-time backfill of ids from method+path."],"tags":["openapi-generator","javascript","closure-angular","openapi-spec","operationid"],"backgroundTag":"missing-operationid","analyzedSha":"fcec517be3cf5b7964296bcba25fbc97541484e7","analyzedAt":"2026-08-22T11:13:11.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T14:17:55.899Z"}