code: func GetSchemaForVersion(crd *CustomResourceDefinition, version string) (*CustomResourceValidation, error) {
  	if !HasPerVersionSchema(crd.Spec.Versions) {
  		return crd.Spec.Validation, nil
  	}
  	if crd.Spec.Validation != nil {
  		return nil, fmt.Errorf("malformed CustomResourceDefinition %s version %s: top-level and per-version schemas must be mutual exclusive", crd.Name, version)
  	}
  	for _, v := range crd.Spec.Versions {
  		if version == v.Name {
  			return v.Schema, nil
  		}
  	}
  	return nil, fmt.Errorf("version %s not found in CustomResourceDefinition: %v", version, crd.Name)
  }
docs: // GetSchemaForVersion returns the validation schema for the given version or nil.