From 51828370417a6cce0cf7b271a5ee49bf3b01734c Mon Sep 17 00:00:00 2001 From: Scott Nichols <32305648+n3wscott@users.noreply.github.com> Date: Thu, 2 Aug 2018 13:13:38 -0700 Subject: [PATCH] flipped the error text around. fixed. (#36) --- apis/field_error.go | 4 ++-- apis/field_error_test.go | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/apis/field_error.go b/apis/field_error.go index e7ca1d3dc..fff9b6f2b 100644 --- a/apis/field_error.go +++ b/apis/field_error.go @@ -116,7 +116,7 @@ func ErrInvalidValue(value, fieldPath string) *FieldError { // not having at least one field in a mutually exclusive field group. func ErrMissingOneOf(fieldPaths ...string) *FieldError { return &FieldError{ - Message: "expected exactly one, got both", + Message: "expected exactly one, got neither", Paths: fieldPaths, } } @@ -125,7 +125,7 @@ func ErrMissingOneOf(fieldPaths ...string) *FieldError { // for having more than one field set in a mutually exclusive field group. func ErrMultipleOneOf(fieldPaths ...string) *FieldError { return &FieldError{ - Message: "expected exactly one, got neither", + Message: "expected exactly one, got both", Paths: fieldPaths, } } diff --git a/apis/field_error_test.go b/apis/field_error_test.go index 1eea0410c..677cc119b 100644 --- a/apis/field_error_test.go +++ b/apis/field_error_test.go @@ -105,12 +105,12 @@ Body.`, name: "missing mutually exclusive fields", err: ErrMissingOneOf("foo", "bar"), prefixes: [][]string{{"baz"}}, - want: `expected exactly one, got both: baz.foo, baz.bar`, + want: `expected exactly one, got neither: baz.foo, baz.bar`, }, { name: "multiple mutually exclusive fields", err: ErrMultipleOneOf("foo", "bar"), prefixes: [][]string{{"baz"}}, - want: `expected exactly one, got neither: baz.foo, baz.bar`, + want: `expected exactly one, got both: baz.foo, baz.bar`, },{ name: "invalid key name", err: ErrInvalidKeyName("b@r", "foo[0].name",