apiextensions-apiserverk8s.io/apiextensions-apiserver/pkg/apiserver/schema/objectmeta Index | Files

package objectmeta

import "k8s.io/apiextensions-apiserver/pkg/apiserver/schema/objectmeta"

Index

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.

Source Files

algorithm.go coerce.go validation.go

Version
v0.22.3-rc.0
Published
Sep 17, 2021
Platform
js/wasm
Imports
12 packages
Last checked
3 minutes ago

Tools for package owners.