-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Add JSON Serialize API to support ASP.NET polymorphic serialization #47973
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
Comments
Interesting comment about serviceability. If someone happens to be using RDG without native AOT I guess they could run into that issue. but in the case of RDG with native AOT the serviceability problem is inevitable. |
can i be assigned this issue |
@shivangnayar-dev At the moment, the issue isn't ready for implementation. The next step is to polish up the requirements here into an API proposal (fill in all the TBD sections) and take it through API review. You're welcome to help with that process but it would be helpful to have context into the background here... I'd recommend checking out the |
Background and Motivation
As described in #47548, ASP.NET has some internal logic around how it serializes objects to JSON for Minimal APIs and MVC. When fixing this issue in #47859, I noticed that this logic is spread out between:
The logic for all 4 looks like:
aspnetcore/src/Shared/RouteHandlers/ExecuteHandlerHelper.cs
Lines 39 to 57 in 6d30638
with the "ShouldUseWith" logic:
aspnetcore/src/Shared/Json/JsonSerializerExtensions.cs
Lines 13 to 17 in 6d30638
If users want to have this same serialization behavior, they would have to write that same logic in their app/library. Also, we need to encode this logic in the source generator, which means it isn't as serviceable because if we need to fix a bug in it, the dev needs to rebuild their app to get the fix.
We should come up with an API that we can shared code between these 4 places, and allow customers to serialize objects with the same behavior as how MVC and Minimal APIs does.
Proposed API
TBD
Usage Examples
TBD
Alternative Designs
Risks
The name of the API is a risk at confusing people what the difference between our existing APIs and this one do.
cc @halter73 @captainsafia @mitchdenny @eiriktsarpalis
The text was updated successfully, but these errors were encountered: