-
Notifications
You must be signed in to change notification settings - Fork 174
Closed
Labels
enhancementRequires or request to feature enhancementRequires or request to feature enhancementneed-more-infoNeed more information (error message, stack trace, repro code etc)Need more information (error message, stack trace, repro code etc)
Description
I'm using the Redis MsgPack wrapper, but I've tried this separately using the raw MsgPack SDK as well.
I have a simple polymorphic type hierarchy e.g.
type Animal = Cat | Dog
etc. etc., and I want to serialize a list of animals. The problem is that it appears that you need to enclose the list in a type e.g.
type Data = { Animals = ResizeArray<Animal> }
and then place an set of attributes on that property with all of the possible subclasses (or try one of the Runtime attributes).
There are several we face with this approach: -
- Every property on every type that has a List of Animal has to have the same attribute / attributes (or perhaps we need to create a custom List that subclasses List etc.). This means attributes all over our types etc.
- The bigger issue that is we need to create an enclosing type with a single property just to place the serialization polymorphism information. We should be able to store this information on the types themselves, and / or have a mechanism to do this lookup (similar to how JSON .Net works).
Have we missed something out here?
Metadata
Metadata
Assignees
Labels
enhancementRequires or request to feature enhancementRequires or request to feature enhancementneed-more-infoNeed more information (error message, stack trace, repro code etc)Need more information (error message, stack trace, repro code etc)