-
Notifications
You must be signed in to change notification settings - Fork 54
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
JetStream enum PascalCase serializer #225
Conversation
System.Text.Json serializer has some difficult settings serializing enums. Before we just relied on unconventional property names in code but proper way is to use PascalCase. Unfortunately the JSON options also did not allow snake_case conversion also I didn't want to force System.Text.Json v8 onto net6.0 targets (if that supports it). Hence we now have a JetStream specific JSON enum convertor.
I'm a bit confused -- system.text.json 8.0.0 has a net6 target and supports snake/kebab case naming policies. Why reinvent the wheel? The net8 work on performance is second to none; I'm worried we may be leaving some perf on the table with a home rolled solution, so to speak. edit: Okay, you don't want to force consumers of the library onto v8. It' early morning here, lol. There's always multitargeting/conditional msbuild package include and |
I agree we don't want to maintain something that is already out there. Performance shouldn't be a big concern here as much since stream and consumer configs won't be on any hot path in vast majority of the cases.
:o) That's true. edit: @oising see the last commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Look great, enums feel much more natural now. It is a bit annoying System.Text.Json
doesn't have this until 8.0. I don't particularly like the idea of forcing an upgrade of System.Text.Json
to 8.0 if on net6.0
then, so I like this approach.
LGTM
Also doesn't really seem worth it to maintain different models using precompiler directives ( |
oops sorry. just saw your comment. Have a look at the last commit. It didn't look too bad. Happy to revert though 😄 |
The only word didn't quite match the convention was |
Actually yea that is not so bad, it's mainly limited to just 1 file, and 1-liners in other files. Will just need to make sure the test coverage hits both |
yes. it's xunit magic. when the project is multi-targeted xunit is running the tests for all targets. |
Nice work! |
System.Text.Json serializer has some difficult settings serializing enums. Before we just relied on unconventional property names in code but proper way is to use PascalCase. Unfortunately the JSON options also did not allow snake_case conversion also I didn't want to force System.Text.Json v8 onto net6.0 targets (if that supports it). Hence we now have a JetStream specific JSON enum convertor.