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

   A step that reads the message body fails at runtime when there is none, and 
the answer is not inside one route: a route reached with `direct:` has the body 
of its caller. So the question needs the route topology — which 
`DefaultRouteTopologyDumper` already builds at runtime by indexing each route's 
input and matching the outputs against it. `RouteGraph` builds the same graph 
from the source, where an endpoint still has to be recognised in both spellings 
the YAML DSL allows.
   
   **Phase A — the walk.** It reports one thing, and only when it is certain: a 
step that reads the body although every way into its route provably carries 
none.
   
   ```
   route lookup: jsonpath reads the message body, and the message reaching this 
route has none -
   the routes that call it do not set one either: read the data first with 
setBody and
   constant: resource:file:... for a known file, or poll: for one that is not
   ```
   
   It stays silent for everything else — a `direct:` route nobody in the file 
calls, a consumer that brings its own body, a cycle, a step whose nested 
branches may set the body, anything unknown.
   
   **Phase B — the specification.** `rest: openApi: {specification: 
stock-api.json}` hides what phase A needs: whether an operation is a GET with 
no body or a POST with one lives in the specification, not the route. The 
specification is a file beside the route and the tools already have the 
directory, so `OpenApiVerbs` reads it and hands the analysis the 
`direct:<operationId>` endpoints of the verbs that carry no body. Without a 
directory, or with an unreadable specification, nothing is claimed.
   
   **Measured, not asserted.** Run over real files rather than fixtures:
   
   | corpus | files | reports |
   |---|---|---|
   | routes a model wrote against an OpenAPI contract | 208 | **12** — each the 
missing read that made the route answer 500 |
   | camel-kamelets | 997 | 0 |
   | camel-jbang-examples, camel-examples, benchmark output | 2010 | 0 |
   
   That exercise found two real bugs in the walk, both invisible to fixtures:
   - a step whose nested branches `setBody` is not a step without a body — a 
`choice` followed by `unmarshal` was reported wrongly
   - an endpoint may be written `uri: direct` with `parameters: {name: 
lookup}`, which is the same endpoint as `direct:lookup`; the runtime topology 
never sees this because the URI is resolved by then
   
   **Known gaps, on purpose:** a YAML OpenAPI specification is not read (JSON 
only), and the type lattice is not here — this pass answers *whether there is a 
body*, not *what type it is*. The rest of the proposal on the ticket (a Map 
after `unmarshal`, bytes after `marshal`, the runtime half from the message 
history) builds on this graph.
   
   Tests: 8 in the validator, 4 in camel-jbang-core covering the specification 
path both ways. Validator module 151 green, camel-jbang-core 1243 green, full 
reactor build green.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01Bp3538HRBPMQkb5ta9xRaj


-- 
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