Skip to content
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

How to get the behaviour before breaking change #123 ? #138

Closed
SamuelBerger opened this issue Nov 12, 2022 · 4 comments
Closed

How to get the behaviour before breaking change #123 ? #138

SamuelBerger opened this issue Nov 12, 2022 · 4 comments

Comments

@SamuelBerger
Copy link

While updating to release version, our CI hits the breaking change #123 :(

Is there a way to configure the old behaviour:

  • serialize None / ValueNone properties
  • deserialize missing option / voption properties to None / ValueNone

IgnoreNullValues = true or DefaultIgnoreCondition = WhenWritingNull affects serializing as well.

Am I missing a trick (without changing all option properties to Skippable)?

(Throwing an exception for missing non option record properties is pure gold, so allowNullFields would never be an option.)

If there isn't a way to get the old behaviour, would a configuration optionFieldsSkippable be considered an improvement to the library?

@ly29
Copy link

ly29 commented Nov 14, 2022

While I understand this change I think the previous default was the sane behavior and having expectations like built in is wrong.

So while I look into an replacement library, if any, it would be nice that the previous behaviour was at least an option.

@Tarmil
Copy link
Owner

Tarmil commented Nov 30, 2022

Yes, I see that this is a common request. I agree that we should add an option to have the previous behavior without needing IgnoreNullValues/DefaultIgnoreCondition.

@Tarmil
Copy link
Owner

Tarmil commented Jan 21, 2023

The new option SkippableOptionFields was added in v1.1 for this use case. https://github.com/Tarmil/FSharp.SystemTextJson/blob/master/docs/Customizing.md#skippable-option-fields

@Tarmil Tarmil closed this as completed Jan 21, 2023
@SamuelBerger
Copy link
Author

🤩Thank you @Tarmil ! You're the best!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants