-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Rewire polymorphism metadata to the contract model #71346
Rewire polymorphism metadata to the contract model #71346
Conversation
Note regarding the This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change. |
Tagging subscribers to this area: @dotnet/area-system-text-json, @gregsdennis |
...es/System.Text.Json/src/System/Text/Json/Serialization/JsonSerializer.Read.HandleMetadata.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonDerivedType.cs
Show resolved
Hide resolved
...ries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPolymorphismOptions.cs
Show resolved
Hide resolved
...ries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPolymorphismOptions.cs
Show resolved
Hide resolved
...ries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonPolymorphismOptions.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonTypeInfo.cs
Show resolved
Hide resolved
...ies/System.Text.Json/src/System/Text/Json/Serialization/Metadata/SourceGenJsonTypeInfoOfT.cs
Show resolved
Hide resolved
src/libraries/System.Text.Json/src/System/Text/Json/Serialization/Metadata/JsonDerivedType.cs
Show resolved
Hide resolved
} | ||
public enum JsonUnknownTypeHandling | ||
{ | ||
JsonElement = 0, | ||
JsonNode = 1, | ||
} | ||
public partial class JsonPolymorphicTypeConfiguration : System.Collections.Generic.ICollection<(System.Type DerivedType, object? TypeDiscriminator)>, System.Collections.Generic.IEnumerable<(System.Type DerivedType, object? TypeDiscriminator)>, System.Collections.IEnumerable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First change made in the implementation of this PR: Remove provisional JsonPolymorphicTypeConfiguration
public System.Action<System.Text.Json.Utf8JsonWriter, TCollection>? SerializeHandler { get { throw null; } init { } } | ||
} | ||
public readonly partial struct JsonDerivedType |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added JsonDerivedType
struct
@@ -1161,15 +1135,24 @@ public sealed partial class JsonParameterInfoValues | |||
public System.Type ParameterType { get { throw null; } init { } } | |||
public int Position { get { throw null; } init { } } | |||
} | |||
public partial class JsonPolymorphismOptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add JsonPolymorphismOptions
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use generic overload or System.Text.Json source generation for native AOT applications.")] | ||
[System.Diagnostics.CodeAnalysis.RequiresDynamicCode("JSON serialization and deserialization might require types that cannot be statically analyzed and might need runtime code generation. Use generic overload or System.Text.Json source generation for native AOT applications.")] | ||
public System.Text.Json.JsonSerializerOptions Options { get { throw null; } } | ||
public System.Text.Json.Serialization.Metadata.JsonPolymorphismOptions? PolymorphismOptions { get { throw null; } set { } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add JsonPolymorphismOptions property to JsonTypeInfo
@@ -356,19 +356,12 @@ public sealed partial class JsonSerializerOptions | |||
public System.Text.Json.JsonNamingPolicy? PropertyNamingPolicy { get { throw null; } set { } } | |||
public System.Text.Json.JsonCommentHandling ReadCommentHandling { get { throw null; } set { } } | |||
public System.Text.Json.Serialization.ReferenceHandler? ReferenceHandler { get { throw null; } set { } } | |||
public System.Collections.Generic.IList<System.Text.Json.Serialization.JsonPolymorphicTypeConfiguration> PolymorphicTypeConfigurations { get { throw null; } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove provisional PolymorphicTypeConfigurations
property from JsonSerializerOptions
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
Completes #63747 by rewiring its metadata APIs to the newly merged contract model (#70435).
Fixes #63747.