Claus Ibsen created CAMEL-25560:
-----------------------------------
Summary: camel-yaml-dsl-validator - a key given twice in one
mapping is reported, as YAML keeps only the last one
Key: CAMEL-25560
URL: https://issues.apache.org/jira/browse/CAMEL-25560
Project: Camel
Issue Type: Improvement
Components: camel-yaml-dsl
Reporter: Claus Ibsen
A key written twice in one mapping passes validation: the validator reads the
YAML into a tree where the last value wins, and the YAML DSL loads the route
the same way, so the first value is lost without a word.
Found in the local-model benchmark, where an edit added a new message under a
log and left the old one:
{code:yaml}
- log:
message: " pick ${body[qty]} x ${body[sku]} for ${header.orderId}"
message: " pick ${body[qty]} x ${body[sku]}"
{code}
The route runs and logs the old message. Another file had two when: keys in one
choice, so one branch was gone.
The validator should report it with both lines, for example: line 22: message:
is given twice in this log: (lines 21 and 22); YAML keeps only the last one, so
the message: at line 21 is lost.
The validator Maven plugin does not fail the build on errors by default
(failOnError=false).
--
This message was sent by Atlassian Jira
(v8.20.10#820010)