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/09/22 08:04:31 UTC

[PR] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

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

   Fixes https://issues.apache.org/jira/browse/CAMEL-24888 (part of CAMEL-24886)
   
   On the HTTP rungs of the examples ladder (rest, http, rest-openapi) the local model failed 22 of 32 steps in the camel-jbang-mcp stepwise benchmark, and its refused writes cluster on seven shapes the validator did not name a fix for. Each gets a row, with the count of how often it was written:
   
   | shape | count | now says |
   |---|---|---|
   | `constant: null` to clear the body before a GET | 6 | constant is a text; write `setBody: {simple: {expression: "${null}"}}` |
   | `setExchangeProperty` (the closest schema name was `setExchangePattern`) | 4 | the EIP is `setProperty` (and `setProperties`, `removeProperty`, `setVariable` for the siblings) |
   | a double-quoted value never closed, `expression: "$[?(@.sku == '${header.sku}')]` | 5 | "line N: the value opens a double quote and never closes it", from the Jackson and the snakeyaml message alike |
   | `toD: {uri: ..., options: {...}}` | 2 | toD takes its options under `parameters:` like `to:`, or in the uri |
   | `library: jackson` | 2 | the library name is case sensitive: `Jackson` |
   | `jsonpath: {jsonPath: "..."}` | 2 | the text goes under `expression:` |
   | `rest-openapi` with a `path` option | 1 | a path parameter of the operation comes from a header of the same name |
   
   Tests: `YamlValidatorPropertyHintTest` (both schema modes) and `SourceValidatorPlaceholderTest`; the documentation example suites pass.
   
   🤖 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: commits-unsubscribe@camel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #26732:
URL: https://github.com/apache/camel/pull/26732#discussion_r4070054098


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/EndpointChecks.java:
##########
@@ -282,6 +282,16 @@ static String missingInRuntime(CamelCatalog catalog, String scheme) {
 
     /** Options models write that the component does not have, and what the component does instead. */
     static final Map<String, String> INVENTED_OPTIONS = Map.ofEntries(
+            // CAMEL-24888: the path parameters of an OpenAPI operation are headers of the same name
+            Map.entry("rest-openapi:path",
+                    "a path parameter of the operation, {sku} in /stock/{sku}, comes from a header of the same name: add"
+                                           + " setHeader: {name: sku, ...} before the call, the operation's path is in the contract"),
+            Map.entry("rest-openapi:pathParameters",
+                    "a path parameter of the operation comes from a header of the same name: add setHeader: {name: sku,"
+                                                     + " ...} before the call"),
+            Map.entry("rest-openapi:queryParameters",
+                    "a query parameter of the operation comes from a header of the same name: add setHeader before the"
+                                                      + " call"),

Review Comment:
   Taken as suggested: `queryParameters` now has the `{name: page, ...}` example, and the test exercises `pathParameters` and `queryParameters` next to `path`.



-- 
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] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26732:
URL: https://github.com/apache/camel/pull/26732#discussion_r4069910543


##########
dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/EndpointChecks.java:
##########
@@ -282,6 +282,16 @@ static String missingInRuntime(CamelCatalog catalog, String scheme) {
 
     /** Options models write that the component does not have, and what the component does instead. */
     static final Map<String, String> INVENTED_OPTIONS = Map.ofEntries(
+            // CAMEL-24888: the path parameters of an OpenAPI operation are headers of the same name
+            Map.entry("rest-openapi:path",
+                    "a path parameter of the operation, {sku} in /stock/{sku}, comes from a header of the same name: add"
+                                           + " setHeader: {name: sku, ...} before the call, the operation's path is in the contract"),
+            Map.entry("rest-openapi:pathParameters",
+                    "a path parameter of the operation comes from a header of the same name: add setHeader: {name: sku,"
+                                                     + " ...} before the call"),
+            Map.entry("rest-openapi:queryParameters",
+                    "a query parameter of the operation comes from a header of the same name: add setHeader before the"
+                                                      + " call"),

Review Comment:
   💡 **Inconsistent hint detail.** The `path` and `pathParameters` entries both give a concrete `{name: sku, ...}` example; this one stops at "add setHeader before the call" with no example. Consider aligning:
   
   ```suggestion
               Map.entry("rest-openapi:queryParameters",
                       "a query parameter of the operation comes from a header of the same name: add setHeader: {name: page,"
                                                         + " ...} before the call"),
   ```



-- 
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] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus merged PR #26732:
URL: https://github.com/apache/camel/pull/26732


-- 
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] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26732:
URL: https://github.com/apache/camel/pull/26732#issuecomment-5773638675

   <!-- ci-tested-modules -->
   :test_tube: **CI tested the following changed modules:**
   
   - `dsl/camel-jbang/camel-jbang-core`
   - `dsl/camel-yaml-dsl/camel-yaml-dsl-validator`
   
   ---
   
   <details><summary>:microscope: Scalpel shadow comparison — Scalpel: 8 of 692 tested, 8 compile-only — current: 8 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **17 affected modules** (current approach: 8).
   
   **Skip-tests mode would test 8 modules** (2 direct + 7 downstream), **skip tests for 8** (generated code, meta-modules)
   
   <details><summary>:warning: Modules only in Scalpel (9)</summary>
   
   - `camel-jbang-core`
   - `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>
   
   
   <details><summary>Modules Scalpel would test (8)</summary>
   
   - `camel-jbang-core` ← dsl/camel-jbang/camel-jbang-core/src/main/java/org/apache/camel/dsl/jbang/core/commands/ai/EndpointChecks.java, dsl/camel-jbang/camel-jbang-core/src/test/java/org/apache/camel/dsl/jbang/core/commands/ai/SourceValidatorPlaceholderTest.java
   - `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` ← downstream of org.apache.camel:camel-jbang-core
   - `camel-jbang-plugin-validate` ← downstream of org.apache.camel:camel-jbang-core
   - `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/SchemaHints.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/YamlValidatorPropertyHintTest.java
   - `camel-yaml-dsl-validator-maven-plugin` ← downstream of org.apache.camel:camel-yaml-dsl-validator
   
   </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
   
   :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 26s total)</summary>
   
   **Total reactor time:** 3m 26s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: Launcher | 59.1s | SUCCESS |
   | Camel :: JBang :: MCP | 42.7s | SUCCESS |
   | Camel :: JBang :: Plugin :: TUI | 37.3s | SUCCESS |
   | Camel :: JBang :: Plugin :: Kubernetes | 17.5s | SUCCESS |
   | Camel :: YAML DSL :: Validator | 12.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: Testing | 9.2s | SUCCESS |
   | Camel :: Coverage | 8.3s | SUCCESS |
   | Camel :: JBang :: Plugin :: Validate | 6.5s | SUCCESS |
   | Camel :: YAML DSL :: Validator Maven Plugin | 3.5s | SUCCESS |
   | Camel :: JBang :: Plugin :: Generate | 1.8s | SUCCESS |
   | Camel :: JBang :: Plugin :: Edit | 1.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: MCP | 1.3s | SUCCESS |
   | Camel :: JBang :: Integration tests | 1.0s | SUCCESS |
   | Camel :: JBang :: Plugin :: Route Parser | 1.0s | SUCCESS |
   | Camel :: JBang :: Main | 1.0s | SUCCESS |
   | Camel :: Launcher :: Container | 0.8s | SUCCESS |
   | Camel :: JBang :: Core | n/a |  |
   
   **Top 20 slowest modules:**
   - `Camel :: Launcher` (59.1s)
   - `Camel :: JBang :: MCP` (42.7s)
   - `Camel :: JBang :: Plugin :: TUI` (37.3s)
   - `Camel :: JBang :: Plugin :: Kubernetes` (17.5s)
   - `Camel :: YAML DSL :: Validator` (12.9s)
   - `Camel :: JBang :: Plugin :: Testing` (9.2s)
   - `Camel :: Coverage` (8.3s)
   - `Camel :: JBang :: Plugin :: Validate` (6.5s)
   - `Camel :: YAML DSL :: Validator Maven Plugin` (3.5s)
   - `Camel :: JBang :: Plugin :: Generate` (1.8s)
   - `Camel :: JBang :: Plugin :: Edit` (1.6s)
   - `Camel :: JBang :: Plugin :: MCP` (1.3s)
   - `Camel :: JBang :: Integration tests` (1.0s)
   - `Camel :: JBang :: Plugin :: Route Parser` (1.0s)
   - `Camel :: JBang :: Main` (1.0s)
   - `Camel :: Launcher :: Container` (0.8s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/35702838199)


-- 
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] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #26732:
URL: https://github.com/apache/camel/pull/26732#issuecomment-5773160955

   :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


Re: [PR] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

Posted by "davsclaus (via GitHub)" <gi...@apache.org>.
davsclaus commented on code in PR #26732:
URL: https://github.com/apache/camel/pull/26732#discussion_r4069857305


##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/SchemaHints.java:
##########
@@ -230,6 +236,13 @@ static Error apply(List<Hint> table, Error error, YamlValidator validator) {
                         return eip + " holds its EIPs under steps: " + eip + ": {steps: [- log: \"...\"]}"
                                + (eip.equals("doCatch") ? ", each - doCatch: item with exception: and steps:" : "");
                     }),
+            // setBody: {constant: null} to clear the body before a GET: constant is a text (CAMEL-24888)
+            append("type", ".*/constant(/expression)?", m -> m.message().contains("null found"),
+                    m -> "constant is a text; to set an empty body (a GET sends none) write setBody: {simple:"
+                         + " {expression: \"${null}\"}}"),
+            // library: jackson: the enumeration is case sensitive
+            append("enum", ".*/library", ANY,
+                    m -> "the library name is case sensitive: write library: Jackson (or Gson, Fastjson, Jsonb)"),

Review Comment:
   Good catch, the row fired for every `library` property with json's list. It now takes the entry of the data format's own enumeration (from the error's message) that matches the written value ignoring case: `library: jackson` says "write library: Jackson", `avro: {library: apacheavro}` says "write library: ApacheAvro", and with no such entry it says "case sensitive, write it as listed" and leaves the schema's list to speak. Test added for the avro case (its enumeration is ApacheAvro/Jackson).



-- 
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] CAMEL-24888: the validator says the shape for the seven mistakes of the HTTP rungs [camel]

Posted by "gnodet-bot (via GitHub)" <gi...@apache.org>.
gnodet-bot commented on code in PR #26732:
URL: https://github.com/apache/camel/pull/26732#discussion_r4069622887


##########
dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/SchemaHints.java:
##########
@@ -230,6 +236,13 @@ static Error apply(List<Hint> table, Error error, YamlValidator validator) {
                         return eip + " holds its EIPs under steps: " + eip + ": {steps: [- log: \"...\"]}"
                                + (eip.equals("doCatch") ? ", each - doCatch: item with exception: and steps:" : "");
                     }),
+            // setBody: {constant: null} to clear the body before a GET: constant is a text (CAMEL-24888)
+            append("type", ".*/constant(/expression)?", m -> m.message().contains("null found"),
+                    m -> "constant is a text; to set an empty body (a GET sends none) write setBody: {simple:"
+                         + " {expression: \"${null}\"}}"),
+            // library: jackson: the enumeration is case sensitive
+            append("enum", ".*/library", ANY,
+                    m -> "the library name is case sensitive: write library: Jackson (or Gson, Fastjson, Jsonb)"),

Review Comment:
   ⚠️ **Misleading hint for non-JSON `library` properties**
   
   The `.*/library` location pattern and `ANY` condition make this hint fire for **four** distinct `library` properties in the schema — not just JSON:
   
   | Data format | Valid `library` values |
   |---|---|
   | `json` | `Jackson`, `Gson`, `Fastjson`, `Jsonb` |
   | `avro` | `avroJackson`, `Jackson` |
   | `protobuf` | `GoogleProtobuf`, `Jackson` |
   | `yaml` (SnakeYAML) | `SnakeYAML` |
   
   If someone writes `marshal: { avro: { library: avrojackson } }` (wrong case), the hint will append "write library: Jackson (or **Gson, Fastjson, Jsonb**)" — all three of which are invalid for Avro. Same problem for Protobuf and the YAML data format.
   
   The fix is either to scope the location to the JSON data format path specifically, or to make the hint message generic (just "the library name is case sensitive — valid values are listed in the error above") and let the schema error's existing enum-mismatch message carry the actual list:
   
   ```suggestion
               // library: jackson: the enumeration is case sensitive (applies to json, avro, protobuf, yaml data formats)
               append("enum", ".*/library", ANY,
                       m -> "the library name is case sensitive"),
   ```
   
   That way the existing schema error message ("jackson is not valid, expected one of [Jackson, Fastjson, Gson, Jsonb]") already carries the correct list for whichever data format it is, and the hint just explains *why* it doesn't match.



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