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

   ## Description
   
   `camel run` warns on a top-level `- from:` without `- route:` as the compact 
notation, while `camel validate yaml --canonical` accepted it because the 
canonical schema listed `from` among its top-level entries. The two now agree, 
on the side of the runtime: the canonical form requires `route:`.
   
   The reasoning, from the Jira: XML routes have always been `<route>` with 
`<from>` inside, and the YAML DSL follows the XML shape, so YAML is always `- 
route:` too. The Java DSL is the exception, where `from("...")` on a 
RouteBuilder is itself the route, but that is a Java convenience, not a 
document shape. Kaoto and Karavan both write the `- route:` form, so the 
editors already produce the canonical shape.
   
   - **Schema generator** (`GenerateYamlSchemaMojo`): in canonical mode a 
`@YamlIn` type whose only node is the compact `from` is left out, so 
`camelYamlDsl-canonical.json` has no top-level `from` and no orphan definition 
for it. The completion model loses the top-level `from` list item; the `from` 
node itself (under `route`) is unchanged. The classic schema is unchanged.
   - **Validator** (`SchemaHints.COMPACT`): a top-level `from:` is reported the 
way the other compact shapes are, with the form to write:
     ```
     /0: a top-level from: is the deprecated compact notation: a route is 
written under route: (- route: {from: {uri: "...", steps: [...]}}); camel 
validate normalize rewrites a file in the canonical format
     ```
     `camel validate normalize` already rewrites it (the dump is of 
`RouteDefinition`s, so it comes out as `- route:`).
   - **Docs**: the YAML DSL page's six `- from:` examples are written in the `- 
route:` form, the compact notation and canonical schema sections say a 
top-level `from:` is compact, and the 4.23 upgrade guide has a note.
   
   Nothing the CLI ships uses the top-level `from`: the bundled examples, the 
`camel init` templates, the MCP scaffolds and the catalog samples are all `- 
route:` (their canonical-mode tests keep passing). The `camel validate` and MCP 
`camel_validate_source` tools validate with the classic schema, so only 
`--canonical` reports the shape.
   
   ## Tests
   
   - `YamlCanonicalValidatorTest.testTopLevelFromIsReportedWithTheRouteForm`: 
the classic schema accepts the file, the canonical schema reports the one line 
above.
   - The two validator tests that ran a top-level `from:` through canonical 
mode (expression hints, scalar leniency) now use the route form.
   - All 107 validator tests green against the regenerated schema.
   
   🤖 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: [email protected]

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

Reply via email to