CAMEL-24114: camel-rest-openapi - Request validator also checks exchange variables and endpoint literal parameters#24806
Conversation
…nge variables and endpoint literal parameters for required query parameters Signed-off-by: Claus Ibsen <davsclaus@apache.org> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>
gnodet
left a comment
There was a problem hiding this comment.
LGTM — clean, well-scoped fix.
The fallback chain (header → exchange variable → endpoint literal parameter) correctly mirrors
the resolution order in RestProducer.createQueryParameters(), so the validator now accepts
required query parameters regardless of how they are supplied.
Verified:
parametersfield inRestOpenApiEndpointholds the literal URI parameters (e.g.status=available)- Null-safe:
setEndpointParametersdefaults toCollections.emptyMap() - Non-query params like
requestValidationEnabledwon't false-positive since the validator only
checks names that match the OpenAPI operation's required query parameters - Both new test scenarios (endpoint URI literal + exchange variable) cover the two new resolution paths
Claude Code on behalf of gnodet
|
🌟 Thank you for your contribution to the Apache Camel project! 🌟 🐫 Apache Camel Committers, please review the following items:
|
|
🧪 CI tested the following changed modules:
🔬 Scalpel shadow comparison — Scalpel: 18 tested, 29 compile-only — current: 18 all testedMaveniverse Scalpel detected 47 affected modules (current approach: 18).
|
Summary
DefaultRequestValidatorrejected requests whose required query parameters were supplied via endpoint URI literals or exchange variables, because it only checkedmessage.getHeader().The fix extends the query parameter validation in
DefaultRequestValidator.validate()to mirror the resolution order used byRestProducer.createQueryParameters():Changes:
DefaultRequestValidator— addedendpointParametersfield and extended the required query parameter check to also consult exchange variables and endpoint literal parametersRestOpenApiEndpoint.configureRequestValidator()— passes the endpoint's remaining parameters to the validatorRestOpenApiRequestValidationTest— added two new parameterized tests covering literal endpoint URI query params and exchange variables with validation enabledFixes: CAMEL-24114
Claude Code on behalf of davsclaus
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com