-
Notifications
You must be signed in to change notification settings - Fork 86
Open
Description
System.Text.Json includes support for defining polymorphic types, along with a customizable discriminator field and value:
[JsonPolymorphic(TypeDiscriminatorPropertyName = "?")]
[JsonDerivedType(typeof(Subtype), "subtype")]
public interface MyType
{
// ...
}
public class Subtype : MyType
{
// ...
}When outputting the type, this information is not included:
export interface MyType
{
// ...
}
export interface Subtype extends MyType
{
// ...
}What would be nice, is if it was! 🎊
// ...
export interface Subtype extends MyType
{
"?": "subtype";
// ...
}It's extremely valuable and important to support this because any system that is sending out types like this will need those discriminator keys and values populated. Failure to include them will result in parse errors, or create additional toil/manual overhead or bloat to communicate type information outside of the serialization pipeline.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels