Brijesh-Thakkar opened a new pull request, #27100:
URL: https://github.com/apache/camel/pull/27100

   # Description
   
   Adds `camel topology`, a camel-jbang command that reads YAML route files 
statically (nothing is started) and reports what the application looks like 
before it runs: the routes and where each starts, the edges between routes 
(which route sends to which, via which endpoint), the endpoints that leave and 
enter the application, where each route's body comes from and the first step 
that may set it, and findings (a `direct:`/`seda:` endpoint nothing consumes 
(CAMEL-24955), a step that reads a body the route cannot have (CAMEL-24844), 
and a `direct:`/`seda:` route nothing calls).
   
   The same graph is already computed by the validator, but only as a gate. A 
report answers "what is this application", which is what someone opening an 
unfamiliar project, or an agent about to edit one, needs to know. Findings are 
reported, not enforced.
   
   **How**
   
   - `camel-yaml-dsl-validator`: new public facade 
`SourceTopology.analyze(Map<String,String> yamlByFile)`. Nodes, edges and 
external endpoints reuse the `RouteTopologyDumper` records from camel-api, so 
the shape matches the route-topology dev console. `RouteInfo`, `Finding` and 
`Skipped` are added on top. To expose the existing analysis, 
`BodyTypeFlow.check` is split into `analyze` + `check` and 
`EndpointConsumers.check` into `unconsumed` + `message`. Validator messages are 
unchanged.
   - `camel-jbang-core`: `camel topology [<paths>...] [--json]`. With no paths 
it reads the YAML files of the current directory (build directories skipped, 
via `AuthoringTools.projectFiles`, now public). Text output follows the dev 
console layout, and `--json` uses the dev console field names plus `file`, 
`body`, `findings` and `skipped`. Registered in `CamelJBangMain` and added to 
the "Development" help group (required by `GroupedCommandHelpRendererTest`).
   - Docs: generated command page/index/metadata, plus a short section in 
`camel-jbang-devtools.adoc`.
   
   **Scope:** YAML only. Java/XML routes are not read. Route templates and 
Kamelets are listed as skipped and suppress the consumer-based findings, since 
what they create could consume or call any endpoint.
   
   **Exit codes:** findings never fail the command. No routes or an empty 
directory exits 0. Exit 1 only for a path that does not exist, or a file named 
on the command line that is not YAML or does not parse. A bad file inside a 
scanned directory goes to `skipped`.
   
   **Known limitations**
   
   - Internal schemes use `RouteGraph.INTERNAL` (direct, seda, direct-vm, vm, 
disruptor, disruptor-vm), which differs from the runtime dumper's set.
   - `log:` and other in-process components appear as external endpoints, 
matching the runtime dumper's rule.
   - OpenAPI no-body endpoints are not passed in, so `body-never-set` can 
under-report for OpenAPI-bound routes.
   - `uncalled-route` is informational and cannot see callers in Java or via a 
ProducerTemplate.
   - Routes without an id are reported as `<file>#<n>`, not with Camel's 
runtime numbering.
   - Two byte-identical routes in different files are treated as one (existing 
property of `BodyTypeFlow`).
   
   **Testing**
   
   - New: `SourceTopologyTest` (23) and `TopologyTest` (21).
   - Existing validator and `SourceValidator*` tests pass unchanged before and 
after the refactor (no test edits).
   - Full `camel-jbang-core`: 1284 run, 0 failures. Two Knative bind tests 
flaked once and passed on retry (they pass alone).
   - Full validator module: the only 2 failures are 
`SemanticSchemaTest.questionTypesHaveDistinctClosedShapes`, which also fails on 
the unmodified base commit.
   - Ran the CLI end to end (no args, directory, single file, `--json`, empty 
directory, missing path, `--help`).
   
   The validation path (`YamlValidator`, `SourceValidator`, plugins) is 
untouched.
   
   # Target
   
   - [x] I checked that the commit is targeting the correct branch (Camel 4 
uses the `main` branch)
   
   # Tracking
   - [x] If this is a large change, bug fix, or code improvement, I checked 
there is a [JIRA issue](https://issues.apache.org/jira/browse/CAMEL) filed for 
the change (usually before you start working on it).
   
   CAMEL-24956
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [ ] I have run `mvn clean install -DskipTests` locally from root folder 
and I have committed all auto-generated changes.
   
   # AI-assisted contributions
   
   - [x] If this PR includes AI-generated code, commits have proper 
co-authorship attribution (e.g., `Co-authored-by` trailers) and the PR 
description identifies the AI tool used.
   
   This PR was developed with Claude Code (Claude Sonnet 5.5) and reviewed by me


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