-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue with type changes on Graph Sdk model classes #2386
Comments
Thanks for raising this @jsweiler Any chance you can share more details on the deserialization mechanism used that uses the naming in the |
@andrueastman using an older sdk this kind of code worked to get an applicationInstance var appInstanceData = call.Resource.Targets.FirstOrDefault(c => c.Identity.AdditionalData != null);
if (appInstanceData.Identity.AdditionalData.TryGetValue("applicationInstance", out object value))
{
var appInstance = value as Microsoft.Graph.Identity;
if (appInstance != null)
{
// do something with appInstance
}
} That does not anymore. Now using Newtonsoft.Json I am able to correctly deserialize it. My bigger concern would be that the api doesn't change beneath the sdk before we are able to get our newer deserialization code into prod. |
Taking a look at the mapping values in the Identity model type for example, you'll see the mapping values do follow the correct naming to enable polymorphic deserialization. Therefore, the existence of the source in the
@jsweiler Any chance you can confirm what the type of the I also notice the pulling of the msgraph-sdk-dotnet/src/Microsoft.Graph/Generated/Models/CommunicationsIdentitySet.cs Line 13 in 890e0df
if (appInstanceData.Identity is CommunicationsIdentitySet communicationsIdentitySet)
{
var appInstance = communicationsIdentitySet.ApplicationInstance;
} In general, models generated by Kiota are meant to be serialized using the kiota serialization libraries as do not use serialization library annotations/mechanisms for System.Text.Json/Newtonsoft and should be deserialized with the var call = KiotaJsonSerializer.Deserialize<Call>(responseStream); |
@andrueastman The type of the call object in my code is |
In one of the recent Graph sdk updates (
Microsoft.Graph.Communications.Calls
package) many of the models were moved from the Microsoft.Graph namespace to Microsoft.Graph.Models namespace.However some of the notification updates that our app gets do not have the .models namespace in the json. Depending on how you deserialize the json you will get a null result. One example is when an audio prompt is completed playing currently with the latest sdk (version 1.2.0.10115) you get a notification like this
(This is the prompts array which shows prompts which just completed and is inside the
PlayPromptOperation
type). But notice both of the odata.types do not match up with the current .models namespace.Another example is when handling the CallsOnIncoming event. In the incoming call it contains this info about the resource id of the call.
Again notice that the type is microsoft.graph.identity and the actual type in the sdk is now microsoft.graph.models.identity. I'm wondering if this was intended or just overlooked?
I realize there are ways to deserialize that can handler either way, but also depending on how the application handles it this breaks it.
The text was updated successfully, but these errors were encountered: