Enum fields must be required or have a default.

This is a breaking change, but the previous behaviour was broken so I'm
not concerned.

Also made most programmer errors more useful by giving type.field
context information.

Fixes #179.
This commit is contained in:
Alec Thomas
2021-06-21 20:32:40 +09:30
parent c494f8b8f3
commit 247574041d
7 changed files with 33 additions and 23 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ func TestMultipleConfigLoading(t *testing.T) {
func TestConfigValidation(t *testing.T) {
var cli struct {
Flag string `json:"flag,omitempty" enum:"valid"`
Flag string `json:"flag,omitempty" enum:"valid" required:""`
}
cli.Flag = "invalid"