You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Claus Ibsen (Jira)" <ji...@apache.org> on 2026/07/16 13:43:00 UTC

[jira] [Commented] (CAMEL-24115) camel-rest-openapi: operations without operationId validate against generated GENOPID_* ids but dispatch to direct:null at runtime

    [ https://issues.apache.org/jira/browse/CAMEL-24115?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18096795#comment-18096795 ] 

Claus Ibsen commented on CAMEL-24115:
-------------------------------------

Fixed via https://github.com/apache/camel/pull/24781

> camel-rest-openapi: operations without operationId validate against generated GENOPID_* ids but dispatch to direct:null at runtime
> ----------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24115
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24115
>             Project: Camel
>          Issue Type: Bug
>          Components: camel-rest-openapi
>    Affects Versions: 4.21.0
>            Reporter: Federico Mariani
>            Assignee: Claus Ibsen
>            Priority: Major
>              Labels: code-review
>             Fix For: 4.22.0
>
>
> h3. Problem
> CAMEL-20979 (commit 7ec5d50566b5) made {{DefaultRestOpenapiProcessorStrategy.validateOpenApi()}} substitute a generated id ({{GENOPID_<VERB><sanitized path>}}) when {{operationId}} is missing, explicitly so users can add routes for specs they cannot modify. But nothing writes the generated id back onto the {{Operation}}: the runtime dispatch in {{process()}} uses {{operation.getOperationId()}} directly (DefaultRestOpenapiProcessorStrategy.java:203 and :252), which is {{null}} for these operations -> {{camelContext.hasEndpoint/getEndpoint("direct:null")}}.
> h3. Failure scenario
> Spec with {{GET /users}} and no {{operationId}}:
> * {{missingOperation=fail}} (default): startup fails telling the user to add {{direct:GENOPID_GET.users}}; the user adds exactly that route; validation passes; every request then resolves {{direct:null}} -> {{DirectConsumerNotAvailableException}} -> HTTP 500.
> * {{missingOperation=mock/ignore}}: the user-defined GENOPID route is silently never invoked - {{hasEndpoint("direct:null")}} is always null, so the mock/ignore branch always wins.
> h3. History
> 7ec5d50566b5 only patched {{validateOpenApi}}; its test ({{RestOpenapiProcessorStrategyTest}}) asserts only the validation message, never runtime dispatch.
> h3. Fix direction
> Compute the effective operation id once (e.g. in {{RestOpenApiProcessor.afterPropertiesConfigured}} when building {{RestOpenApiConsumerPath}}, or set the generated id on the {{Operation}}) and use it in both validation and dispatch.
> ----
> _This issue was researched and filed by Claude Code on behalf of [~croway] (GitHub: Croway), as part of a deep code review of camel-rest-openapi and camel-openapi-java on main (4.22.0-SNAPSHOT). Full findings document available on request._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)