Closed reinux closed 1 year ago
Right, we need to support DefaultIgnoreCondition.WhenWritingNull
as an alternative to the deprecated IgnoreNullValues
.
Awesome, thanks! This will help a ton.
While updating to release version, our CI hits the breaking change :( As it seems to me, it is not possible the configure the previous behaviour:
None
/ ValueNone
propertiesoption
/ 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.
I think a configuration optionFieldsSkippable
would restore the previous behaviour. Would that be considered an improvement to the library?
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
Is there a way to have an option field be required?
For example, if
LastName
here is null, it should be set toNone
, but if it's missing in the json, it should throw an exception.Reason being that I want to make sure an API consumer isn't accidentally missing a field.
I'm assuming this is why we would use
Skippable
withIgnoreNullValues
, but the latter's been deprecated, and the new one it suggests seems to have no effect.