Some fixes when handling stream-style, polymorphic, JSON merge patch models.
Reduced the number of access helper interfaces created to only the polymorphic parent type. The polymorphic parent will manage whether JSON merge patch serialization will be used and will share this information to child types through an access helper method.
Change how BinaryData is created to just use BinaryData.fromObject. To make sure serialization happens before JSON merge patch serialization is disabled BinaryData.getLength() is called instead of the previous BinaryData.fromBytes(BinaryData.fromObject(object).toBytes()) pattern, this will retain information in BinaryData that it is based on an object.
Changed how deserialization works to no longer call the setter methods when the property is defined by a parent model. This was accidentally setting those properties to always be included in JSON merge patch serialization, which could lead to incorrect behavior. Now the parent models expose access helper methods for setting properties which child models will set directly.
Cleaned up deserialization code when a JSON merge patch model has no parameters in the constructor. Before this was just checking if the model had required properties and required properties were being included in the constructor, but JSON merge patch models don't generate required properties in the constructor if they're optional in the JSON merge patch call.
Fixes #2769 Fixes #2770 Fixes #2771
Some fixes when handling stream-style, polymorphic, JSON merge patch models.
BinaryData
is created to just useBinaryData.fromObject
. To make sure serialization happens before JSON merge patch serialization is disabledBinaryData.getLength()
is called instead of the previousBinaryData.fromBytes(BinaryData.fromObject(object).toBytes())
pattern, this will retain information inBinaryData
that it is based on an object.