Skip to content
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

[Tracking] The SDK should not crash if there is a new derived type added to the metadata #1328

Closed
maisarissi opened this issue Apr 28, 2022 · 0 comments · Fixed by #1340
Closed
Assignees
Milestone

Comments

@maisarissi
Copy link
Contributor

maisarissi commented Apr 28, 2022

SDK should not crash if there is a new derived type added in the metadata, otherwise older apps built with the SDK would crash when there is a new type in the API.
SDK should treat abstract types as concrete and create an instance of the base type not only for Entities as well as for complex types.

Per initial investigation, we don't emit abstract for Entities.

<EntityType Name="conversationMember" BaseType="graph.entity" Abstract="true">
<Property Name="displayName" Type="Edm.String"/>
<Property Name="roles" Type="Collection(Edm.String)"/>
<Property Name="visibleHistoryStartDateTime" Type="Edm.DateTimeOffset"/>
</EntityType>
[JsonConverter(typeof(DerivedTypeConverter<ConversationMember>))]
public partial class ConversationMember : Entity
{

Users cannot create instances of these classes.

///<summary>
/// The internal ConversationMember constructor
///</summary>
protected internal ConversationMember()
{
// Don't allow initialization of abstract entity types
}

But it seems like we emit abstract for complex types.

[JsonConverter(typeof(DerivedTypeConverter<EducationResource>))]
public abstract partial class EducationResource
{

FYI @darrelmiller @garethj-msft

@maisarissi maisarissi changed the title [Tracking] The SDK should not crash if there is a new derived type is added to the metadata [Tracking] The SDK should not crash if there is a new derived type added to the metadata Apr 28, 2022
@maisarissi maisarissi added this to the 4.28.0 milestone May 4, 2022
@andrueastman andrueastman linked a pull request May 9, 2022 that will close this issue
1 task
@microsoftgraph microsoftgraph locked as resolved and limited conversation to collaborators Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants