Fixed empty name error and also changed tests
This commit is contained in:
@@ -212,10 +212,11 @@ func ValidateObjectMeta(meta *api.ObjectMeta, requiresNamespace bool, nameFn Val
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("generateName", meta.GenerateName, qualifier))
|
||||
}
|
||||
}
|
||||
// if the generated name validates, but the calculated value does not, it's a problem with generation, and we
|
||||
// If the generated name validates, but the calculated value does not, it's a problem with generation, and we
|
||||
// report it here. This may confuse users, but indicates a programming bug and still must be validated.
|
||||
// If there are multiple fields out of which one is required then add a or as a seperator
|
||||
if len(meta.Name) == 0 {
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("name"))
|
||||
allErrs = append(allErrs, errs.NewFieldRequired("name or generateName"))
|
||||
} else {
|
||||
if ok, qualifier := nameFn(meta.Name, false); !ok {
|
||||
allErrs = append(allErrs, errs.NewFieldInvalid("name", meta.Name, qualifier))
|
||||
|
Reference in New Issue
Block a user