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

   [CAMEL-26352](https://issues.apache.org/jira/browse/CAMEL-26352). Stacked on 
#28585 (body types), which is stacked on #28575 (cards), so this PR targets the 
#28585 branch.
   
   `camel cmd route-diagram` of source files now marks the steps that the 
checks of `camel validate` find a problem with. The card gets a yellow border 
and a badge, and the problem goes in a callout beside the route, at the height 
of the step.
   
   <img 
src="https://raw.githubusercontent.com/apache/camel/CAMEL-26352-diagram-problems/docs/components/modules/ROOT/images/route-diagram-problems.png";
 width="420" alt="A Groovy step marked, with the callout of its problem beside 
the route">
   
   This image is the command run on a real file. A Groovy step reads 
`body.items` of the file before it is unmarshalled, and the callout says what 
to do about it.
   
   - **Branches.** In a route with branches (`choice`, `multicast`, `doTry`, 
...), a callout beside the route would cross the steps of another branch. So 
the badge gets a number, and the problems become a numbered list below the 
route, in the order of the steps.
   - **Several problems.** Callouts stack downwards when they would overlap, 
and each callout shows up to 6 lines.
   - **Option.** `--problems[=true|false]`, on by default. The 
`camel_render_route_diagram` MCP tool marks problems too. A route without 
problems draws as before.
   
   ## Which checks
   - **YAML:** `SourceValidator`, the same checks as `camel validate`: the YAML 
DSL schema, endpoints and expressions against the catalog, and the body flow.
   - **Java and XML:** `RouteAssist` errors, the checks that read the source 
without compiling it. The route diagram reads Java without compiling it 
(CAMEL-25148), while the Java checks of `camel validate` compile the source 
with javac. That would make the diagram slow, and it would no longer be a tool 
that only reads the source.
   - **Matching a problem to a step:** the step whose line is the last one at 
or before the problem's line, since the line of a wrong option or expression is 
inside its step. A problem of the file as a whole goes on the first step.
   - **Callout text:** the first line of the message, without the `setBody: 
route orders:` prefix, because the callout already points at the step.
   
   ## Tests
   - `RouteDiagramCalloutTest` (camel-diagram):
     - callouts beside a route, wrapped, stacked, with room in the image;
     - a numbered list below a route with branches, in source order;
     - the warning colours drawn.
   - `RouteDiagramProblemsTest` (camel-jbang-core):
     - the text of a problem;
     - matching a line to its step;
     - a real YAML route (the GenericFile problem);
     - a real Java route (an option `kafka` doesn't have, found without 
compiling);
     - files without routes in the diagram are not checked.
   - I also ran the command end to end on `orders.camel.yaml`; the image above 
is its output.
   - Results:
     - camel-diagram: 192 tests pass.
     - camel-jbang-core: 57 tests pass (the route-diagram, history and error 
command tests and `RouteDiagramProblemsTest`).
     - camel-jbang-mcp: `RouteDiagramToolsTest` passes (6).
   
   _Claude Code on behalf of davsclaus_
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_012nJsFsjqqFiwroeHRWaKbS
   


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