diff --git a/hack/generator/pkg/conversions/property_conversions.go b/hack/generator/pkg/conversions/property_conversions.go index 55ec6617f07..2ea2afccafd 100644 --- a/hack/generator/pkg/conversions/property_conversions.go +++ b/hack/generator/pkg/conversions/property_conversions.go @@ -145,6 +145,15 @@ func CreateTypeConversion( return nil, err } + +func NameOfPropertyAssignmentFunction(name astmodel.TypeName, direction Direction, idFactory astmodel.IdentifierFactory) string { + nameOfOtherType := idFactory.CreateIdentifier(name.Name(), astmodel.Exported) + return direction.SelectString( + "AssignPropertiesFrom"+nameOfOtherType, + "AssignPropertiesTo"+nameOfOtherType) +} + + // assignToOptional will generate a conversion where the destination is optional, if the // underlying type of the destination is compatible with the source. // @@ -853,7 +862,7 @@ func assignObjectFromObject( actualReader = astbuilder.AddrOf(reader) } - functionName := nameOfPropertyAssignmentFunction(sourceName, conversionContext.direction, conversionContext.idFactory) + functionName := NameOfPropertyAssignmentFunction(sourceName, conversionContext.direction, conversionContext.idFactory) var conversion dst.Stmt if destinationName.PackageReference.Equals(generationContext.CurrentPackage()) {