apiextensions: clarify validation errors

This commit is contained in:
Dr. Stefan Schimanski 2019-11-08 09:57:00 +01:00
parent 94d3b86ad8
commit 4a35ce37c1

View File

@ -791,9 +791,9 @@ func ValidateCustomResourceDefinitionOpenAPISchema(schema *apiextensions.JSONSch
if schema.XMapType != nil && schema.Type != "object" { if schema.XMapType != nil && schema.Type != "object" {
if len(schema.Type) == 0 { if len(schema.Type) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("type"), "must be object if x-kubernetes-map-type is set")) allErrs = append(allErrs, field.Required(fldPath.Child("type"), "must be object if x-kubernetes-map-type is specified"))
} else { } else {
allErrs = append(allErrs, field.Invalid(fldPath.Child("type"), schema.Type, "must be object if x-kubernetes-map-type is set")) allErrs = append(allErrs, field.Invalid(fldPath.Child("type"), schema.Type, "must be object if x-kubernetes-map-type is specified"))
} }
} }
@ -803,9 +803,9 @@ func ValidateCustomResourceDefinitionOpenAPISchema(schema *apiextensions.JSONSch
if schema.XListType != nil && schema.Type != "array" { if schema.XListType != nil && schema.Type != "array" {
if len(schema.Type) == 0 { if len(schema.Type) == 0 {
allErrs = append(allErrs, field.Required(fldPath.Child("type"), "must be array if x-kubernetes-list-type is set")) allErrs = append(allErrs, field.Required(fldPath.Child("type"), "must be array if x-kubernetes-list-type is specified"))
} else { } else {
allErrs = append(allErrs, field.Invalid(fldPath.Child("type"), schema.Type, "must be array if x-kubernetes-list-type is set")) allErrs = append(allErrs, field.Invalid(fldPath.Child("type"), schema.Type, "must be array if x-kubernetes-list-type is specified"))
} }
} }