@@ -44,6 +44,8 @@ import (
4444type InformersOpts struct {
4545 HTTPClient * http.Client
4646 Scheme * runtime.Scheme
47+ CodecFactoryStrict bool
48+ CodecFactoryPretty bool
4749 Mapper meta.RESTMapper
4850 ResyncPeriod time.Duration
4951 Namespace string
@@ -61,6 +63,13 @@ func NewInformers(config *rest.Config, options *InformersOpts) *Informers {
6163 if options .NewInformer != nil {
6264 newInformer = * options .NewInformer
6365 }
66+ var mutators []serializer.CodecFactoryOptionsMutator
67+ if options .CodecFactoryStrict {
68+ mutators = append (mutators , serializer .EnableStrict )
69+ }
70+ if options .CodecFactoryPretty {
71+ mutators = append (mutators , serializer .EnablePretty )
72+ }
6473 return & Informers {
6574 config : config ,
6675 httpClient : options .HTTPClient ,
@@ -71,7 +80,7 @@ func NewInformers(config *rest.Config, options *InformersOpts) *Informers {
7180 Unstructured : make (map [schema.GroupVersionKind ]* Cache ),
7281 Metadata : make (map [schema.GroupVersionKind ]* Cache ),
7382 },
74- codecs : serializer .NewCodecFactory (options .Scheme ),
83+ codecs : serializer .NewCodecFactory (options .Scheme , mutators ... ),
7584 paramCodec : runtime .NewParameterCodec (options .Scheme ),
7685 resync : options .ResyncPeriod ,
7786 startWait : make (chan struct {}),
0 commit comments