func (ss *ServiceSpec) Validate() *apis.FieldError {
	var errs *apis.FieldError
	set := []string{}
	if ss.RunLatest != nil {
		set = append(set, "runLatest")
		errs = errs.Also(ss.RunLatest.Validate().ViaField("runLatest"))
	}
	if ss.Release != nil {
		set = append(set, "release")
		errs = errs.Also(ss.Release.Validate().ViaField("release"))
	}
	if ss.Manual != nil {
		set = append(set, "manual")
		errs = errs.Also(ss.Manual.Validate().ViaField("manual"))
	}
	if ss.Pinned != nil {
		set = append(set, "pinned")
		errs = errs.Also(ss.Pinned.Validate().ViaField("pinned"))
	}
	if len(set) > 1 {
		errs = errs.Also(apis.ErrMultipleOneOf(set...))
	} else if len(set) == 0 {
		errs = errs.Also(apis.ErrMissingOneOf("runLatest", "release", "manual", "pinned"))
	}
	return errs
}
Validate validates the fields belonging to ServiceSpec recursively
package v1alpha1
import (
	"fmt"
	"github.com/knative/pkg/apis"
)
func (s *Service) Validate() *apis.FieldError {
	return ValidateObjectMetadata(s.GetObjectMeta()).ViaField("metadata").
		Also(s.Spec.Validate().ViaField("spec"))
}