davsclaus opened a new pull request, #27651:
URL: https://github.com/apache/camel/pull/27651

   [CAMEL-24992](https://issues.apache.org/jira/browse/CAMEL-24992)
   
   A `rest-openapi` call to an operation whose path holds a parameter 
(`/stock/{sku}/reserve`) takes the value from a header (or variable) of that 
name. With none set, the request goes out with `{sku}` in the path and the 
service answers 404. The runtime names the parameter after the route has run 
(CAMEL-24986, CAMEL-25321); this says it while the route is written, which is 
where a model's read-write-validate loop is.
   
   In the local-model benchmark the model kept the sku in an exchange property 
instead of a header, and the app sent **985, 913 and 3124 requests** to a 
literal `/stock/{sku}/reserve` in 3 of the last 7 runs of the openapi-client 
example, all 404.
   
   **The check** (`OpenApiPathParams`, run with the YAML checks when the 
directory is known):
   - reads the specification beside the route (`OpenApiVerbs`, which reads JSON 
and YAML since #26914 by @Brijesh-Thakkar), and the path parameters of the 
called operation - given as `rest-openapi:spec#operationId` or with the 
`specificationUri` / `operationId` options;
   - walks the steps before the call, nested ones included, for a `setHeader`, 
`setHeaders`, `setVariable` or `setVariables` of that name, or an endpoint 
option of that name;
   - reports at the call's line: *"the operation reserveStock 
(/stock/{sku}/reserve) needs the path parameter sku, and no step before this 
call sets a header sku: the request goes out with {sku} in the path and the 
service answers 404 (the exchange property sku is not used for the path); add - 
setHeader: ..."*.
   
   **Quiet** where it cannot prove the header is missing: a route consuming 
from anything but timer, scheduler, cron, quartz or file (a caller or a message 
can carry the header), a step before the call it cannot follow (a bean, a 
processor, a call to another endpoint), a `toD`, and a specification or 
operation it cannot find.
   
   **Measured on the benchmark's routes:** none of the 45 reference solutions 
that call rest-openapi is reported; 49 of the 414 model-written versions are, 
and none of those sets the header.
   
   Tests: `OpenApiPathParamsTest` (the benchmark's case, both call forms, 
header / variable / option, the quiet cases, through `SourceValidator`); 
camel-jbang-core suite (1699) green.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to