[
https://issues.apache.org/jira/browse/CAMEL-25321?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Claus Ibsen resolved CAMEL-25321.
---------------------------------
Fix Version/s: 4.23.0
Resolution: Fixed
Fixed by https://github.com/apache/camel/pull/27333 (51cfc77abea1). Local-model
benchmark, contracts/openapi-client k=5 with the component option
camel.component.rest-openapi.request-validation-enabled=true: requests sent
with a literal {sku} went from 942 to 0, the model got the path parameter
message instead (1824 times); steps 11/15 vs 9/15 (within noise), step 2 4/5 vs
2/5.
> camel-rest-openapi - client request validation checks the path parameters too
> -----------------------------------------------------------------------------
>
> Key: CAMEL-25321
> URL: https://issues.apache.org/jira/browse/CAMEL-25321
> Project: Camel
> Issue Type: Improvement
> Components: camel-rest-openapi
> Reporter: Claus Ibsen
> Priority: Minor
> Fix For: 4.23.0
>
>
> With {{requestValidationEnabled=true}} the rest-openapi producer validates
> the request before sending: content type, required body, JSON syntax,
> required query parameters and required header parameters. Path parameters are
> not checked. A call whose path parameter has no value, such as
> {{/stock/\{sku\}/reserve}} without a header {{sku}}, passes the validation
> and goes out with the literal {{\{sku\}}} in the path; the service answers
> 404. CAMEL-24986 logs a WARN about it at send time, but the request is still
> sent and the 404 is the error the user (or a model) sees.
> Every path parameter is required in OpenAPI. Proposal: the validator also
> checks the placeholders of the operation's path (taken from the path
> template, so a parameter declared on the path item counts too): each needs a
> value from a header, an exchange variable or an endpoint parameter, as for
> query parameters; otherwise the validation fails with {{Path parameter 'sku'
> is required but none found: set the header sku, or an exchange variable of
> that name, before the call.}}
> Found in the local-model benchmark (contracts/openapi-client). Related:
> CAMEL-24986 (runtime WARN), CAMEL-24992 (validator check before the route
> runs).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)