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

   [CAMEL-25327](https://issues.apache.org/jira/browse/CAMEL-25327)
   
   **The problem:** the source validator (`camel_write_file`, 
`camel_validate_source`, `camel validate source`) refused a bean whose class is 
in the project's Maven layout:
   
   ```yaml
   - beans:
     - name: orderNumber
       type: "#class:camel.example.OrderNumber"
   ```
   
   With `src/main/java/camel/example/OrderNumber.java` in the project, this 
failed with "class camel.example.OrderNumber was not found (check the package 
name; a class of your own goes in a .java file next to the route; ...)". Yet 
`camel run --source-dir` compiles and runs that layout: the route logs `New 
order ORD-1001`, `ORD-1002`. The cause is that 
`SourceValidator.BeanDeclarations.scan` only listed the files directly in the 
directory (`Files.list`).
   
   **The change:**
   - The scan also reads the `.java` files under `src/main/java`.
   - The hint now says "next to the route or under src/main/java".
   
   **Tests:**
   - New: 
`SourceValidatorBeanRefsTest.aClassOfTheProjectInTheMavenLayoutIsFound`. 
Without the class the error is reported; with it under `src/main/java` the bean 
is accepted. The test uses `com.acme.shop.ShipmentNumber`, because 
`camel.example.OrderNumber` is on camel-jbang-core's test classpath for the 
bundled example tests.
   - camel-jbang-core 1485 and camel-jbang-mcp 430, all pass.
   - End to end through the MCP server, the same `beans.yaml` in such a project 
is now `"valid": true`.
   
   **Local-model benchmark** (round 4, run/order-generator, 5 runs):
   - **Before:** the model put the class in the Maven layout, wrote a correct 
`beans.yaml`, was refused, and gave up. The example scored 11/20 steps (step 2 
1/5, step 4 1/5).
   - **With this fix:** 17/20 (step 2 3/5, step 4 5/5), with 2 runs passing 
every step against 0.
   - Part of that difference is run-to-run variation, but it is the largest 
single gain of the night.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   
   https://claude.ai/code/session_01STT6whBgK1AqsSsUKrnE8m
   


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