-
This could just be my misunderstanding, but I was looking at the tests to make sure the syntax for unflattening was simply the reversal of flattening and noticed that the target property type is not initialized. Is it that the library expects you to initialize all property types that aren't nullable in the default constructor? Taking this test as an example, in the generated code I would have expected Thanks. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If nullable reference types are enabled for Mapperly, Mapperly does not initialize proeprties marked as non-nullable. mapperly/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyFlatteningTest.cs Lines 162 to 202 in 01af24f Both have nullable reference types enabled. In the ManualUnflattenedProperty test the Value property of the class B is not nullable and therefore does not get initialized by Mapperly. In the ManualUnflattenedPropertyNullablePath test the Value property of the class B is nullable and therefore gets initialized by Mapperly.
|
Beta Was this translation helpful? Give feedback.
If nullable reference types are enabled for Mapperly, Mapperly does not initialize proeprties marked as non-nullable.
If you look for example at these two test:
mapperly/test/Riok.Mapperly.Tests/Mapping/ObjectPropertyFlatteningTest.cs
Lines 162 to 202 in 01af24f