Skip to content

[Command validation] allow custom logic for IsZero #326

Open
@hansbogert

Description

@hansbogert

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions