You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
martincostello
added
area-mvc
Includes: MVC, Actions and Controllers, Localization, CORS, most templates
and removed
area-web-frameworks
*DEPRECATED* This label is deprecated in favor of the area-mvc and area-minimal labels
labels
Nov 7, 2024
Thank you for filing this issue and providing clear and complete information on how to reproduce it. I have reproduced it and done some investigation. I believe that this is happening because when the result value is wrapped in "Ok" the type information is lost / not conveyed to System.Text.Json, which treats is as just a regular object rather than a Cat.
I will continue investigating and post here when I have something concrete.
Is there an existing issue for this?
Describe the bug
I am using polymorphic JSON which works when returning the class but not when returning
Ok(data)
because then the$type
type discriminator is missing.Works:
Does not work:
Also does not work:
Expected Behavior
When using the
Ok
method to return aOkObjectResult
it should output a type discriminator.Steps To Reproduce
Exceptions (if any)
No response
.NET Version
8.0.10
Anything else?
No response
The text was updated successfully, but these errors were encountered: