This commit is contained in:
Ville Aikas 2018-08-30 09:36:12 -07:00 committed by Knative Prow Robot
parent eedc0a939d
commit 760afb6c09
2 changed files with 15 additions and 15 deletions

View File

@ -39,20 +39,6 @@ type FieldError struct {
// FieldError implements error
var _ error = (*FieldError)(nil)
// Validatable indicates that a particular type may have its fields validated.
type Validatable interface {
// Validate checks the validity of this types fields.
Validate() *FieldError
}
// Immutable indicates that a particular type has fields that should
// not change after creation.
type Immutable interface {
// CheckImmutableFields checks that the current instance's immutable
// fields haven't changed from the provided original.
CheckImmutableFields(original Immutable) *FieldError
}
// ViaField is used to propagate a validation error along a field access.
// For example, if a type recursively validates its "spec" via:
// if err := foo.Spec.Validate(); err != nil {

View File

@ -1,5 +1,5 @@
/*
Copyright 2017 The Knative Authors
Copyright 2018 The Knative Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -21,3 +21,17 @@ package apis
type Defaultable interface {
SetDefaults()
}
// Validatable indicates that a particular type may have its fields validated.
type Validatable interface {
// Validate checks the validity of this types fields.
Validate() *FieldError
}
// Immutable indicates that a particular type has fields that should
// not change after creation.
type Immutable interface {
// CheckImmutableFields checks that the current instance's immutable
// fields haven't changed from the provided original.
CheckImmutableFields(original Immutable) *FieldError
}