Fix default conversion for pkg/runtime tests
This commit is contained in:
		| @@ -27,6 +27,7 @@ import ( | |||||||
| 	"k8s.io/apimachinery/pkg/runtime/serializer" | 	"k8s.io/apimachinery/pkg/runtime/serializer" | ||||||
| 	runtimetesting "k8s.io/apimachinery/pkg/runtime/testing" | 	runtimetesting "k8s.io/apimachinery/pkg/runtime/testing" | ||||||
| 	"k8s.io/apimachinery/pkg/util/diff" | 	"k8s.io/apimachinery/pkg/util/diff" | ||||||
|  | 	utilruntime "k8s.io/apimachinery/pkg/util/runtime" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| func TestDecodeEmptyRawExtensionAsObject(t *testing.T) { | func TestDecodeEmptyRawExtensionAsObject(t *testing.T) { | ||||||
| @@ -37,6 +38,7 @@ func TestDecodeEmptyRawExtensionAsObject(t *testing.T) { | |||||||
| 	s := runtime.NewScheme() | 	s := runtime.NewScheme() | ||||||
| 	s.AddKnownTypes(internalGV, &runtimetesting.ObjectTest{}) | 	s.AddKnownTypes(internalGV, &runtimetesting.ObjectTest{}) | ||||||
| 	s.AddKnownTypeWithName(externalGVK, &runtimetesting.ObjectTestExternal{}) | 	s.AddKnownTypeWithName(externalGVK, &runtimetesting.ObjectTestExternal{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(s)) | ||||||
|  |  | ||||||
| 	codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) | 	codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) | ||||||
|  |  | ||||||
| @@ -74,6 +76,7 @@ func TestArrayOfRuntimeObject(t *testing.T) { | |||||||
| 	s.AddKnownTypeWithName(externalGV.WithKind("EmbeddedTest"), &runtimetesting.EmbeddedTestExternal{}) | 	s.AddKnownTypeWithName(externalGV.WithKind("EmbeddedTest"), &runtimetesting.EmbeddedTestExternal{}) | ||||||
| 	s.AddKnownTypes(internalGV, &runtimetesting.ObjectTest{}) | 	s.AddKnownTypes(internalGV, &runtimetesting.ObjectTest{}) | ||||||
| 	s.AddKnownTypeWithName(externalGV.WithKind("ObjectTest"), &runtimetesting.ObjectTestExternal{}) | 	s.AddKnownTypeWithName(externalGV.WithKind("ObjectTest"), &runtimetesting.ObjectTestExternal{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(s)) | ||||||
|  |  | ||||||
| 	codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) | 	codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) | ||||||
|  |  | ||||||
| @@ -148,6 +151,7 @@ func TestNestedObject(t *testing.T) { | |||||||
| 	s := runtime.NewScheme() | 	s := runtime.NewScheme() | ||||||
| 	s.AddKnownTypes(internalGV, &runtimetesting.EmbeddedTest{}) | 	s.AddKnownTypes(internalGV, &runtimetesting.EmbeddedTest{}) | ||||||
| 	s.AddKnownTypeWithName(embeddedTestExternalGVK, &runtimetesting.EmbeddedTestExternal{}) | 	s.AddKnownTypeWithName(embeddedTestExternalGVK, &runtimetesting.EmbeddedTestExternal{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(s)) | ||||||
|  |  | ||||||
| 	codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) | 	codec := serializer.NewCodecFactory(s).LegacyCodec(externalGV) | ||||||
|  |  | ||||||
| @@ -227,6 +231,7 @@ func TestDeepCopyOfRuntimeObject(t *testing.T) { | |||||||
| 	s := runtime.NewScheme() | 	s := runtime.NewScheme() | ||||||
| 	s.AddKnownTypes(internalGV, &runtimetesting.EmbeddedTest{}) | 	s.AddKnownTypes(internalGV, &runtimetesting.EmbeddedTest{}) | ||||||
| 	s.AddKnownTypeWithName(embeddedTestExternalGVK, &runtimetesting.EmbeddedTestExternal{}) | 	s.AddKnownTypeWithName(embeddedTestExternalGVK, &runtimetesting.EmbeddedTestExternal{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(s)) | ||||||
|  |  | ||||||
| 	original := &runtimetesting.EmbeddedTest{ | 	original := &runtimetesting.EmbeddedTest{ | ||||||
| 		ID: "outer", | 		ID: "outer", | ||||||
|   | |||||||
| @@ -37,23 +37,15 @@ type testConversions struct { | |||||||
| } | } | ||||||
|  |  | ||||||
| func (c *testConversions) internalToExternalSimple(in *runtimetesting.InternalSimple, out *runtimetesting.ExternalSimple, scope conversion.Scope) error { | func (c *testConversions) internalToExternalSimple(in *runtimetesting.InternalSimple, out *runtimetesting.ExternalSimple, scope conversion.Scope) error { | ||||||
| 	if err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { | 	out.TypeMeta = in.TypeMeta | ||||||
| 		return err | 	out.TestString = in.TestString | ||||||
| 	} |  | ||||||
| 	if err := scope.Convert(&in.TestString, &out.TestString, 0); err != nil { |  | ||||||
| 		return err |  | ||||||
| 	} |  | ||||||
| 	c.internalToExternalCalls++ | 	c.internalToExternalCalls++ | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
|  |  | ||||||
| func (c *testConversions) externalToInternalSimple(in *runtimetesting.ExternalSimple, out *runtimetesting.InternalSimple, scope conversion.Scope) error { | func (c *testConversions) externalToInternalSimple(in *runtimetesting.ExternalSimple, out *runtimetesting.InternalSimple, scope conversion.Scope) error { | ||||||
| 	if err := scope.Convert(&in.TypeMeta, &out.TypeMeta, 0); err != nil { | 	out.TypeMeta = in.TypeMeta | ||||||
| 		return err | 	out.TestString = in.TestString | ||||||
| 	} |  | ||||||
| 	if err := scope.Convert(&in.TestString, &out.TestString, 0); err != nil { |  | ||||||
| 		return err |  | ||||||
| 	} |  | ||||||
| 	c.externalToInternalCalls++ | 	c.externalToInternalCalls++ | ||||||
| 	return nil | 	return nil | ||||||
| } | } | ||||||
| @@ -81,6 +73,7 @@ func TestScheme(t *testing.T) { | |||||||
| 	scheme := runtime.NewScheme() | 	scheme := runtime.NewScheme() | ||||||
| 	scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) | 	scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) | ||||||
| 	scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) | 	scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(scheme)) | ||||||
|  |  | ||||||
| 	// If set, would clear TypeMeta during conversion. | 	// If set, would clear TypeMeta during conversion. | ||||||
| 	//scheme.AddIgnoredConversionType(&TypeMeta{}, &TypeMeta{}) | 	//scheme.AddIgnoredConversionType(&TypeMeta{}, &TypeMeta{}) | ||||||
| @@ -94,9 +87,7 @@ func TestScheme(t *testing.T) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Register functions to verify that scope.Meta() gets set correctly. | 	// Register functions to verify that scope.Meta() gets set correctly. | ||||||
| 	if err := conversions.registerConversions(scheme); err != nil { | 	utilruntime.Must(conversions.registerConversions(scheme)) | ||||||
| 		t.Fatalf("unexpected error: %v", err) |  | ||||||
| 	} |  | ||||||
|  |  | ||||||
| 	t.Run("Encode, Decode, DecodeInto, and DecodeToVersion", func(t *testing.T) { | 	t.Run("Encode, Decode, DecodeInto, and DecodeToVersion", func(t *testing.T) { | ||||||
| 		simple := &runtimetesting.InternalSimple{ | 		simple := &runtimetesting.InternalSimple{ | ||||||
| @@ -272,6 +263,7 @@ func TestExternalToInternalMapping(t *testing.T) { | |||||||
| 	scheme := runtime.NewScheme() | 	scheme := runtime.NewScheme() | ||||||
| 	scheme.AddKnownTypeWithName(internalGV.WithKind("OptionalExtensionType"), &runtimetesting.InternalOptionalExtensionType{}) | 	scheme.AddKnownTypeWithName(internalGV.WithKind("OptionalExtensionType"), &runtimetesting.InternalOptionalExtensionType{}) | ||||||
| 	scheme.AddKnownTypeWithName(externalGV.WithKind("OptionalExtensionType"), &runtimetesting.ExternalOptionalExtensionType{}) | 	scheme.AddKnownTypeWithName(externalGV.WithKind("OptionalExtensionType"), &runtimetesting.ExternalOptionalExtensionType{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(scheme)) | ||||||
|  |  | ||||||
| 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | ||||||
|  |  | ||||||
| @@ -311,6 +303,7 @@ func TestExtensionMapping(t *testing.T) { | |||||||
| 	scheme.AddKnownTypeWithName(externalGV.WithKind("B"), &runtimetesting.ExtensionB{}) | 	scheme.AddKnownTypeWithName(externalGV.WithKind("B"), &runtimetesting.ExtensionB{}) | ||||||
| 	scheme.AddKnownTypeWithName(internalGV.WithKind("A"), &runtimetesting.ExtensionA{}) | 	scheme.AddKnownTypeWithName(internalGV.WithKind("A"), &runtimetesting.ExtensionA{}) | ||||||
| 	scheme.AddKnownTypeWithName(internalGV.WithKind("B"), &runtimetesting.ExtensionB{}) | 	scheme.AddKnownTypeWithName(internalGV.WithKind("B"), &runtimetesting.ExtensionB{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(scheme)) | ||||||
|  |  | ||||||
| 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | ||||||
|  |  | ||||||
| @@ -379,6 +372,7 @@ func TestEncode(t *testing.T) { | |||||||
| 	scheme := runtime.NewScheme() | 	scheme := runtime.NewScheme() | ||||||
| 	scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) | 	scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) | ||||||
| 	scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) | 	scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(scheme)) | ||||||
|  |  | ||||||
| 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | ||||||
|  |  | ||||||
| @@ -414,6 +408,7 @@ func TestUnversionedTypes(t *testing.T) { | |||||||
| 	scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) | 	scheme.AddKnownTypeWithName(internalGVK, &runtimetesting.InternalSimple{}) | ||||||
| 	scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) | 	scheme.AddKnownTypeWithName(externalGVK, &runtimetesting.ExternalSimple{}) | ||||||
| 	scheme.AddKnownTypeWithName(otherGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) | 	scheme.AddKnownTypeWithName(otherGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(scheme)) | ||||||
|  |  | ||||||
| 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | 	codec := serializer.NewCodecFactory(scheme).LegacyCodec(externalGV) | ||||||
|  |  | ||||||
| @@ -488,14 +483,8 @@ func GetTestScheme() *runtime.Scheme { | |||||||
| 	s.AddKnownTypeWithName(alternateExternalGV.WithKind("TestType5"), &runtimetesting.ExternalTestType1{}) | 	s.AddKnownTypeWithName(alternateExternalGV.WithKind("TestType5"), &runtimetesting.ExternalTestType1{}) | ||||||
| 	s.AddKnownTypeWithName(differentExternalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{}) | 	s.AddKnownTypeWithName(differentExternalGV.WithKind("TestType1"), &runtimetesting.ExternalTestType1{}) | ||||||
| 	s.AddUnversionedTypes(externalGV, &runtimetesting.UnversionedType{}) | 	s.AddUnversionedTypes(externalGV, &runtimetesting.UnversionedType{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(s)) | ||||||
|  |  | ||||||
| 	convertTestType := func(in *runtimetesting.TestType1, out *runtimetesting.ExternalTestType1, s conversion.Scope) error { |  | ||||||
| 		out.A = in.A |  | ||||||
| 		return nil |  | ||||||
| 	} |  | ||||||
| 	utilruntime.Must(s.AddConversionFunc((*runtimetesting.TestType1)(nil), (*runtimetesting.ExternalTestType1)(nil), func(a, b interface{}, scope conversion.Scope) error { |  | ||||||
| 		return convertTestType(a.(*runtimetesting.TestType1), b.(*runtimetesting.ExternalTestType1), scope) |  | ||||||
| 	})) |  | ||||||
| 	return s | 	return s | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -941,6 +930,7 @@ func TestMetaValues(t *testing.T) { | |||||||
| 	s := runtime.NewScheme() | 	s := runtime.NewScheme() | ||||||
| 	s.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{}) | 	s.AddKnownTypeWithName(internalGV.WithKind("Simple"), &runtimetesting.InternalSimple{}) | ||||||
| 	s.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) | 	s.AddKnownTypeWithName(externalGV.WithKind("Simple"), &runtimetesting.ExternalSimple{}) | ||||||
|  | 	utilruntime.Must(runtimetesting.RegisterConversions(s)) | ||||||
|  |  | ||||||
| 	conversions := &testConversions{ | 	conversions := &testConversions{ | ||||||
| 		internalToExternalCalls: 0, | 		internalToExternalCalls: 0, | ||||||
| @@ -948,9 +938,8 @@ func TestMetaValues(t *testing.T) { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	// Register functions to verify that scope.Meta() gets set correctly. | 	// Register functions to verify that scope.Meta() gets set correctly. | ||||||
| 	if err := conversions.registerConversions(s); err != nil { | 	utilruntime.Must(conversions.registerConversions(s)) | ||||||
| 		t.Fatalf("unexpected error: %v", err) |  | ||||||
| 	} |  | ||||||
| 	simple := &runtimetesting.InternalSimple{ | 	simple := &runtimetesting.InternalSimple{ | ||||||
| 		TestString: "foo", | 		TestString: "foo", | ||||||
| 	} | 	} | ||||||
|   | |||||||
| @@ -1,5 +1,5 @@ | |||||||
| /* | /* | ||||||
| Copyright 2018 The Kubernetes Authors. | Copyright 2020 The Kubernetes Authors. | ||||||
|  |  | ||||||
| Licensed under the Apache License, Version 2.0 (the "License"); | Licensed under the Apache License, Version 2.0 (the "License"); | ||||||
| you may not use this file except in compliance with the License. | you may not use this file except in compliance with the License. | ||||||
| @@ -21,6 +21,106 @@ import ( | |||||||
| 	"k8s.io/apimachinery/pkg/runtime" | 	"k8s.io/apimachinery/pkg/runtime" | ||||||
| ) | ) | ||||||
|  |  | ||||||
|  | func convertEmbeddedTestToEmbeddedTestExternal(in *EmbeddedTest, out *EmbeddedTestExternal, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	out.ID = in.ID | ||||||
|  | 	if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Object, &out.Object, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.EmptyObject, &out.EmptyObject, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertEmbeddedTestExternalToEmbeddedTest(in *EmbeddedTestExternal, out *EmbeddedTest, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	out.ID = in.ID | ||||||
|  | 	if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Object, &out.Object, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.EmptyObject, &out.EmptyObject, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertObjectTestToObjectTestExternal(in *ObjectTest, out *ObjectTestExternal, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	out.ID = in.ID | ||||||
|  | 	if in.Items != nil { | ||||||
|  | 		out.Items = make([]runtime.RawExtension, len(in.Items)) | ||||||
|  | 		for i := range in.Items { | ||||||
|  | 			if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Items[i], &out.Items[i], s); err != nil { | ||||||
|  | 				return err | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		out.Items = nil | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertObjectTestExternalToObjectTest(in *ObjectTestExternal, out *ObjectTest, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	out.ID = in.ID | ||||||
|  | 	if in.Items != nil { | ||||||
|  | 		out.Items = make([]runtime.Object, len(in.Items)) | ||||||
|  | 		for i := range in.Items { | ||||||
|  | 			if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Items[i], &out.Items[i], s); err != nil { | ||||||
|  | 				return err | ||||||
|  | 			} | ||||||
|  | 		} | ||||||
|  | 	} else { | ||||||
|  | 		out.Items = nil | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertInternalSimpleToExternalSimple(in *InternalSimple, out *ExternalSimple, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	out.TestString = in.TestString | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertExternalSimpleToInternalSimple(in *ExternalSimple, out *InternalSimple, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	out.TestString = in.TestString | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertInternalExtensionTypeToExternalExtensionType(in *InternalExtensionType, out *ExternalExtensionType, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Extension, &out.Extension, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertExternalExtensionTypeToInternalExtensionType(in *ExternalExtensionType, out *InternalExtensionType, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Extension, &out.Extension, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertInternalOptionalExtensionTypeToExternalOptionalExtensionType(in *InternalOptionalExtensionType, out *ExternalOptionalExtensionType, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	if err := runtime.Convert_runtime_Object_To_runtime_RawExtension(&in.Extension, &out.Extension, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
|  | func convertExternalOptionalExtensionTypeToInternalOptionalExtensionType(in *ExternalOptionalExtensionType, out *InternalOptionalExtensionType, s conversion.Scope) error { | ||||||
|  | 	out.TypeMeta = in.TypeMeta | ||||||
|  | 	if err := runtime.Convert_runtime_RawExtension_To_runtime_Object(&in.Extension, &out.Extension, s); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	return nil | ||||||
|  | } | ||||||
|  |  | ||||||
| func convertTestType1ToExternalTestType1(in *TestType1, out *ExternalTestType1, s conversion.Scope) error { | func convertTestType1ToExternalTestType1(in *TestType1, out *ExternalTestType1, s conversion.Scope) error { | ||||||
| 	out.MyWeirdCustomEmbeddedVersionKindField = in.MyWeirdCustomEmbeddedVersionKindField | 	out.MyWeirdCustomEmbeddedVersionKindField = in.MyWeirdCustomEmbeddedVersionKindField | ||||||
| 	out.A = in.A | 	out.A = in.A | ||||||
| @@ -126,6 +226,56 @@ func convertExternalTestType2ToTestType2(in *ExternalTestType2, out *TestType2, | |||||||
| } | } | ||||||
|  |  | ||||||
| func RegisterConversions(s *runtime.Scheme) error { | func RegisterConversions(s *runtime.Scheme) error { | ||||||
|  | 	if err := s.AddConversionFunc((*EmbeddedTest)(nil), (*EmbeddedTestExternal)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertEmbeddedTestToEmbeddedTestExternal(a.(*EmbeddedTest), b.(*EmbeddedTestExternal), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*EmbeddedTestExternal)(nil), (*EmbeddedTest)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertEmbeddedTestExternalToEmbeddedTest(a.(*EmbeddedTestExternal), b.(*EmbeddedTest), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*ObjectTest)(nil), (*ObjectTestExternal)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertObjectTestToObjectTestExternal(a.(*ObjectTest), b.(*ObjectTestExternal), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*ObjectTestExternal)(nil), (*ObjectTest)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertObjectTestExternalToObjectTest(a.(*ObjectTestExternal), b.(*ObjectTest), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*InternalSimple)(nil), (*ExternalSimple)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertInternalSimpleToExternalSimple(a.(*InternalSimple), b.(*ExternalSimple), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*ExternalSimple)(nil), (*InternalSimple)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertExternalSimpleToInternalSimple(a.(*ExternalSimple), b.(*InternalSimple), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*InternalExtensionType)(nil), (*ExternalExtensionType)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertInternalExtensionTypeToExternalExtensionType(a.(*InternalExtensionType), b.(*ExternalExtensionType), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*ExternalExtensionType)(nil), (*InternalExtensionType)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertExternalExtensionTypeToInternalExtensionType(a.(*ExternalExtensionType), b.(*InternalExtensionType), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*InternalOptionalExtensionType)(nil), (*ExternalOptionalExtensionType)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertInternalOptionalExtensionTypeToExternalOptionalExtensionType(a.(*InternalOptionalExtensionType), b.(*ExternalOptionalExtensionType), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
|  | 	if err := s.AddConversionFunc((*ExternalOptionalExtensionType)(nil), (*InternalOptionalExtensionType)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
|  | 		return convertExternalOptionalExtensionTypeToInternalOptionalExtensionType(a.(*ExternalOptionalExtensionType), b.(*InternalOptionalExtensionType), scope) | ||||||
|  | 	}); err != nil { | ||||||
|  | 		return err | ||||||
|  | 	} | ||||||
| 	if err := s.AddConversionFunc((*TestType1)(nil), (*ExternalTestType1)(nil), func(a, b interface{}, scope conversion.Scope) error { | 	if err := s.AddConversionFunc((*TestType1)(nil), (*ExternalTestType1)(nil), func(a, b interface{}, scope conversion.Scope) error { | ||||||
| 		return convertTestType1ToExternalTestType1(a.(*TestType1), b.(*ExternalTestType1), scope) | 		return convertTestType1ToExternalTestType1(a.(*TestType1), b.(*ExternalTestType1), scope) | ||||||
| 	}); err != nil { | 	}); err != nil { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 wojtekt
					wojtekt