diff --git a/pkg/api/errors/errors_test.go b/pkg/api/errors/errors_test.go index d33db59b4b4..01a0a39aaae 100644 --- a/pkg/api/errors/errors_test.go +++ b/pkg/api/errors/errors_test.go @@ -122,7 +122,7 @@ func TestNewInvalid(t *testing.T) { t.Errorf("%d: unexpected status: %#v", i, status) } if !reflect.DeepEqual(expected, status.Details) { - t.Errorf("%d: expected %#v, got %#v", expected, status.Details) + t.Errorf("%d: expected %#v, got %#v", i, expected, status.Details) } } } diff --git a/pkg/api/errors/validation.go b/pkg/api/errors/validation.go index 6626f0c76bb..bd9ac72d53c 100644 --- a/pkg/api/errors/validation.go +++ b/pkg/api/errors/validation.go @@ -28,22 +28,23 @@ import ( // CauseType in api/types.go. type ValidationErrorType string +// TODO: These values are duplicated in api/types.go, but there's a circular dep. Fix it. const ( // ValidationErrorTypeNotFound is used to report failure to find a requested value // (e.g. looking up an ID). - ValidationErrorTypeNotFound ValidationErrorType = "fieldValueNotFound" + ValidationErrorTypeNotFound ValidationErrorType = "FieldValueNotFound" // ValidationErrorTypeRequired is used to report required values that are not // provided (e.g. empty strings, null values, or empty arrays). - ValidationErrorTypeRequired ValidationErrorType = "fieldValueRequired" + ValidationErrorTypeRequired ValidationErrorType = "FieldValueRequired" // ValidationErrorTypeDuplicate is used to report collisions of values that must be // unique (e.g. unique IDs). - ValidationErrorTypeDuplicate ValidationErrorType = "fieldValueDuplicate" + ValidationErrorTypeDuplicate ValidationErrorType = "FieldValueDuplicate" // ValidationErrorTypeInvalid is used to report malformed values (e.g. failed regex // match). - ValidationErrorTypeInvalid ValidationErrorType = "fieldValueInvalid" + ValidationErrorTypeInvalid ValidationErrorType = "FieldValueInvalid" // ValidationErrorTypeNotSupported is used to report valid (as per formatting rules) // values that can not be handled (e.g. an enumerated string). - ValidationErrorTypeNotSupported ValidationErrorType = "fieldValueNotSupported" + ValidationErrorTypeNotSupported ValidationErrorType = "FieldValueNotSupported" ) func ValueOf(t ValidationErrorType) string { diff --git a/pkg/api/types.go b/pkg/api/types.go index 7a8eb24140d..a081f0a7e12 100644 --- a/pkg/api/types.go +++ b/pkg/api/types.go @@ -591,19 +591,19 @@ type CauseType string const ( // CauseTypeFieldValueNotFound is used to report failure to find a requested value // (e.g. looking up an ID). - CauseTypeFieldValueNotFound CauseType = "fieldValueNotFound" + CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound" // CauseTypeFieldValueInvalid is used to report required values that are not // provided (e.g. empty strings, null values, or empty arrays). - CauseTypeFieldValueRequired CauseType = "fieldValueRequired" + CauseTypeFieldValueRequired CauseType = "FieldValueRequired" // CauseTypeFieldValueDuplicate is used to report collisions of values that must be // unique (e.g. unique IDs). - CauseTypeFieldValueDuplicate CauseType = "fieldValueDuplicate" + CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate" // CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex // match). - CauseTypeFieldValueInvalid CauseType = "fieldValueInvalid" + CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid" // CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules) // values that can not be handled (e.g. an enumerated string). - CauseTypeFieldValueNotSupported CauseType = "fieldValueNotSupported" + CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported" ) // ServerOp is an operation delivered to API clients. diff --git a/pkg/api/v1beta1/types.go b/pkg/api/v1beta1/types.go index 6d7ff9994d6..12131d35ccf 100644 --- a/pkg/api/v1beta1/types.go +++ b/pkg/api/v1beta1/types.go @@ -594,19 +594,19 @@ type CauseType string const ( // CauseTypeFieldValueNotFound is used to report failure to find a requested value // (e.g. looking up an ID). - CauseTypeFieldValueNotFound CauseType = "fieldValueNotFound" + CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound" // CauseTypeFieldValueInvalid is used to report required values that are not // provided (e.g. empty strings, null values, or empty arrays). - CauseTypeFieldValueRequired CauseType = "fieldValueRequired" + CauseTypeFieldValueRequired CauseType = "FieldValueRequired" // CauseTypeFieldValueDuplicate is used to report collisions of values that must be // unique (e.g. unique IDs). - CauseTypeFieldValueDuplicate CauseType = "fieldValueDuplicate" + CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate" // CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex // match). - CauseTypeFieldValueInvalid CauseType = "fieldValueInvalid" + CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid" // CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules) // values that can not be handled (e.g. an enumerated string). - CauseTypeFieldValueNotSupported CauseType = "fieldValueNotSupported" + CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported" ) // ServerOp is an operation delivered to API clients. diff --git a/pkg/api/v1beta2/types.go b/pkg/api/v1beta2/types.go index 2cdbcf619dc..7f320f7c807 100644 --- a/pkg/api/v1beta2/types.go +++ b/pkg/api/v1beta2/types.go @@ -604,19 +604,19 @@ type CauseType string const ( // CauseTypeFieldValueNotFound is used to report failure to find a requested value // (e.g. looking up an ID). - CauseTypeFieldValueNotFound CauseType = "fieldValueNotFound" + CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound" // CauseTypeFieldValueInvalid is used to report required values that are not // provided (e.g. empty strings, null values, or empty arrays). - CauseTypeFieldValueRequired CauseType = "fieldValueRequired" + CauseTypeFieldValueRequired CauseType = "FieldValueRequired" // CauseTypeFieldValueDuplicate is used to report collisions of values that must be // unique (e.g. unique IDs). - CauseTypeFieldValueDuplicate CauseType = "fieldValueDuplicate" + CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate" // CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex // match). - CauseTypeFieldValueInvalid CauseType = "fieldValueInvalid" + CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid" // CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules) // values that can not be handled (e.g. an enumerated string). - CauseTypeFieldValueNotSupported CauseType = "fieldValueNotSupported" + CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported" ) // ServerOp is an operation delivered to API clients. diff --git a/pkg/api/v1beta3/types.go b/pkg/api/v1beta3/types.go index 485307326b2..26c75c57b22 100644 --- a/pkg/api/v1beta3/types.go +++ b/pkg/api/v1beta3/types.go @@ -600,19 +600,19 @@ type CauseType string const ( // CauseTypeFieldValueNotFound is used to report failure to find a requested value // (e.g. looking up an ID). - CauseTypeFieldValueNotFound CauseType = "fieldValueNotFound" + CauseTypeFieldValueNotFound CauseType = "FieldValueNotFound" // CauseTypeFieldValueInvalid is used to report required values that are not // provided (e.g. empty strings, null values, or empty arrays). - CauseTypeFieldValueRequired CauseType = "fieldValueRequired" + CauseTypeFieldValueRequired CauseType = "FieldValueRequired" // CauseTypeFieldValueDuplicate is used to report collisions of values that must be // unique (e.g. unique IDs). - CauseTypeFieldValueDuplicate CauseType = "fieldValueDuplicate" + CauseTypeFieldValueDuplicate CauseType = "FieldValueDuplicate" // CauseTypeFieldValueInvalid is used to report malformed values (e.g. failed regex // match). - CauseTypeFieldValueInvalid CauseType = "fieldValueInvalid" + CauseTypeFieldValueInvalid CauseType = "FieldValueInvalid" // CauseTypeFieldValueNotSupported is used to report valid (as per formatting rules) // values that can not be handled (e.g. an enumerated string). - CauseTypeFieldValueNotSupported CauseType = "fieldValueNotSupported" + CauseTypeFieldValueNotSupported CauseType = "FieldValueNotSupported" ) // ServerOp is an operation delivered to API clients.