-
Notifications
You must be signed in to change notification settings - Fork 47
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
Add support for JsonSerializerOptions.NumberHandling
#494
Conversation
@SteveDunn Would you be opposed to the migration of the models to Scriban or something? This might make some of these changes easier if we can pass in a tfm from the |
Thanks for the PR! Yes, it is painful when making a change to the generated code. There is a flag that can be set in This deletes all of the snapshots and treats all of the generated code as the correct code from now on. I've never heard of Scriban, but I'll take a look. Thanks for the recommendation. |
Also, could you tell me what tests are failing due to time-zone differences? I thought (hoped!) that I'd fixed all of those. |
|
@SteveDunn any chance this PR can be merged and a new release dropped soon? |
Hi @viceroypenguin - sorry for slow responses lately, it's been busy in my day job and I'm trying to finish up #479 which has taken much longer than expected! I'll hopefully be finished within a day or so, I'll release both at the weekend, if that's OK with you? |
Merged just now - thank you again @viceroypenguin ! I'll fix those tests soon too - I think I know what's wrong. |
Should be in nuget soon v. 3.0.22 |
Thank you @SteveDunn! |
This PR adds support for
JsonSerializerOptions.NumberHandling
on net5+, while retaining old behavior on other frameworks.When supported (net5+) and
Conversions.TreatNumberAsStringInSystemTextJson
is not set, then the converter will readJsonSerializerOptions.NumberHandling
to determine whether to allow parsing numeric values fromstring
tokens, similar to the effectJsonSerializerOptions.NumberHandling
has on deserializing numeric primitives.@SteveDunn I was not able to get the verify files updated correctly. I ran the
test.ps1
, and it failed due to TZ issues, and would not generate any of the verify files.I have verified that this change works correctly for my situation; if this change is not desired, feel free to close.
Fixes #493