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/18 12:59:49 UTC

[PR] CAMEL-25762: camel-jbang - the validator learns the OpenAPI operations and the REST binding mode beside a route [camel]

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

   ## What
   
   [CAMEL-25762](https://issues.apache.org/jira/browse/CAMEL-25762), the follow-up of the parsed-data check of [CAMEL-24844](https://issues.apache.org/jira/browse/CAMEL-24844) (#28047).
   
   That check could not see facts that live outside the route file. camel-jbang now reads them from the files beside the route and passes them to the YAML validator, as it already passed the endpoints of the operations with no body (`OpenApiVerbs`):
   
   - **The OpenAPI operations the file uses:** from the specification of a contract-first binding and of rest-openapi calls (`rest-openapi:spec#op`, a bare operation id with the default `openapi.json`, or the `specificationUri` and `operationId` options), beside the route or in `src/main/resources`. This gives the verb of each operationId.
   - **The REST binding mode the project sets:** `camel.rest.bindingMode` / `binding-mode` in `application*.properties` or `.yaml`, profiles included. When none is set, it is `off`. When any of the files sets a binding that writes data, that wins, so a route bound only in some profiles stays quiet.
   
   With those facts the validator reports:
   
   - **a rest-openapi call to a POST, PUT or PATCH operation that is given parsed data.** The producer calls with the verb of the specification, whatever the headers say. Example:
     ```
     route reserve-order-lines: to: rest-openapi sends the body as the request of the operation reserveStock (POST in stock-api.json), but the body here is parsed data (a Map or a List), not text - unmarshal: json turns the text into data, and split $.lines gives its elements as data: add marshal: json before this step, or let the REST binding write it (bindingMode: json)
     ```
   - **the end of a REST route that is parsed data:** the route of a REST verb (`rest: get: ... to: direct:x`), or a contract-first operation's `direct:<operationId>` route. Example: `the body at the end of the route is the reply to the REST call ... add marshal: json as the last step, or let the REST binding write it (bindingMode: json)`.
   
   Both are only reported when no binding mode in the file (restConfiguration, rest, verb, openApi) or in the properties can write the data. When the facts are not known (no directory, as in the TUI editor's check), nothing new is said.
   
   Also:
   - A `split` with jsonpath (`$.lines`), whose steps read fields of each element with jsonpath (`$.sku`), now counts as giving data, as the simple form already did.
   - The walk's parameters are folded into one `Walk` record.
   - The validator API gains `YamlValidator.validate(String, ProjectFacts)`. The existing overloads delegate to it.
   
   ## Measured
   
   | corpus | route files | reports |
   |---|---|---|
   | human-written YAML, with the facts of each file's own directory: camel, camel-jbang-examples, camel-examples, camel-kamelets, camel-k, camel-kit, camel-spring-boot-examples, camel-quarkus-examples | 1101 (7 use an OpenAPI specification) | 0 |
   | r17 series: every version the model wrote, rebuilt from the traces, with the specification and properties of its ladder example | 1169 | 17, all real |
   
   Of the 14 r17 runs that failed at runtime on parsed data, 10 are now reported before running, up from 2 with #28047 alone:
   
   | kind | caught |
   |---|---|
   | rest-openapi calls | 5 of 6 |
   | REST replies | 3 of 3 |
   | http producer | 2 of 3 |
   
   The two reports without a runtime collision were real bugs too:
   - one version POSTed the Map line before the model's next edit moved the `setBody` in front of the call;
   - one GET operation replied with the List from `unmarshal`, in a step that failed.
   
   The 4 runs still missed: 2 file writes inside `onException` (the walk does not follow error handlers), and 2 versions my replay of the traces cannot rebuild.
   
   ## Tests
   
   - **camel-yaml-dsl-validator:** `TextBodyFlowTest` covers rest-openapi in the URI, options and `file:` forms, the jsonpath split, REST verb replies, contract-first replies, and the quiet cases (GET, unknown operation or spec, a binding in the properties, in restConfiguration, on the rest or on the verb, unknown facts). Module: 260 tests, 0 failures.
   - **camel-jbang-core:** `ValidatorFactsTest` covers JSON and YAML specifications, the default `openapi.json`, binding modes from properties, profiles and YAML, comments, and `SourceValidator` end to end. Module: 2300 + 237 tests, 0 failures, run locally against the new validator through a scratch local repository.
   
   _Claude Code on behalf of 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: commits-unsubscribe@camel.apache.org

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


Re: [PR] CAMEL-25762: camel-jbang - the validator learns the OpenAPI operations and the REST binding mode beside a route [camel]

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

   <!-- 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`
   
   :repeat: **1 test passed only after a retry on JDK 17** (1 retried attempt)
   
   <details><summary>Recovered flaky tests on JDK 17 (1)</summary>
   
   | Module | Test | Failed attempts | First failure |
   | --- | --- | --- | --- |
   | `dsl/camel-jbang/camel-jbang-plugin-tui` | `LaunchManagerOutcomeTest.startedWhenTheStatusFileSaysSo` | 1 | expected: null but was: LaunchOutcome[ok=false, log=null] |
   
   > :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: 7 of 706 tested, 8 compile-only — current: 7 all tested</summary>
   
   [Maveniverse Scalpel](https://github.com/maveniverse/scalpel) detected **7 affected modules** (current approach: 7).
   
   **Skip-tests mode would test 7 modules** (2 direct + 6 downstream), **skip tests for 8** (generated code, meta-modules)
   
   <details><summary>Modules Scalpel would test (7)</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-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/ProjectFacts.java, dsl/camel-yaml-dsl/camel-yaml-dsl-validator/src/main/java/org/apache/camel/dsl/yaml/validator/TextBodyFlow.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/TextBodyFlowTest.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 (16 modules, 3m 19s total)</summary>
   
   **Total reactor time:** 3m 19s
   
   | Module | Duration | Status |
   | --- | --- | --- |
   | Camel :: Launcher | 52.1s | SUCCESS |
   | Camel :: JBang :: MCP | 44.9s | SUCCESS |
   | Camel :: JBang :: Plugin :: Validate | 30.7s | SUCCESS |
   | Camel :: YAML DSL :: Validator | 26.0s | SUCCESS |
   | Camel :: JBang :: Plugin :: Testing | 15.2s | SUCCESS |
   | Camel :: JBang :: Plugin :: Kubernetes | 14.6s | SUCCESS |
   | Camel :: Coverage | 5.1s | SUCCESS |
   | Camel :: YAML DSL :: Validator Maven Plugin | 3.5s | SUCCESS |
   | Camel :: JBang :: Plugin :: Generate | 1.6s | SUCCESS |
   | Camel :: JBang :: Plugin :: Edit | 1.5s | SUCCESS |
   | Camel :: JBang :: Plugin :: MCP | 1.3s | SUCCESS |
   | Camel :: JBang :: Integration tests | 1.0s | SUCCESS |
   | Camel :: JBang :: Main | 0.8s | SUCCESS |
   | Camel :: Launcher :: Container | 0.8s | SUCCESS |
   | Camel :: JBang :: Core | n/a |  |
   | Camel :: JBang :: Plugin :: TUI | n/a |  |
   
   **Top 20 slowest modules:**
   - `Camel :: Launcher` (52.1s)
   - `Camel :: JBang :: MCP` (44.9s)
   - `Camel :: JBang :: Plugin :: Validate` (30.7s)
   - `Camel :: YAML DSL :: Validator` (26.0s)
   - `Camel :: JBang :: Plugin :: Testing` (15.2s)
   - `Camel :: JBang :: Plugin :: Kubernetes` (14.6s)
   - `Camel :: Coverage` (5.1s)
   - `Camel :: YAML DSL :: Validator Maven Plugin` (3.5s)
   - `Camel :: JBang :: Plugin :: Generate` (1.6s)
   - `Camel :: JBang :: Plugin :: Edit` (1.5s)
   - `Camel :: JBang :: Plugin :: MCP` (1.3s)
   - `Camel :: JBang :: Integration tests` (1.0s)
   - `Camel :: JBang :: Main` (0.8s)
   - `Camel :: Launcher :: Container` (0.8s)
   
   </details>
   
   ---
   :gear: [View full build and test results](https://github.com/apache/camel/actions/runs/39129610650)


-- 
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-25762: camel-jbang - the validator learns the OpenAPI operations and the REST binding mode beside a route [camel]

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


-- 
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-25762: camel-jbang - the validator learns the OpenAPI operations and the REST binding mode beside a route [camel]

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

   :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