Closed danielnorberg closed 8 years ago
From how I think about the syntax, I feel multiple identical operators should also fail. Only one primary operator per task (not including the case of _check: & _error: usage, or multiple tasks within a task)
Yeah, tricky thing is that the yaml parsing happens before validation, and at that point the parser has already discarded all preceding identical keys.
Turns out though that the yaml parser can, at gunpoint, be persuaded into disallowing duplicate keys by injecting some validation logic. Kind of icky but it gets the job done.
SnakeYAML should have an option that throws an exception. It's good for all users. SnakeYAML is not on github (BitBucket!) but the author is still active.
Yeah, let's submit a SnakeYAML PR.
I opened an issue in the SnakeYAML project to propose adding this validation to SnakeYAML itself: https://bitbucket.org/asomov/snakeyaml/issues/337/option-to-disallow-duplicate-keys
Meanwhile, it seems that the very same issue has been addressed in the past by implementing a custom constructor, similarly to what my current PR does: https://jira.spring.io/browse/SPR-12318
Should we go ahead with my PR until we have managed to get unique key validation into SnakeYAML proper?
I.e., the below workflow definition should fail instead of silently just executing
echo bar
.Also, it might be worth considering if multiple identical keys should fail. In the below workflow definition the second
sh>
operator implicitly overrides the first operator when the yaml is parsed because yaml.