-
Notifications
You must be signed in to change notification settings - Fork 635
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
Polymorphic primitive collection serialization. #40
Comments
The root of the problem is that So my suggestion is to create something that could be probably called |
My use case is the following. I have dynamic data store, that has fixed elements with a type and dynamic fields where the type might be unknown.
|
Note that omitting the wrapping and explicit typing could be omitted by the encoder/decoder. Obviously they then need an alternative way to indicate the type of the object encoded/decoded. |
Hey, I stumbled upon this while trying to figure out how to register primitives and nulls. I made a stack overflow question about this exact problem here: https://stackoverflow.com/questions/72325605/how-to-properly-register-primitives-and-nulls-in-polymorphic-serialization |
When serializing a polymorphic collation of primitives using the
PolymorphicSerializer
the type is always included. Including the type of the primitives might not be necessary. I feel like this is a common use case thus it should be addressed.Example
Possible solutions
PolymorphicSerializer::save
could omit the type information when serializing primitives or standard collections.PolymorphicSerializer
class or a different object that behaves as described above. It might be desired to fine tune such behavior.The text was updated successfully, but these errors were encountered: