davsclaus opened a new pull request, #26403: URL: https://github.com/apache/camel/pull/26403
https://issues.apache.org/jira/browse/CAMEL-24723 The classic compact notation of the YAML DSL is deprecated in favour of the canonical (explicit) format. Two things say so today, neither well: - `camel validate yaml --canonical` rejected it but reported the raw schema errors: `property 'simple' is not defined in the schema and the schema does not allow additional properties`, `string found, object expected`. Nothing said it is the deprecated notation, what the canonical form of that line is, or that `camel validate normalize` rewrites the file. - The runtime WARN (`YAML DSL compact notation detected`) fired for a scalar step or language and a top-level `from:`, but not for a language key directly on the EIP (`setBody: {simple: {expression: ...}}`), the most common compact pattern, which loaded silently. **Validator** (`camel-yaml-dsl-validator`): in canonical mode the three schema error shapes the compact notation produces are replaced with one message per occurrence: ``` /0/route/from/steps/0/setBody: setBody: {simple: ...} is the deprecated compact notation: an expression is written under expression: (setBody: {expression: {simple: {expression: "..."}}}); camel validate normalize rewrites a file in the canonical format /0/route/from/steps/2/log: log: "..." is the deprecated compact notation: write log: {message: "..."}; camel validate normalize rewrites a file in the canonical format /0/route/from/steps/3/choice/when/0: a when item with simple: ... is the deprecated compact notation: an expression is written under expression: (- expression: {simple: {expression: "..."}}); ... /1/onException/handled/constant: constant: "..." is the deprecated compact notation: write constant: {expression: "..."}; ... ``` The canonical body of a language comes from the schema (`expression`, or `token` for tokenize); the property behind a step's string shorthand (`log` → `message`, `to` → `uri`, ...) is only in the model constructors, so it is a small map, with a generic wording for a step not in it. The classic validator is unchanged. **Runtime** (`camel-yaml-dsl-common`, the deserializer mojo): `YamlDeserializerBase.warnCompactNotation(node)` and the mojo emits it in the implicit-expression branch of every expression node (`ModelDeserializers` regenerated). `camel run` and the validator now agree on what the compact notation is. The WARN stays once per resource and `camel.main.yamlDslCompactNotationWarn=false` still disables it. Tests: `YamlCanonicalValidatorTest` asserts the exact messages for the seven shapes and that the classic validator stays quiet; `CompactNotationWarnTest` (camel-yaml-dsl) captures the WARN for the three compact shapes and its absence for a canonical route. camel-yaml-dsl 420/420, camel-yaml-dsl-validator 93/93. The `--canonical` option description and the yaml-dsl page follow. Not in this PR: the top-level `- from:` (without `route:`) is what the runtime WARN also fires on, but the canonical schema accepts it, so the validator does not report it; whether `from:` at the top level counts as compact is a separate question. Follows #26401 (CAMEL-24722). _Claude Code on behalf of davsclaus_ -- 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]
