mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-12-24 16:57:27 +00:00
Fix bunch of issues with conversion generator.
This commit is contained in:
@@ -1298,7 +1298,7 @@ func autoConvert_api_List_To_v1_List(in *api.List, out *List, s conversion.Scope
|
||||
if in.Items != nil {
|
||||
out.Items = make([]runtime.RawExtension, len(in.Items))
|
||||
for i := range in.Items {
|
||||
if err := s.Convert(&in.Items[i], &out.Items[i], 0); err != nil {
|
||||
if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Items[i], &out.Items[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@@ -4571,7 +4571,7 @@ func autoConvert_v1_List_To_api_List(in *List, out *api.List, s conversion.Scope
|
||||
if in.Items != nil {
|
||||
out.Items = make([]runtime.Object, len(in.Items))
|
||||
for i := range in.Items {
|
||||
if err := s.Convert(&in.Items[i], &out.Items[i], 0); err != nil {
|
||||
if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Items[i], &out.Items[i], s); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,46 +88,49 @@ func (re Unknown) MarshalJSON() ([]byte, error) {
|
||||
return re.Raw, nil
|
||||
}
|
||||
|
||||
func Convert_runtime_Object_To_runtime_RawExtension(in *Object, out *RawExtension, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
out.Raw = []byte("null")
|
||||
return nil
|
||||
}
|
||||
obj := *in
|
||||
if unk, ok := obj.(*Unknown); ok {
|
||||
if unk.Raw != nil {
|
||||
out.Raw = unk.Raw
|
||||
return nil
|
||||
}
|
||||
obj = out.Object
|
||||
}
|
||||
if obj == nil {
|
||||
out.Raw = nil
|
||||
return nil
|
||||
}
|
||||
out.Object = obj
|
||||
return nil
|
||||
}
|
||||
|
||||
func Convert_runtime_RawExtension_To_runtime_Object(in *RawExtension, out *Object, s conversion.Scope) error {
|
||||
if in.Object != nil {
|
||||
*out = in.Object
|
||||
return nil
|
||||
}
|
||||
data := in.Raw
|
||||
if len(data) == 0 || (len(data) == 4 && string(data) == "null") {
|
||||
*out = nil
|
||||
return nil
|
||||
}
|
||||
*out = &Unknown{
|
||||
Raw: data,
|
||||
// TODO: Set ContentEncoding and ContentType appropriately.
|
||||
// Currently we set ContentTypeJSON to make tests passing.
|
||||
ContentType: ContentTypeJSON,
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func DefaultEmbeddedConversions() []interface{} {
|
||||
return []interface{}{
|
||||
func(in *Object, out *RawExtension, s conversion.Scope) error {
|
||||
if in == nil {
|
||||
out.Raw = []byte("null")
|
||||
return nil
|
||||
}
|
||||
obj := *in
|
||||
if unk, ok := obj.(*Unknown); ok {
|
||||
if unk.Raw != nil {
|
||||
out.Raw = unk.Raw
|
||||
return nil
|
||||
}
|
||||
obj = out.Object
|
||||
}
|
||||
if obj == nil {
|
||||
out.Raw = nil
|
||||
return nil
|
||||
}
|
||||
out.Object = obj
|
||||
return nil
|
||||
},
|
||||
|
||||
func(in *RawExtension, out *Object, s conversion.Scope) error {
|
||||
if in.Object != nil {
|
||||
*out = in.Object
|
||||
return nil
|
||||
}
|
||||
data := in.Raw
|
||||
if len(data) == 0 || (len(data) == 4 && string(data) == "null") {
|
||||
*out = nil
|
||||
return nil
|
||||
}
|
||||
*out = &Unknown{
|
||||
Raw: data,
|
||||
// TODO: Set ContentEncoding and ContentType appropriately.
|
||||
// Currently we set ContentTypeJSON to make tests passing.
|
||||
ContentType: ContentTypeJSON,
|
||||
}
|
||||
return nil
|
||||
},
|
||||
Convert_runtime_Object_To_runtime_RawExtension,
|
||||
Convert_runtime_RawExtension_To_runtime_Object,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user