v0.0.0-...-d88c8b5 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 12 Imported by: 0




This section is empty.


This section is empty.


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.


This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL