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

   Part 2 of [CAMEL-25200](https://issues.apache.org/jira/browse/CAMEL-25200). 
**Stacked on #30802** (CAMEL-25200: the body check reads the calls between 
routes as EndpointRules does): review that one first. The diff here is the 
second commit. CI builds only PRs to main, so the CI run comes once #30802 is 
merged and this is retargeted. The tests below are the local runs.
   
   `camel overview` now says where the message body of each YAML route comes 
from, as agreed on the JIRA with Brijesh Thakkar, who started this in #27100.
   
   ## What camel overview shows
   
   A new **Message bodies** section (markdown):
   
   ```
   | Route | Body from | First step that sets it |
   |---|---|---|
   | `get-stock` | REST `GET /stock/{sku}`: **no body** | `setBody` (step 2) |
   | `receive-order` | consumer `platform-http:/orders` |  |
   | `validate-order` | called by `receive-order` over `direct:validate` |  |
   | `audit` | called from another file by `receive-order` |  |
   | `dlq` | the failed message, from a dead letter channel of `receive-order` 
|  |
   | `nightly-report` | consumer `timer:nightly`: **no body** | `to` (step 1) |
   | `build-report` | called by `nightly-report` over `direct:buildReport`: 
**no body** | `setBody` (step 1) |
   ```
   
   - `bodyFrom` per route in `--format=json`: `origin` (consumer, rest, caller, 
errorHandler, onCompletion, saga, unknown), `via`, `callers`, `noBody`, `setBy` 
/ `setAt`.
   - A **`body-never-set`** warning in the findings: a step that reads a body 
the route can never have (`jsonpath`, `unmarshal`, ... in a route only a timer 
or a GET reaches), with the same message as `camel validate`.
   
   The same shows up for agents through `camel_project_overview` and in the 
TUI, which use the same overview.
   
   ## How
   
   - **One analysis for both commands.** `BodyTypeFlow` is split into `analyze` 
(a `BodyOrigin` per route) and `report` (the validate errors from it). 
`YamlValidator.bodyOrigins(content, facts)` is the public entry point. It runs 
the analysis behind the same schema check as `validate` does: a file that does 
not pass the schema gets no origins, as validate then does not check its 
routes. `camel validate` keeps exactly the messages it had.
   - **The overview calls it the way `camel validate` does** (`ProjectBodies`): 
per YAML file, with the CLI's schema validator for the catalog version, and 
with the GET operations of an OpenAPI contract beside the route. 
`OverviewValidateParityTest` checks that both report the same `body-never-set` 
findings, as it already does for the endpoints (CAMEL-25180).
   - **Error paths and sagas.** `RouteGraph.errorPaths` finds the endpoints 
that a message reaches through an error path rather than a step: the dead 
letter channel of an error handler (top-level, in a route, in a route 
configuration), the steps of an `onException` or `onCompletion`, and the 
`compensation` / `completion` of a saga. Such a route is shown as reached by 
that path instead of "unknown". The body check says nothing about it, because 
its message has whatever body the route had when it failed.
   - **Agreed limits:** YAML only, and per file. A route called from another 
file says "called from another file by ..." (taken from the overview's links), 
and its body is not followed. Origin only, no Java type: that could come later 
from the body-type work of CAMEL-24844.
   - A caller without an id is named by its endpoint without options, so no 
credentials from a query end up in the output.
   
   Docs: the overview section of `camel-jbang-ai.adoc` lists the message bodies 
and the new finding.
   
   ## Tests
   
   - `BodyOriginTest` (validator): each origin (consumer, REST GET/POST with 
paths, OpenAPI GET, caller, unknown, dead letter in the file and in a route, 
onException, onCompletion, saga compensation and completion), the first step 
that sets the body, the schema gate, and that the problems are the messages of 
`validate`.
   - `OverviewValidateParityTest#overviewAndValidateReportTheSameBodyNeverSet`: 
OpenAPI GET, a chain in a file, a call with `direct://`, a call from another 
file, a dead letter route.
   - `IntegrationSummaryTest`: the markdown section, the JSON and the finding; 
no section without YAML routes.
   - camel-yaml-dsl-validator: 385 tests pass. camel-jbang-core: the full suite 
(3447) passes, except `DoctorRepositoryTest` (2), which fails the same way on 
#30802's tree with the scratch Maven repository I test with, and passes without 
it. camel-jbang-plugin-tui: the overview, About and architecture tests (83) 
pass.
   
   _Claude Code on behalf of Claus Ibsen (davsclaus)_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


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