//go:build !ignore_autogenerated
// +build !ignore_autogenerated

/*
Copyright The Kubernetes Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by validation-gen. DO NOT EDIT.

package v1beta1

import (
	context "context"
	fmt "fmt"

	schedulingv1beta1 "k8s.io/api/scheduling/v1beta1"
	equality "k8s.io/apimachinery/pkg/api/equality"
	operation "k8s.io/apimachinery/pkg/api/operation"
	safe "k8s.io/apimachinery/pkg/api/safe"
	validate "k8s.io/apimachinery/pkg/api/validate"
	v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	validation "k8s.io/apimachinery/pkg/apis/meta/v1/validation"
	runtime "k8s.io/apimachinery/pkg/runtime"
	sets "k8s.io/apimachinery/pkg/util/sets"
	field "k8s.io/apimachinery/pkg/util/validation/field"
)

func init() { localSchemeBuilder.Register(RegisterValidations) }

// RegisterValidations adds validation functions to the given scheme.
// Public to allow building arbitrary schemes.
func RegisterValidations(scheme *runtime.Scheme) error {
	// type PodGroup
	scheme.AddValidationFunc(
		(*schedulingv1beta1.PodGroup)(nil),
		func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
			switch op.Request.SubresourcePath() {
			case "/", "/status":
				return Validate_PodGroup(
					ctx, op, nil, /* fldPath */
					obj.(*schedulingv1beta1.PodGroup),
					safe.Cast[*schedulingv1beta1.PodGroup](oldObj))
			}
			return field.ErrorList{
				field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath())),
			}
		})
	// type PriorityClass
	scheme.AddValidationFunc(
		(*schedulingv1beta1.PriorityClass)(nil),
		func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
			switch op.Request.SubresourcePath() {
			case "/":
				return Validate_PriorityClass(
					ctx, op, nil, /* fldPath */
					obj.(*schedulingv1beta1.PriorityClass),
					safe.Cast[*schedulingv1beta1.PriorityClass](oldObj))
			}
			return field.ErrorList{
				field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath())),
			}
		})
	// type Workload
	scheme.AddValidationFunc(
		(*schedulingv1beta1.Workload)(nil),
		func(ctx context.Context, op operation.Operation, obj, oldObj interface{}) field.ErrorList {
			switch op.Request.SubresourcePath() {
			case "/":
				return Validate_Workload(
					ctx, op, nil, /* fldPath */
					obj.(*schedulingv1beta1.Workload),
					safe.Cast[*schedulingv1beta1.Workload](oldObj))
			}
			return field.ErrorList{
				field.InternalError(nil, fmt.Errorf("no validation found for %T, subresource: %v", obj, op.Request.SubresourcePath())),
			}
		})
	return nil
}

var unionMembershipFor_k8s_io_api_scheduling_v1beta1_CompositeDisruptionMode_ = validate.NewUnionMembership(validate.NewUnionMember("single"), validate.NewUnionMember("all"))

// Validate_CompositeDisruptionMode validates an instance of CompositeDisruptionMode according
// to declarative validation rules in the API schema.
func Validate_CompositeDisruptionMode(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.CompositeDisruptionMode) (errs field.ErrorList) {

	if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1beta1_CompositeDisruptionMode_,
		func(obj *schedulingv1beta1.CompositeDisruptionMode) bool {
			if obj == nil {
				return false
			}
			return obj.Single != nil
		},
		func(obj *schedulingv1beta1.CompositeDisruptionMode) bool {
			if obj == nil {
				return false
			}
			return obj.All != nil
		}); len(e) != 0 {
		errs = append(errs, e...)
	}

	{ // field schedulingv1beta1.CompositeDisruptionMode.Single
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.SingleCompositeDisruptionMode,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositeDisruptionMode) *schedulingv1beta1.SingleCompositeDisruptionMode {
				return oldObj.Single
			})
		errs = append(errs, fn(fldPath.Child("single"), obj.Single, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositeDisruptionMode.All
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.AllCompositeDisruptionMode,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositeDisruptionMode) *schedulingv1beta1.AllCompositeDisruptionMode {
				return oldObj.All
			})
		errs = append(errs, fn(fldPath.Child("all"), obj.All, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_CompositeGangSchedulingPolicy validates an instance of CompositeGangSchedulingPolicy according
// to declarative validation rules in the API schema.
func Validate_CompositeGangSchedulingPolicy(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.CompositeGangSchedulingPolicy) (errs field.ErrorList) {

	{ // field schedulingv1beta1.CompositeGangSchedulingPolicy.MinGroupCount
		fn := func(
			fldPath *field.Path,
			obj, oldObj *int32,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositeGangSchedulingPolicy) *int32 {
				return &oldObj.MinGroupCount
			})
		errs = append(errs, fn(fldPath.Child("minGroupCount"), &obj.MinGroupCount, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_CompositePodGroupSchedulingConstraints validates an instance of CompositePodGroupSchedulingConstraints according
// to declarative validation rules in the API schema.
func Validate_CompositePodGroupSchedulingConstraints(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.CompositePodGroupSchedulingConstraints) (errs field.ErrorList) {

	{ // field schedulingv1beta1.CompositePodGroupSchedulingConstraints.Topology
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.TopologyConstraint,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 1).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_TopologyConstraint); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupSchedulingConstraints) []schedulingv1beta1.TopologyConstraint {
				return oldObj.Topology
			})
		errs = append(errs, fn(fldPath.Child("topology"), obj.Topology, oldVal, oldObj != nil)...)
	}

	return errs
}

var unionMembershipFor_k8s_io_api_scheduling_v1beta1_CompositePodGroupSchedulingPolicy_ = validate.NewUnionMembership(validate.NewUnionMember("basic"), validate.NewUnionMember("gang"))

// Validate_CompositePodGroupSchedulingPolicy validates an instance of CompositePodGroupSchedulingPolicy according
// to declarative validation rules in the API schema.
func Validate_CompositePodGroupSchedulingPolicy(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.CompositePodGroupSchedulingPolicy) (errs field.ErrorList) {

	if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1beta1_CompositePodGroupSchedulingPolicy_,
		func(obj *schedulingv1beta1.CompositePodGroupSchedulingPolicy) bool {
			if obj == nil {
				return false
			}
			return obj.Basic != nil
		},
		func(obj *schedulingv1beta1.CompositePodGroupSchedulingPolicy) bool {
			if obj == nil {
				return false
			}
			return obj.Gang != nil
		}); len(e) != 0 {
		errs = append(errs, e...)
	}

	{ // field schedulingv1beta1.CompositePodGroupSchedulingPolicy.Basic
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.CompositeBasicSchedulingPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupSchedulingPolicy) *schedulingv1beta1.CompositeBasicSchedulingPolicy {
				return oldObj.Basic
			})
		errs = append(errs, fn(fldPath.Child("basic"), obj.Basic, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupSchedulingPolicy.Gang
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.CompositeGangSchedulingPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoSet, validate.NoUnset).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_CompositeGangSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupSchedulingPolicy) *schedulingv1beta1.CompositeGangSchedulingPolicy {
				return oldObj.Gang
			})
		errs = append(errs, fn(fldPath.Child("gang"), obj.Gang, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_CompositePodGroupTemplate validates an instance of CompositePodGroupTemplate according
// to declarative validation rules in the API schema.
func Validate_CompositePodGroupTemplate(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.CompositePodGroupTemplate) (errs field.ErrorList) {

	{ // field schedulingv1beta1.CompositePodGroupTemplate.Name
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) *string {
				return &oldObj.Name
			})
		errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.SchedulingPolicy
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.CompositePodGroupSchedulingPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, Validate_CompositePodGroupSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) *schedulingv1beta1.CompositePodGroupSchedulingPolicy {
				return &oldObj.SchedulingPolicy
			})
		errs = append(errs, fn(fldPath.Child("schedulingPolicy"), &obj.SchedulingPolicy, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.SchedulingConstraints
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.CompositePodGroupSchedulingConstraints,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_CompositePodGroupSchedulingConstraints(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) *schedulingv1beta1.CompositePodGroupSchedulingConstraints {
				return oldObj.SchedulingConstraints
			})
		errs = append(errs, fn(fldPath.Child("schedulingConstraints"), obj.SchedulingConstraints, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.DisruptionMode
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.CompositeDisruptionMode,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_CompositeDisruptionMode(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) *schedulingv1beta1.CompositeDisruptionMode {
				return oldObj.DisruptionMode
			})
		errs = append(errs, fn(fldPath.Child("disruptionMode"), obj.DisruptionMode, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.PriorityClassName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) *string {
				return &oldObj.PriorityClassName
			})
		errs = append(errs, fn(fldPath.Child("priorityClassName"), &obj.PriorityClassName, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.Priority
		fn := func(
			fldPath *field.Path,
			obj, oldObj *int32,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 1000000000); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) *int32 {
				return oldObj.Priority
			})
		errs = append(errs, fn(fldPath.Child("priority"), obj.Priority, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.PreemptionPolicy
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PreemptionPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_PreemptionPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) *schedulingv1beta1.PreemptionPolicy {
				return oldObj.PreemptionPolicy
			})
		errs = append(errs, fn(fldPath.Child("preemptionPolicy"), obj.PreemptionPolicy, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.PodGroupTemplates
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.PodGroupTemplate,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupTemplate, b *schedulingv1beta1.PodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupTemplate, b *schedulingv1beta1.PodGroupTemplate) bool {
					return a.Name == b.Name
				}); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupTemplate, b *schedulingv1beta1.PodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.SemanticDeepEqual, Validate_PodGroupTemplate); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) []schedulingv1beta1.PodGroupTemplate {
				return oldObj.PodGroupTemplates
			})
		errs = append(errs, fn(fldPath.Child("podGroupTemplates"), obj.PodGroupTemplates, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.CompositePodGroupTemplate.CompositePodGroupTemplates
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.CompositePodGroupTemplate,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.CompositePodGroupTemplate, b *schedulingv1beta1.CompositePodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.CompositePodGroupTemplate, b *schedulingv1beta1.CompositePodGroupTemplate) bool {
					return a.Name == b.Name
				}); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.CompositePodGroupTemplate, b *schedulingv1beta1.CompositePodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.SemanticDeepEqual, Validate_CompositePodGroupTemplate); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.CompositePodGroupTemplate) []schedulingv1beta1.CompositePodGroupTemplate {
				return oldObj.CompositePodGroupTemplates
			})
		errs = append(errs, fn(fldPath.Child("compositePodGroupTemplates"), obj.CompositePodGroupTemplates, oldVal, oldObj != nil)...)
	}

	return errs
}

var unionMembershipFor_k8s_io_api_scheduling_v1beta1_DisruptionMode_ = validate.NewUnionMembership(validate.NewUnionMember("single"), validate.NewUnionMember("all"))

// Validate_DisruptionMode validates an instance of DisruptionMode according
// to declarative validation rules in the API schema.
func Validate_DisruptionMode(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.DisruptionMode) (errs field.ErrorList) {

	if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1beta1_DisruptionMode_,
		func(obj *schedulingv1beta1.DisruptionMode) bool {
			if obj == nil {
				return false
			}
			return obj.Single != nil
		},
		func(obj *schedulingv1beta1.DisruptionMode) bool {
			if obj == nil {
				return false
			}
			return obj.All != nil
		}); len(e) != 0 {
		errs = append(errs, e...)
	}

	{ // field schedulingv1beta1.DisruptionMode.Single
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.SingleDisruptionMode,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.DisruptionMode) *schedulingv1beta1.SingleDisruptionMode {
				return oldObj.Single
			})
		errs = append(errs, fn(fldPath.Child("single"), obj.Single, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.DisruptionMode.All
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.AllDisruptionMode,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.DisruptionMode) *schedulingv1beta1.AllDisruptionMode {
				return oldObj.All
			})
		errs = append(errs, fn(fldPath.Child("all"), obj.All, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_GangSchedulingPolicy validates an instance of GangSchedulingPolicy according
// to declarative validation rules in the API schema.
func Validate_GangSchedulingPolicy(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.GangSchedulingPolicy) (errs field.ErrorList) {

	{ // field schedulingv1beta1.GangSchedulingPolicy.MinCount
		fn := func(
			fldPath *field.Path,
			obj, oldObj *int32,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.Minimum(ctx, op, fldPath, obj, oldObj, 1); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.GangSchedulingPolicy) *int32 {
				return &oldObj.MinCount
			})
		errs = append(errs, fn(fldPath.Child("minCount"), &obj.MinCount, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_PodGroup validates an instance of PodGroup according
// to declarative validation rules in the API schema.
func Validate_PodGroup(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroup) (errs field.ErrorList) {

	// field schedulingv1beta1.PodGroup.TypeMeta has no validation

	{ // field schedulingv1beta1.PodGroup.ObjectMeta
		fn := func(
			fldPath *field.Path,
			obj, oldObj *v1.ObjectMeta,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, validation.Validate_ObjectMeta(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroup) *v1.ObjectMeta {
				return &oldObj.ObjectMeta
			})
		errs = append(errs, fn(fldPath.Child("metadata"), &obj.ObjectMeta, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroup.Spec
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PodGroupSpec,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, Validate_PodGroupSpec(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroup) *schedulingv1beta1.PodGroupSpec {
				return &oldObj.Spec
			})
		errs = append(errs, fn(fldPath.Child("spec"), &obj.Spec, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroup.Status
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PodGroupStatus,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, Validate_PodGroupStatus(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroup) *schedulingv1beta1.PodGroupStatus {
				return &oldObj.Status
			})
		errs = append(errs, fn(fldPath.Child("status"), &obj.Status, oldVal, oldObj != nil)...)
	}

	return errs
}

var unionMembershipFor_k8s_io_api_scheduling_v1beta1_PodGroupResourceClaim_ = validate.NewUnionMembership(validate.NewUnionMember("resourceClaimName"), validate.NewUnionMember("resourceClaimTemplateName"))

// Validate_PodGroupResourceClaim validates an instance of PodGroupResourceClaim according
// to declarative validation rules in the API schema.
func Validate_PodGroupResourceClaim(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroupResourceClaim) (errs field.ErrorList) {

	if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1beta1_PodGroupResourceClaim_,
		func(obj *schedulingv1beta1.PodGroupResourceClaim) bool {
			if obj == nil {
				return false
			}
			return obj.ResourceClaimName != nil
		},
		func(obj *schedulingv1beta1.PodGroupResourceClaim) bool {
			if obj == nil {
				return false
			}
			return obj.ResourceClaimTemplateName != nil
		}); len(e) != 0 {
		errs = append(errs, e...)
	}

	{ // field schedulingv1beta1.PodGroupResourceClaim.Name
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupResourceClaim) *string {
				return &oldObj.Name
			})
		errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupResourceClaim.ResourceClaimName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupResourceClaim) *string {
				return oldObj.ResourceClaimName
			})
		errs = append(errs, fn(fldPath.Child("resourceClaimName"), obj.ResourceClaimName, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupResourceClaim.ResourceClaimTemplateName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupResourceClaim) *string {
				return oldObj.ResourceClaimTemplateName
			})
		errs = append(errs, fn(fldPath.Child("resourceClaimTemplateName"), obj.ResourceClaimTemplateName, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_PodGroupResourceClaimStatus validates an instance of PodGroupResourceClaimStatus according
// to declarative validation rules in the API schema.
func Validate_PodGroupResourceClaimStatus(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroupResourceClaimStatus) (errs field.ErrorList) {

	// field schedulingv1beta1.PodGroupResourceClaimStatus.Name has no validation

	{ // field schedulingv1beta1.PodGroupResourceClaimStatus.ResourceClaimName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupResourceClaimStatus) *string {
				return oldObj.ResourceClaimName
			})
		errs = append(errs, fn(fldPath.Child("resourceClaimName"), obj.ResourceClaimName, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_PodGroupSchedulingConstraints validates an instance of PodGroupSchedulingConstraints according
// to declarative validation rules in the API schema.
func Validate_PodGroupSchedulingConstraints(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroupSchedulingConstraints) (errs field.ErrorList) {

	{ // field schedulingv1beta1.PodGroupSchedulingConstraints.Topology
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.TopologyConstraint,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 1).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj, nil, nil, Validate_TopologyConstraint); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSchedulingConstraints) []schedulingv1beta1.TopologyConstraint {
				return oldObj.Topology
			})
		errs = append(errs, fn(fldPath.Child("topology"), obj.Topology, oldVal, oldObj != nil)...)
	}

	return errs
}

var unionMembershipFor_k8s_io_api_scheduling_v1beta1_PodGroupSchedulingPolicy_ = validate.NewUnionMembership(validate.NewUnionMember("basic"), validate.NewUnionMember("gang"))

// Validate_PodGroupSchedulingPolicy validates an instance of PodGroupSchedulingPolicy according
// to declarative validation rules in the API schema.
func Validate_PodGroupSchedulingPolicy(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroupSchedulingPolicy) (errs field.ErrorList) {

	if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1beta1_PodGroupSchedulingPolicy_,
		func(obj *schedulingv1beta1.PodGroupSchedulingPolicy) bool {
			if obj == nil {
				return false
			}
			return obj.Basic != nil
		},
		func(obj *schedulingv1beta1.PodGroupSchedulingPolicy) bool {
			if obj == nil {
				return false
			}
			return obj.Gang != nil
		}); len(e) != 0 {
		errs = append(errs, e...)
	}

	{ // field schedulingv1beta1.PodGroupSchedulingPolicy.Basic
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.BasicSchedulingPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSchedulingPolicy) *schedulingv1beta1.BasicSchedulingPolicy {
				return oldObj.Basic
			})
		errs = append(errs, fn(fldPath.Child("basic"), obj.Basic, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSchedulingPolicy.Gang
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.GangSchedulingPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.UpdatePointer(ctx, op, fldPath, obj, oldObj, validate.NoSet, validate.NoUnset).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_GangSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSchedulingPolicy) *schedulingv1beta1.GangSchedulingPolicy {
				return oldObj.Gang
			})
		errs = append(errs, fn(fldPath.Child("gang"), obj.Gang, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_PodGroupSpec validates an instance of PodGroupSpec according
// to declarative validation rules in the API schema.
func Validate_PodGroupSpec(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroupSpec) (errs field.ErrorList) {

	if e := validate.DependentRequired(ctx, op, fldPath, obj, oldObj, "parentCompositePodGroupName",
		func(obj *schedulingv1beta1.PodGroupSpec) bool {
			if obj == nil {
				return false
			}
			return obj.ParentCompositePodGroupName != nil
		}, "workloadRef",
		func(obj *schedulingv1beta1.PodGroupSpec) bool {
			if obj == nil {
				return false
			}
			return obj.WorkloadRef != nil
		}).MarkAlpha(); len(e) != 0 {
		errs = append(errs, e...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.ParentCompositePodGroupName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *string {
				return oldObj.ParentCompositePodGroupName
			})
		errs = append(errs, fn(fldPath.Child("parentCompositePodGroupName"), obj.ParentCompositePodGroupName, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.WorkloadRef
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.WorkloadReference,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_WorkloadReference(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *schedulingv1beta1.WorkloadReference {
				return oldObj.WorkloadRef
			})
		errs = append(errs, fn(fldPath.Child("workloadRef"), obj.WorkloadRef, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.SchedulingPolicy
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PodGroupSchedulingPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, Validate_PodGroupSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *schedulingv1beta1.PodGroupSchedulingPolicy {
				return &oldObj.SchedulingPolicy
			})
		errs = append(errs, fn(fldPath.Child("schedulingPolicy"), &obj.SchedulingPolicy, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.SchedulingConstraints
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PodGroupSchedulingConstraints,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", true, validate.Immutable).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_PodGroupSchedulingConstraints(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *schedulingv1beta1.PodGroupSchedulingConstraints {
				return oldObj.SchedulingConstraints
			})
		errs = append(errs, fn(fldPath.Child("schedulingConstraints"), obj.SchedulingConstraints, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.ResourceClaims
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.PodGroupResourceClaim,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupResourceClaim, b *schedulingv1beta1.PodGroupResourceClaim) bool {
					return a.Name == b.Name
				}); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupResourceClaim, b *schedulingv1beta1.PodGroupResourceClaim) bool {
					return a.Name == b.Name
				}, validate.SemanticDeepEqual, Validate_PodGroupResourceClaim); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) []schedulingv1beta1.PodGroupResourceClaim {
				return oldObj.ResourceClaims
			})
		errs = append(errs, fn(fldPath.Child("resourceClaims"), obj.ResourceClaims, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.DisruptionMode
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.DisruptionMode,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			// optional fields with default values are effectively required
			if e := validate.RequiredPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_DisruptionMode(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *schedulingv1beta1.DisruptionMode {
				return oldObj.DisruptionMode
			})
		errs = append(errs, fn(fldPath.Child("disruptionMode"), obj.DisruptionMode, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.PriorityClassName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *string {
				return &oldObj.PriorityClassName
			})
		errs = append(errs, fn(fldPath.Child("priorityClassName"), &obj.PriorityClassName, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.Priority
		fn := func(
			fldPath *field.Path,
			obj, oldObj *int32,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 1000000000); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *int32 {
				return oldObj.Priority
			})
		errs = append(errs, fn(fldPath.Child("priority"), obj.Priority, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupSpec.PreemptionPolicy
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PreemptionPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_PreemptionPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupSpec) *schedulingv1beta1.PreemptionPolicy {
				return oldObj.PreemptionPolicy
			})
		errs = append(errs, fn(fldPath.Child("preemptionPolicy"), obj.PreemptionPolicy, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_PodGroupStatus validates an instance of PodGroupStatus according
// to declarative validation rules in the API schema.
func Validate_PodGroupStatus(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroupStatus) (errs field.ErrorList) {

	{ // field schedulingv1beta1.PodGroupStatus.Conditions
		fn := func(
			fldPath *field.Path,
			obj, oldObj []v1.Condition,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkAlpha().MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *v1.Condition, b *v1.Condition) bool { return a.Type == b.Type }).MarkAlpha(); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *v1.Condition, b *v1.Condition) bool { return a.Type == b.Type }, validate.SemanticDeepEqual, validation.Validate_Condition); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupStatus) []v1.Condition {
				return oldObj.Conditions
			})
		errs = append(errs, fn(fldPath.Child("conditions"), obj.Conditions, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupStatus.ResourceClaimStatuses
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.PodGroupResourceClaimStatus,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupResourceClaimStatus, b *schedulingv1beta1.PodGroupResourceClaimStatus) bool {
					return a.Name == b.Name
				}); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupResourceClaimStatus, b *schedulingv1beta1.PodGroupResourceClaimStatus) bool {
					return a.Name == b.Name
				}, validate.SemanticDeepEqual, Validate_PodGroupResourceClaimStatus); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupStatus) []schedulingv1beta1.PodGroupResourceClaimStatus {
				return oldObj.ResourceClaimStatuses
			})
		errs = append(errs, fn(fldPath.Child("resourceClaimStatuses"), obj.ResourceClaimStatuses, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_PodGroupTemplate validates an instance of PodGroupTemplate according
// to declarative validation rules in the API schema.
func Validate_PodGroupTemplate(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PodGroupTemplate) (errs field.ErrorList) {

	{ // field schedulingv1beta1.PodGroupTemplate.Name
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) *string {
				return &oldObj.Name
			})
		errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupTemplate.SchedulingPolicy
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PodGroupSchedulingPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, Validate_PodGroupSchedulingPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) *schedulingv1beta1.PodGroupSchedulingPolicy {
				return &oldObj.SchedulingPolicy
			})
		errs = append(errs, fn(fldPath.Child("schedulingPolicy"), &obj.SchedulingPolicy, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupTemplate.SchedulingConstraints
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PodGroupSchedulingConstraints,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "TopologyAwareWorkloadScheduling", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_PodGroupSchedulingConstraints(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) *schedulingv1beta1.PodGroupSchedulingConstraints {
				return oldObj.SchedulingConstraints
			})
		errs = append(errs, fn(fldPath.Child("schedulingConstraints"), obj.SchedulingConstraints, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupTemplate.ResourceClaims
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.PodGroupResourceClaim,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 4).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupResourceClaim, b *schedulingv1beta1.PodGroupResourceClaim) bool {
					return a.Name == b.Name
				}); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupResourceClaim, b *schedulingv1beta1.PodGroupResourceClaim) bool {
					return a.Name == b.Name
				}, validate.SemanticDeepEqual, Validate_PodGroupResourceClaim); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) []schedulingv1beta1.PodGroupResourceClaim {
				return oldObj.ResourceClaims
			})
		errs = append(errs, fn(fldPath.Child("resourceClaims"), obj.ResourceClaims, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupTemplate.DisruptionMode
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.DisruptionMode,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_DisruptionMode(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) *schedulingv1beta1.DisruptionMode {
				return oldObj.DisruptionMode
			})
		errs = append(errs, fn(fldPath.Child("disruptionMode"), obj.DisruptionMode, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupTemplate.PriorityClassName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) *string {
				return &oldObj.PriorityClassName
			})
		errs = append(errs, fn(fldPath.Child("priorityClassName"), &obj.PriorityClassName, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupTemplate.Priority
		fn := func(
			fldPath *field.Path,
			obj, oldObj *int32,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.Maximum(ctx, op, fldPath, obj, oldObj, 1000000000); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) *int32 {
				return oldObj.Priority
			})
		errs = append(errs, fn(fldPath.Child("priority"), obj.Priority, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.PodGroupTemplate.PreemptionPolicy
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.PreemptionPolicy,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.ForbiddenPointer).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", false, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "PodGroupPreemptionPolicy", true, validate.OptionalPointer).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_PreemptionPolicy(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PodGroupTemplate) *schedulingv1beta1.PreemptionPolicy {
				return oldObj.PreemptionPolicy
			})
		errs = append(errs, fn(fldPath.Child("preemptionPolicy"), obj.PreemptionPolicy, oldVal, oldObj != nil)...)
	}

	return errs
}

var symbolsForPreemptionPolicy = sets.New(schedulingv1beta1.PreemptLowerPriority, schedulingv1beta1.PreemptNever)

// Validate_PreemptionPolicy validates an instance of PreemptionPolicy according
// to declarative validation rules in the API schema.
func Validate_PreemptionPolicy(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PreemptionPolicy) (errs field.ErrorList) {

	if e := validate.Enum(ctx, op, fldPath, obj, oldObj, symbolsForPreemptionPolicy, nil); len(e) != 0 {
		errs = append(errs, e...)
	}

	return errs
}

// Validate_PriorityClass validates an instance of PriorityClass according
// to declarative validation rules in the API schema.
func Validate_PriorityClass(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.PriorityClass) (errs field.ErrorList) {

	// field schedulingv1beta1.PriorityClass.TypeMeta has no validation

	{ // field schedulingv1beta1.PriorityClass.ObjectMeta
		fn := func(
			fldPath *field.Path,
			obj, oldObj *v1.ObjectMeta,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, validation.Validate_ObjectMeta(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.PriorityClass) *v1.ObjectMeta {
				return &oldObj.ObjectMeta
			})
		errs = append(errs, fn(fldPath.Child("metadata"), &obj.ObjectMeta, oldVal, oldObj != nil)...)
	}

	// field schedulingv1beta1.PriorityClass.Value has no validation
	// field schedulingv1beta1.PriorityClass.GlobalDefault has no validation
	// field schedulingv1beta1.PriorityClass.Description has no validation
	// field schedulingv1beta1.PriorityClass.PreemptionPolicy has no validation
	return errs
}

// Validate_TopologyConstraint validates an instance of TopologyConstraint according
// to declarative validation rules in the API schema.
func Validate_TopologyConstraint(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.TopologyConstraint) (errs field.ErrorList) {

	{ // field schedulingv1beta1.TopologyConstraint.Key
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LabelKey(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.TopologyConstraint) *string {
				return &oldObj.Key
			})
		errs = append(errs, fn(fldPath.Child("key"), &obj.Key, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_TypedLocalObjectReference validates an instance of TypedLocalObjectReference according
// to declarative validation rules in the API schema.
func Validate_TypedLocalObjectReference(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.TypedLocalObjectReference) (errs field.ErrorList) {

	{ // field schedulingv1beta1.TypedLocalObjectReference.APIGroup
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.OptionalValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.TypedLocalObjectReference) *string {
				return &oldObj.APIGroup
			})
		errs = append(errs, fn(fldPath.Child("apiGroup"), &obj.APIGroup, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.TypedLocalObjectReference.Kind
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.PathSegmentName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.TypedLocalObjectReference) *string {
				return &oldObj.Kind
			})
		errs = append(errs, fn(fldPath.Child("kind"), &obj.Kind, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.TypedLocalObjectReference.Name
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.PathSegmentName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.TypedLocalObjectReference) *string {
				return &oldObj.Name
			})
		errs = append(errs, fn(fldPath.Child("name"), &obj.Name, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_Workload validates an instance of Workload according
// to declarative validation rules in the API schema.
func Validate_Workload(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.Workload) (errs field.ErrorList) {

	// field schedulingv1beta1.Workload.TypeMeta has no validation

	{ // field schedulingv1beta1.Workload.ObjectMeta
		fn := func(
			fldPath *field.Path,
			obj, oldObj *v1.ObjectMeta,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, validation.Validate_ObjectMeta(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.Workload) *v1.ObjectMeta {
				return &oldObj.ObjectMeta
			})
		errs = append(errs, fn(fldPath.Child("metadata"), &obj.ObjectMeta, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.Workload.Spec
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.WorkloadSpec,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call the type's validation function
			errs = append(errs, Validate_WorkloadSpec(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.Workload) *schedulingv1beta1.WorkloadSpec {
				return &oldObj.Spec
			})
		errs = append(errs, fn(fldPath.Child("spec"), &obj.Spec, oldVal, oldObj != nil)...)
	}

	return errs
}

// Validate_WorkloadReference validates an instance of WorkloadReference according
// to declarative validation rules in the API schema.
func Validate_WorkloadReference(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.WorkloadReference) (errs field.ErrorList) {

	{ // field schedulingv1beta1.WorkloadReference.WorkloadName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.LongName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.WorkloadReference) *string {
				return &oldObj.WorkloadName
			})
		errs = append(errs, fn(fldPath.Child("workloadName"), &obj.WorkloadName, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.WorkloadReference.TemplateName
		fn := func(
			fldPath *field.Path,
			obj, oldObj *string,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.RequiredValue(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			if e := validate.ShortName(ctx, op, fldPath, obj, oldObj); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.WorkloadReference) *string {
				return &oldObj.TemplateName
			})
		errs = append(errs, fn(fldPath.Child("templateName"), &obj.TemplateName, oldVal, oldObj != nil)...)
	}

	return errs
}

var unionMembershipFor_k8s_io_api_scheduling_v1beta1_WorkloadSpec_ = validate.NewUnionMembership(validate.NewUnionMember("podGroupTemplates"), validate.NewUnionMember("compositePodGroupTemplates"))

// Validate_WorkloadSpec validates an instance of WorkloadSpec according
// to declarative validation rules in the API schema.
func Validate_WorkloadSpec(
	ctx context.Context, op operation.Operation, fldPath *field.Path,
	obj, oldObj *schedulingv1beta1.WorkloadSpec) (errs field.ErrorList) {

	if e := validate.Union(ctx, op, fldPath, obj, oldObj, unionMembershipFor_k8s_io_api_scheduling_v1beta1_WorkloadSpec_,
		func(obj *schedulingv1beta1.WorkloadSpec) bool {
			if obj == nil {
				return false
			}
			return len(obj.PodGroupTemplates) != 0
		},
		func(obj *schedulingv1beta1.WorkloadSpec) bool {
			if obj == nil {
				return false
			}
			return len(obj.CompositePodGroupTemplates) != 0
		}); len(e) != 0 {
		errs = append(errs, e...)
	}

	{ // field schedulingv1beta1.WorkloadSpec.ControllerRef
		fn := func(
			fldPath *field.Path,
			obj, oldObj *schedulingv1beta1.TypedLocalObjectReference,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if obj == oldObj || (obj != nil && oldObj != nil && *obj == *oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.Immutable(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalPointer(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// call the type's validation function
			errs = append(errs, Validate_TypedLocalObjectReference(ctx, op, fldPath, obj, oldObj)...)
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.WorkloadSpec) *schedulingv1beta1.TypedLocalObjectReference {
				return oldObj.ControllerRef
			})
		errs = append(errs, fn(fldPath.Child("controllerRef"), obj.ControllerRef, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.WorkloadSpec.PodGroupTemplates
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.PodGroupTemplate,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.OptionalSlice(ctx, op, fldPath, obj, oldObj).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupTemplate, b *schedulingv1beta1.PodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupTemplate, b *schedulingv1beta1.PodGroupTemplate) bool {
					return a.Name == b.Name
				}); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.PodGroupTemplate, b *schedulingv1beta1.PodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.SemanticDeepEqual, Validate_PodGroupTemplate); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.WorkloadSpec) []schedulingv1beta1.PodGroupTemplate {
				return oldObj.PodGroupTemplates
			})
		errs = append(errs, fn(fldPath.Child("podGroupTemplates"), obj.PodGroupTemplates, oldVal, oldObj != nil)...)
	}

	{ // field schedulingv1beta1.WorkloadSpec.CompositePodGroupTemplates
		fn := func(
			fldPath *field.Path,
			obj, oldObj []schedulingv1beta1.CompositePodGroupTemplate,
			oldValueCorrelated bool) (errs field.ErrorList) {
			// don't revalidate unchanged data
			if oldValueCorrelated && op.Type == operation.Update {
				if equality.Semantic.DeepEqual(obj, oldObj) {
					return nil
				}
			}
			// call field-attached validations
			earlyReturn := false
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.ForbiddenSlice).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", false, validate.OptionalSlice).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.IfOption(ctx, op, fldPath, obj, oldObj, "CompositePodGroup", true, validate.OptionalSlice).MarkShortCircuit(); len(e) != 0 {
				earlyReturn = true
			}
			if e := validate.MaxItems(ctx, op, fldPath, obj, oldObj, 8).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if e := validate.ValSliceUpdate(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.CompositePodGroupTemplate, b *schedulingv1beta1.CompositePodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.NoAddItem, validate.NoRemoveItem).MarkShortCircuit(); len(e) != 0 {
				errs = append(errs, e...)
				earlyReturn = true
			}
			if earlyReturn {
				return // do not proceed
			}
			// lists with map semantics require unique keys
			if e := validate.ValSliceUnique(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.CompositePodGroupTemplate, b *schedulingv1beta1.CompositePodGroupTemplate) bool {
					return a.Name == b.Name
				}); len(e) != 0 {
				errs = append(errs, e...)
			}
			// iterate the list and call the type's validation function
			if e := validate.EachValSliceVal(ctx, op, fldPath, obj, oldObj,
				func(a *schedulingv1beta1.CompositePodGroupTemplate, b *schedulingv1beta1.CompositePodGroupTemplate) bool {
					return a.Name == b.Name
				}, validate.SemanticDeepEqual, Validate_CompositePodGroupTemplate); len(e) != 0 {
				errs = append(errs, e...)
			}
			return
		}
		oldVal := safe.Field(oldObj,
			func(oldObj *schedulingv1beta1.WorkloadSpec) []schedulingv1beta1.CompositePodGroupTemplate {
				return oldObj.CompositePodGroupTemplates
			})
		errs = append(errs, fn(fldPath.Child("compositePodGroupTemplates"), obj.CompositePodGroupTemplates, oldVal, oldObj != nil)...)
	}

	return errs
}
