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

[Command validation] allow custom logic for IsZero #326

Open
hansbogert opened this issue Jul 8, 2021 · 0 comments
Open

[Command validation] allow custom logic for IsZero #326

hansbogert opened this issue Jul 8, 2021 · 0 comments
Labels
core Core components enhancement

Comments

@hansbogert
Copy link
Contributor

hansbogert commented Jul 8, 2021

Is your feature request related to a problem? Please describe.
Currently we have 2 cases, which the CheckCommand does not handle correctly imo.
We can't have the following commands with the following values:

OnlyValidStructIfAllFieldsAreNonZero {
  bar: ""
  bar2: "asdf"
}

Foo {
  bar: 0
}
  • OnlyValidStructIfAllFieldsAreNonZero is allowed by CheckCommand as at least one field is non-zero (bar2)
  • Foo is allowed by CheckCommand as (ironically) the number 0 is considered non-zero.

Describe the solution you'd like
If we introduce a IsZeroer interface, types used in Commands can optionally implement IsZero() and thus have their own semantic meaning of being zero-valued or not.

Describe alternatives you've considered
No alternatives

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core components enhancement
Development

No branches or pull requests

2 participants