Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

digdag should fail on multiple operators within a task #21

Closed
danielnorberg opened this issue Mar 25, 2016 · 6 comments
Closed

digdag should fail on multiple operators within a task #21

danielnorberg opened this issue Mar 25, 2016 · 6 comments

Comments

@danielnorberg
Copy link
Contributor

I.e., the below workflow definition should fail instead of silently just executing echo bar.

run: +foo
+foo:
  sh>: echo bar
  py>: baz

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.

run: +foo
+foo:
  sh>: echo bar
  sh>: echo baz
@rbparrish
Copy link
Contributor

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)

@danielnorberg
Copy link
Contributor Author

Yeah, tricky thing is that the yaml parsing happens before validation, and at that point the parser has already discarded all preceding identical keys.

@danielnorberg
Copy link
Contributor Author

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.

@frsyuki
Copy link
Member

frsyuki commented Mar 25, 2016

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.

@danielnorberg
Copy link
Contributor Author

Yeah, let's submit a SnakeYAML PR.

@danielnorberg
Copy link
Contributor Author

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?

yoyama added a commit that referenced this issue Jan 24, 2022
Implement WM-1351 enhance /api/projects
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants