Open hvermis opened 5 years ago
@hvermis can you provide an example, plus point to the model that is in question for DF here. Please link you modelType in RestSpec and the operation that is causing this issue. Any information that will help us to reproduce this error, plus if this is a bug on our side, we will need to test against your scenario to make sure we fixed it.
Also specify the timeline and the blocking scenarios for your customers.
https://github.com/Azure/azure-rest-api-specs/blob/master/specification/datafactory/resource-manager/Microsoft.DataFactory/stable/2018-06-01/entityTypes/Pipeline.json#L3208 This is the type that we have in swagger, and this is the .Net code generated: https://github.com/Azure/azure-sdk-for-net/blob/master/src/SDKs/DataFactory/Management.DataFactory/Generated/Models/AzureFunctionActivity.cs#L23 We ran debugger with ClientRuntime project and stepped into the GetDerivedType method. This line below reads the "JsonObject" attribute from ExecuteActivity which is the base class for AzureFunctionActivity and the name doesn't match that value: https://github.com/Azure/azure-sdk-for-net/blob/master/src/SdkCommon/ClientRuntime/ClientRuntime/Serialization/PolymorphicJsonConverter.cs#L27
We already have couple CRI-s open on the issue, so need to understand what would be the course of actions for us depending on your response here.
When the type has the same name as the value in "x-ms-discriminator-value" the "JsonObject" attribute is not added to the generated C# class in .Net SDK. The deserializer then does not recognize that type as it is looking for the value of that attribute and gets the attribute value from the base class and the json gets deserialized into the base class. There are two possible solutions - either the Autorest should add this attribute even if the values are the same, or the GetDerivedType method from src\SdkCommon\ClientRuntime\ClientRuntime\Serialization\PolymorphicJsonConverter.cs should also look at class name in case when the attribute is missing on it. Please let us know if this will be fixed and when, since this is blocking the usage of our new types for our customers and we need to evaluate our plan of action.