-
Notifications
You must be signed in to change notification settings - Fork 21
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
Include union type as dictionaries #44
Comments
Not sure whether this should be its own issue or under this one, but I am currently unable to serialize field-less enums - they all panic with a backtrace like this:
As soon as it gets to any struct which has a fieldless enum as one of its fields (when I remove all enum fields from the struct, i no longer get the error). |
I'm not sure if you would want to include this as an intermediate option, but my current workaround for this is to just serialize them as strings (with a |
The dictionary part is actually not the tricky part - as it is already implemented :). My issue is rather how to do all of this in a generic way. My feeling is the type as a string could be useful in addition to the data quite some often. So my current thinking is to allow maximum flexibility:
What is keeping me from implementing it, is mostly, that I'm not sure whether I like this approach :) (plus time) |
Started work in #185 |
See here for the current design: #183 (comment) |
Merged #185 |
Update: serialize unions as is, but include an additional
{name}_type
field that encodes the union type in human readable form.At the moment field-less enums are serialized as a union of null fields. This is probably not expected (or desired). Probably it would be better to serialize it as a string-dictionary.
Current idea:
The text was updated successfully, but these errors were encountered: