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 14:58:00 UTC

[jira] [Assigned] (CAMEL-24114) camel-rest-openapi: requestValidationEnabled rejects requests whose required query parameters are supplied as endpoint literals or exchange variables

     [ https://issues.apache.org/jira/browse/CAMEL-24114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Claus Ibsen reassigned CAMEL-24114:
-----------------------------------

    Assignee: Claus Ibsen

> camel-rest-openapi: requestValidationEnabled rejects requests whose required query parameters are supplied as endpoint literals or exchange variables
> -----------------------------------------------------------------------------------------------------------------------------------------------------
>
>                 Key: CAMEL-24114
>                 URL: https://issues.apache.org/jira/browse/CAMEL-24114
>             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
>
> h3. Problem
> {{DefaultRequestValidator}} (validator/DefaultRequestValidator.java:98-107) checks required query parameters (and headers) only via {{message.getHeader(parameter.getName())}}. The component supports two other documented ways of supplying query parameter values that the outgoing request will actually contain: (a) literal values in the rest-openapi endpoint URI ({{queryParameter}} -> {{literalQueryParameterValue}} bakes e.g. {{status=available}} into the delegate's {{queryParameters}}), and (b) exchange variables ({{RestProducer.createQueryParameters}} falls back to {{exchange.getVariable(key)}}). In both cases the header is absent, so validation fails even though the request is valid.
> h3. Failure scenario
> {{to("rest-openapi:petstore.json#findPetsByStatus?status=available&requestValidationEnabled=true")}}; the spec declares {{status}} as a required query param -> every exchange fails with {{RestOpenApiValidationException: Query parameter 'status' is required but none found.}} while the same URI without validation correctly sends {{GET /pet/findByStatus?status=available}}.
> h3. History
> {{RestOpenApiRequestValidationTest}} only ever supplies required query params via headers, so the broken combination is untested.
> h3. Fix direction
> Pass the resolved literal {{queryParameters}} (or the endpoint parameters map) into {{RestOpenApiOperation}}/the validator so literals count as present, and consult {{exchange.getVariable(name)}} the same way {{RestProducer}} does.
> ----
> _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)