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

   # Description
   
   Fixes [CAMEL-23863](https://issues.apache.org/jira/browse/CAMEL-23863).
   
   Running `camel run --example=rest-api` failed at startup:
   
   ```
   ERROR ... org.apache.camel.main.MainSupport : Error starting Camel:
   Error constructing YAML node id: rest
    in file:.../rest-api.camel.yaml, line 2, column 5:
           path: /api
           ^
   ```
   
   **Root cause:** the bundled `rest-api.camel.yaml` placed a `steps:` key 
under `rest:` and defined verbs without a `to:` target. `steps` is not a valid 
property of the REST DSL `<rest>` element; verbs (`get`/`post`/`put`/`delete`) 
must be direct children of `rest`, each a list whose entries carry a `to:` 
target. The failure happens during route-model construction (not pure YAML 
parsing), which is why the reported position points at the first child line of 
the `rest` node.
   
   **Changes:**
   
   - Correct the verb structure in 
`dsl/camel-jbang/camel-jbang-core/src/main/resources/examples/rest-api/rest-api.camel.yaml`
 so the verbs are children of `rest` with `to:` targets routing `GET 
/api/hello` and `GET /api/hello/{name}` to `direct:hello` / `direct:hello-name` 
(the two routes the example already defines).
   - Add `ExampleRoutesLoadTest`, a parameterized test that loads every bundled 
example under `camel-jbang-core` through the routes loader, guarding all 
examples against this class of regression. A `camel.example.Greeter` test 
fixture mirrors the runtime-compiled bean so the `routes/beans.yaml` example 
parses.
   
   Verified the test fails on the pre-fix file with the original `Error 
constructing YAML node id: rest`, and passes after the fix (14 example cases).
   
   # 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).
   
   # Apache Camel coding standards and style
   
   - [x] I checked that each commit in the pull request has a meaningful 
subject line and body.
   - [x] 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.
   
   _Authored with Claude Code (Opus 4.8) on behalf of Adriano Machado._
   
   🤖 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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to