Issues with enum serialization
See original GitHub issueHiya,
This library looks very promising. We are working on integrating it with Starlite. One issue we came up with the lack of support for serializing Enum
values into JSON. So we would like to report this issue.
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Misleading documentation on serialization of enums #1248
Either the documentation should state that this holds only for enums that are serialized as fields of a class or this case should...
Read more >java - Is custom enum Serializable too?
The process by which enum constants are serialized cannot be customized: any class-specific writeObject, readObject, readObjectNoData, writeReplace, and ...
Read more >How To Serialize and Deserialize Enums with Jackson
In this quick tutorial, we'll learn how to control the way Java Enums are serialized and deserialized with Jackson 2.
Read more >Enum de/serialization with REST backward compatibility ...
This can be an issue when you are working in a micro-service landscape and you are dealing with backward compatibility. A quick example....
Read more >ALWAYS assign enum values (at least, if you serialize them)
Now, we have a big issue. This enum is serialized into an asset file (ScriptableObject), so every value has a specific number.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can confirm that it works! I have a working branch with the Starlite integration using
msgspec@main
for about a week now! Added that as soon as you merged theEnum
update. Sorry for not mentioning it sooner.Thanks for opening this.
Nice! Please let me know if you run into any other issues or have questions, use cases like Starlite are one of the main reasons I wrote msgspec.
This was an early decision based on a specific use case I had at the time, but it seems like most other tools encode/decode by value instead. I’ve been thinking about changing this to match (still only string or int values for now). This issue is enough of a motivation to make that change, shouldn’t be that much work.
There are not any workarounds for this unfortunately. This can only be fixed by changing the behavior in msgspec.
Can you continue integration work without this fix? I’ll hopefully have time in the next few weeks to fix this and get a new release out.