Documentation ¶
Index ¶
- func Coerce(pth *field.Path, obj interface{}, s *structuralschema.Structural, ...) *field.Error
- func GetObjectMeta(obj map[string]interface{}, dropMalformedFields bool) (*metav1.ObjectMeta, bool, error)
- func SetObjectMeta(obj map[string]interface{}, objectMeta *metav1.ObjectMeta) error
- func Validate(pth *field.Path, obj interface{}, s *structuralschema.Structural, ...) field.ErrorList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Coerce ¶
func Coerce(pth *field.Path, obj interface{}, s *structuralschema.Structural, isResourceRoot, dropInvalidFields bool) *field.Error
Coerce checks types of embedded ObjectMeta and TypeMeta and prunes unknown fields inside the former. It does coerce ObjectMeta and TypeMeta at the root if isResourceRoot is true. If dropInvalidFields is true, fields of wrong type will be dropped.
func GetObjectMeta ¶
func GetObjectMeta(obj map[string]interface{}, dropMalformedFields bool) (*metav1.ObjectMeta, bool, error)
GetObjectMeta does conversion of JSON to ObjectMeta. It first tries json.Unmarshal into a metav1.ObjectMeta type. If that does not work and dropMalformedFields is true, it does field-by-field best-effort conversion throwing away fields which lead to errors.
func SetObjectMeta ¶
func SetObjectMeta(obj map[string]interface{}, objectMeta *metav1.ObjectMeta) error
SetObjectMeta writes back ObjectMeta into a JSON data structure.
func Validate ¶
func Validate(pth *field.Path, obj interface{}, s *structuralschema.Structural, isResourceRoot bool) field.ErrorList
Validate validates embedded ObjectMeta and TypeMeta. It also validate those at the root if isResourceRoot is true.
Types ¶
This section is empty.