code: func ValidateCustomResourceDefinition(obj *apiextensions.CustomResourceDefinition) field.ErrorList {
  	nameValidationFn := func(name string, prefix bool) []string {
  		ret := genericvalidation.NameIsDNSSubdomain(name, prefix)
  		requiredName := obj.Spec.Names.Plural + "." + obj.Spec.Group
  		if name != requiredName {
  			ret = append(ret, fmt.Sprintf(`must be spec.names.plural+"."+spec.group`))
  		}
  		return ret
  	}
  
  	allErrs := genericvalidation.ValidateObjectMeta(&obj.ObjectMeta, false, nameValidationFn, field.NewPath("metadata"))
  	allErrs = append(allErrs, ValidateCustomResourceDefinitionSpec(&obj.Spec, field.NewPath("spec"))...)
  	allErrs = append(allErrs, ValidateCustomResourceDefinitionStatus(&obj.Status, field.NewPath("status"))...)
  	allErrs = append(allErrs, ValidateCustomResourceDefinitionStoredVersions(obj.Status.StoredVersions, obj.Spec.Versions, field.NewPath("status").Child("storedVersions"))...)
  	return allErrs
  }
docs: // ValidateCustomResourceDefinition statically validates