You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by "davsclaus (via GitHub)" <gi...@apache.org> on 2026/10/01 07:34:25 UTC
[PR] chore: camel-jbang - parity of the YAML, Java and XML route checks and quick doc [camel]
davsclaus opened a new pull request, #27181:
URL: https://github.com/apache/camel/pull/27181
_Claude Code on behalf of davsclaus_
A follow-up of #27172 (CAMEL-25208). YAML routes are checked on their text, and Java and XML routes on the Camel model they are read into. The checks of a uri and of an expression are shared, but what finds the uris and expressions is not, so the three DSLs can drift apart. This PR adds a test that pins them together, and fixes what it found.
**Depends on #27178** (main does not compile in camel-jbang-core). Its commit is the first one here and drops out on rebase once #27178 is merged.
### Parity test
`DslParityTest` writes the same routes in YAML, Java and XML and asserts the same problem, on the matching line, in all three:
- a valid route (no problem);
- an unknown option;
- an invalid enum value;
- a producer option on a consumer;
- a simple predicate that does not parse;
- an unknown simple function;
- a `to` with `${...}`;
- a producer-only component as `from`;
- several endpoints in one uri;
- a `direct:` endpoint no route consumes.
### What it found: YAML schema errors had no line
The errors of the YAML DSL schema were reported as `uri: to: the uri holds an expression...`, without a line. So the TUI did not mark them on their line (a misspelled option such as `logLevel` was only listed when saving), and `camel validate` and `camel_validate_source` did not say where they were. `YamlPointerLines` turns the JSON pointer of a schema error into the line it points at; for a property that is not allowed, that is the line of its key. The errors now start with `Line N: ` as the other checks do.
### YAML quick doc
On a `simple:` line, or the `expression:` under it, the quick doc panel says the language and whether the EIP evaluates it as a predicate (`Simple predicate: ${header.foo} == 'bar'`), as for Java and XML. The YAML quick doc also falls back to the CLI's catalog when no integration is selected, as the Java and XML one does.
Tests: camel-jbang-core (1361) and camel-jbang-plugin-tui (1457) pass.
🤖 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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang, camel-yaml-dsl-validator - parity of the YAML, Java and XML route checks; YAML errors on their line [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27181:
URL: https://github.com/apache/camel/pull/27181#discussion_r4153054385
##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/YamlValidator.java:
##########
@@ -134,6 +134,27 @@ public List<Error> validate(String content) throws Exception {
return validate(content, Set.of());
}
+ /**
+ * The 1-based line of the YAML content a validation error points at (the line of the key of a property that is not
+ * allowed), or 0 when it has no location or the content does not parse.
+ */
Review Comment:
Fixed in 772a8f696b8b: the Javadoc is back on `lineOf()`, the method it documents.
_Claude Code on behalf of davsclaus_
##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/YamlValidator.java:
##########
@@ -134,6 +134,27 @@ public List<Error> validate(String content) throws Exception {
return validate(content, Set.of());
}
+ /**
+ * The 1-based line of the YAML content a validation error points at (the line of the key of a property that is not
+ * allowed), or 0 when it has no location or the content does not parse.
+ */
+ /**
+ * A validation error as reports print it, with the line of the YAML content it points at in front when that is
+ * known: "Line 12: /0/route/from/steps/0/log: property 'logLevel' is not defined in the schema...".
+ */
+ public static String describe(String content, Error error) {
+ int line = content != null ? lineOf(content, error) : 0;
+ return line > 0 ? "Line " + line + ": " + error : String.valueOf(error);
+ }
+
+ public static int lineOf(String content, Error error) {
+ if (error == null || error.getInstanceLocation() == null) {
+ return 0;
+ }
+ return YamlPointerLines.line(YamlPointerLines.root(content), error.getInstanceLocation().toString(),
+ error.getMessage());
+ }
Review Comment:
Fixed in 772a8f696b8b: `describeAll(content, errors)` parses the YAML once for all the errors of a file, and `camel validate yaml` and the Maven plugin use it. The single-error `describe()` is gone, as nothing else used it; `lineOf(content, error)` stays for one error and points at `describeAll` in its Javadoc.
_Claude Code on behalf of davsclaus_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang, camel-yaml-dsl-validator - parity of the YAML, Java and XML route checks; YAML errors on their line [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27181:
URL: https://github.com/apache/camel/pull/27181#discussion_r4153034000
##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/YamlValidator.java:
##########
@@ -134,6 +134,27 @@ public List<Error> validate(String content) throws Exception {
return validate(content, Set.of());
}
+ /**
+ * The 1-based line of the YAML content a validation error points at (the line of the key of a property that is not
+ * allowed), or 0 when it has no location or the content does not parse.
+ */
+ /**
+ * A validation error as reports print it, with the line of the YAML content it points at in front when that is
+ * known: "Line 12: /0/route/from/steps/0/log: property 'logLevel' is not defined in the schema...".
+ */
+ public static String describe(String content, Error error) {
+ int line = content != null ? lineOf(content, error) : 0;
+ return line > 0 ? "Line " + line + ": " + error : String.valueOf(error);
+ }
+
+ public static int lineOf(String content, Error error) {
+ if (error == null || error.getInstanceLocation() == null) {
+ return 0;
+ }
+ return YamlPointerLines.line(YamlPointerLines.root(content), error.getInstanceLocation().toString(),
+ error.getMessage());
+ }
Review Comment:
💡 **Repeated YAML tree parsing.** `lineOf()` calls `YamlPointerLines.root(content)` on every invocation, re-parsing the entire YAML into a SnakeYAML node tree each time. Both callers (`ValidateMojo` and `YamlValidateCommand`) loop over errors calling `describe()` per error — so for a file with N schema errors, the tree is parsed N times.
`SourceValidator.formatSchemaErrors(errors, content)` in this same PR does it correctly: it parses once before the loop and passes the root node into `YamlPointerLines.line(root, ...)` for each error.
Not a production-critical issue (validation reports aren't hot paths), but inconsistent with the approach 30 lines away. A `describeAll(String content, List<Error> errors)` method (or documenting that `lineOf` is for single-error use and callers with lists should use `YamlPointerLines` directly) would close the gap.
##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/YamlValidator.java:
##########
@@ -134,6 +134,27 @@ public List<Error> validate(String content) throws Exception {
return validate(content, Set.of());
}
+ /**
+ * The 1-based line of the YAML content a validation error points at (the line of the key of a property that is not
+ * allowed), or 0 when it has no location or the content does not parse.
+ */
Review Comment:
💡 **Orphaned Javadoc.** Two consecutive `/** */` blocks are stacked above `describe()`. The first one (lines 137–140) describes `lineOf()` but is disconnected — it documents nothing. Move it onto `lineOf()` (which has no Javadoc), or merge the two blocks into one on `describe()`.
```suggestion
/**
* A validation error as reports print it, with the line of the YAML content it points at in front when that is
* known: "Line 12: /0/route/from/steps/0/log: property 'logLevel' is not defined in the schema...".
*/
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang - parity of the YAML, Java and XML route checks and quick doc [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #27181:
URL: https://github.com/apache/camel/pull/27181#discussion_r4152972125
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidator.java:
##########
@@ -398,11 +399,35 @@ public static BeanDeclarations scan(Path directory, String excludeFile) {
}
/** The YAML DSL schema errors in words: the node they are about and the message without parser noise. */
Review Comment:
Fixed in d9bfa5bbc3e7: the Javadoc is moved back onto `formatSchemaErrors(List<Error>)`, the method it documents, rather than removed, as that overload had none of its own.
_Claude Code on behalf of davsclaus_
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidator.java:
##########
@@ -398,11 +399,35 @@ public static BeanDeclarations scan(Path directory, String excludeFile) {
}
/** The YAML DSL schema errors in words: the node they are about and the message without parser noise. */
+ /**
+ * Whether the expression whose language key is on the given line of a YAML route is evaluated as a predicate by the
+ * EIP it belongs to (the expression of a filter or a when, the completionPredicate of an aggregate).
+ *
+ * @param lines the lines of the YAML route
+ * @param lineIdx the index of the line of the language key (simple:)
+ */
Review Comment:
Fixed in d9bfa5bbc3e7: `@param catalog` added.
_Claude Code on behalf of davsclaus_
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang - parity of the YAML, Java and XML route checks and quick doc [camel]
Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #27181:
URL: https://github.com/apache/camel/pull/27181#discussion_r4152959294
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidator.java:
##########
@@ -398,11 +399,35 @@ public static BeanDeclarations scan(Path directory, String excludeFile) {
}
/** The YAML DSL schema errors in words: the node they are about and the message without parser noise. */
+ /**
+ * Whether the expression whose language key is on the given line of a YAML route is evaluated as a predicate by the
+ * EIP it belongs to (the expression of a filter or a when, the completionPredicate of an aggregate).
+ *
+ * @param lines the lines of the YAML route
+ * @param lineIdx the index of the line of the language key (simple:)
+ */
Review Comment:
💡 **Missing `@param catalog`.** The Javadoc covers `lines` and `lineIdx` but not `catalog`.
```suggestion
/**
* Whether the expression whose language key is on the given line of a YAML route is evaluated as a predicate by the
* EIP it belongs to (the expression of a filter or a when, the completionPredicate of an aggregate).
*
* @param catalog the Camel catalog for language/EIP model lookups
* @param lines the lines of the YAML route
* @param lineIdx the index of the line of the language key (simple:)
*/
```
##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidator.java:
##########
@@ -398,11 +399,35 @@ public static BeanDeclarations scan(Path directory, String excludeFile) {
}
/** The YAML DSL schema errors in words: the node they are about and the message without parser noise. */
Review Comment:
💡 **Orphaned Javadoc.** This comment was the Javadoc for `formatSchemaErrors`, but the new `isYamlPredicate` was inserted between them. Now it documents nothing — `isYamlPredicate` has its own Javadoc, and the `formatSchemaErrors(errors, content)` overload also has its own. Remove it.
```suggestion
```
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang, camel-yaml-dsl-validator - parity of the YAML, Java and XML route checks; YAML errors on their line [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27181:
URL: https://github.com/apache/camel/pull/27181#issuecomment-5927554513
<!-- ci-tested-modules -->
:test_tube: **CI tested the following changed modules:**
- `dsl/camel-jbang/camel-jbang-core`
- `dsl/camel-jbang/camel-jbang-plugin-tui`
- `dsl/camel-jbang/camel-jbang-plugin-validate`
- `dsl/camel-yaml-dsl/camel-yaml-dsl-validator-maven-plugin`
- `dsl/camel-yaml-dsl/camel-yaml-dsl-validator`
:repeat: **1 test passed only after a retry on JDK 25** (1 retried attempt)
<details><summary>Recovered flaky tests on JDK 25 (1)</summary>
| Module | Test | Failed attempts | First failure |
| --- | --- | --- | --- |
| `dsl/camel-jbang/camel-jbang-plugin-tui` | `AiPanelAcpTest.usageUpdateFeedsTheTokenCounter` | 1 | array contents differ at index [0], expected: <900> but was: <0> |
> :information_source: These tests did **not** fail the build. Surefire retried them and they passed.
> Retries are enabled project-wide by `surefire.rerunFailingTestsCount` in `parent/pom.xml`.
</details>
---
<details><summary>:microscope: Scalpel shadow comparison — Scalpel: 8 of 697 tested, 8 compile-only — current: 8 all tested</summary>
[Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **8 affected modules** (current approach: 8).
**Skip-tests mode would test 8 modules** (5 direct + 4 downstream), **skip tests for 8** (generated code, meta-modules)
<details><summary>Modules Scalpel would test (8)</summary>
- `camel-jbang-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-mcp` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-route-parser` ← downstream of org.apache.camel:camel-jbang-core
- `camel-jbang-plugin-tui` ← dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceEditAssist.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceValidationSupport.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/main/java/org/apache/camel/dsl/jbang/core/commands/tui/SourceViewer.java, dsl/camel-jbang/camel-jbang-plugin-tui/src/test/java/org/apache/camel/dsl/jbang/core/commands/tui/YamlLanguageQuickDocTest.java
- `camel-jbang-plugin-validate` ← dsl/camel-jbang/camel-jbang-plugin-validate/src/main/java/org/apache/camel/dsl/jbang/core/commands/validate/YamlValidateCommand.java
- `camel-launcher-container` ← downstream of org.apache.camel:camel-launcher
- `camel-yaml-dsl-validator` ← dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/YamlPointerLines.java, dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/YamlValidator.java, dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/test/java/org/apache/camel/dsl/yaml/validator/YamlPointerLinesTest.java
- `camel-yaml-dsl-validator-maven-plugin` ← dsl/camel-yaml-dsl/camel-yaml-dsl-validator-maven-plugin/src/main/java/org/apache/camel/dsl/yaml/validator/ValidateMojo.java
</details>
<details><summary>Modules with tests skipped (8)</summary>
- `camel-jbang-it`
- `camel-jbang-main`
- `camel-jbang-plugin-edit`
- `camel-jbang-plugin-generate`
- `camel-jbang-plugin-kubernetes`
- `camel-jbang-plugin-test`
- `camel-launcher`
- `coverage`
</details>
> :information_source: Shadow mode — Scalpel observes but does not affect test execution. [Learn more](https://github.com/maveniverse/scalpel)
</details>
:warning: **Some tests are disabled on GitHub Actions** (`@DisabledIfSystemProperty(named = "ci.env.name")`) and require manual verification:
- `dsl/camel-jbang/camel-jbang-core`: 2 test(s) disabled on GitHub Actions
- `dsl/camel-jbang/camel-jbang-plugin-validate`: 1 test(s) disabled on GitHub Actions
:bulb: **Manual integration tests recommended:**
> You modified `dsl/camel-jbang/camel-jbang-core`. The related integration tests in `dsl/camel-jbang/camel-jbang-it` are excluded from CI. Consider running them manually:
> ```
> mvn verify -f dsl/camel-jbang/camel-jbang-it -Djbang-it-test
> ```
<details><summary>All tested modules (17 modules, 3m 52s total)</summary>
**Total reactor time:** 3m 52s
| Module | Duration | Status |
| --- | --- | --- |
| Camel :: JBang :: Plugin :: TUI | 57.0s | SUCCESS |
| Camel :: Launcher | 53.2s | SUCCESS |
| Camel :: JBang :: MCP | 43.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Kubernetes | 23.3s | SUCCESS |
| Camel :: YAML DSL :: Validator | 18.6s | SUCCESS |
| Camel :: JBang :: Plugin :: Testing | 10.8s | SUCCESS |
| Camel :: JBang :: Plugin :: Validate | 8.6s | SUCCESS |
| Camel :: Coverage | 5.4s | SUCCESS |
| Camel :: YAML DSL :: Validator Maven Plugin | 3.3s | SUCCESS |
| Camel :: JBang :: Plugin :: Generate | 1.7s | SUCCESS |
| Camel :: JBang :: Plugin :: MCP | 1.5s | SUCCESS |
| Camel :: JBang :: Plugin :: Edit | 1.4s | SUCCESS |
| Camel :: JBang :: Integration tests | 1.4s | SUCCESS |
| Camel :: JBang :: Plugin :: Route Parser | 0.9s | SUCCESS |
| Camel :: JBang :: Main | 0.9s | SUCCESS |
| Camel :: Launcher :: Container | 0.8s | SUCCESS |
| Camel :: JBang :: Core | n/a | |
**Top 20 slowest modules:**
- `Camel :: JBang :: Plugin :: TUI` (57.0s)
- `Camel :: Launcher` (53.2s)
- `Camel :: JBang :: MCP` (43.3s)
- `Camel :: JBang :: Plugin :: Kubernetes` (23.3s)
- `Camel :: YAML DSL :: Validator` (18.6s)
- `Camel :: JBang :: Plugin :: Testing` (10.8s)
- `Camel :: JBang :: Plugin :: Validate` (8.6s)
- `Camel :: Coverage` (5.4s)
- `Camel :: YAML DSL :: Validator Maven Plugin` (3.3s)
- `Camel :: JBang :: Plugin :: Generate` (1.7s)
- `Camel :: JBang :: Plugin :: MCP` (1.5s)
- `Camel :: JBang :: Plugin :: Edit` (1.4s)
- `Camel :: JBang :: Integration tests` (1.4s)
- `Camel :: JBang :: Plugin :: Route Parser` (0.9s)
- `Camel :: JBang :: Main` (0.9s)
- `Camel :: Launcher :: Container` (0.8s)
</details>
---
:gear: [View full build and test results](https://github.com/apache/camel/actions/runs/36832663199)
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang, camel-yaml-dsl-validator - parity of the YAML, Java and XML route checks; YAML errors on their line [camel]
Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #27181:
URL: https://github.com/apache/camel/pull/27181
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] chore: camel-jbang - parity of the YAML, Java and XML route checks and quick doc [camel]
Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #27181:
URL: https://github.com/apache/camel/pull/27181#issuecomment-5926905548
:star2: Thank you for your contribution to the Apache Camel project! :star2:
:robot: CI automation will test this PR automatically.
:camel: Apache Camel Committers, please review the following items:
* First-time contributors **require MANUAL approval** for the GitHub Actions to run
* You can use the command `/component-test (camel-)component-name1 (camel-)component-name2..` to request a test from the test bot although they are normally detected and executed by CI.
* You can label PRs using `skip-tests` and `test-dependents` to fine-tune the checks executed by this PR.
* Build and test logs are available in the summary page. **Only** [Apache Camel committers](https://camel.apache.org/community/team/#committers) have access to the summary.
:warning: Be careful when sharing logs. Review their contents before sharing them publicly.
--
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: commits-unsubscribe@camel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org