Tarmil / FSharp.SystemTextJson

System.Text.Json extensions for F# types
MIT License
325 stars 44 forks source link

Prevent nulls inside array/lists #57

Closed drhumlen closed 4 years ago

drhumlen commented 4 years ago

You should not accept ["hello", null, "world"] unless the type is string option list. If the type is a string list with nulls inside, it should fail.

This has led to nasty NullReferenceExceptions in our backend because the code downstream expected a list of 'a, but the list turned out to contain some nulls.

~I'm currently trying to fix it, but I'm unable to use the isNullableFieldType (from Helpers.fs) because the fsOptions: JsonFSharpOptions isn't avaiable in the type JsonListConverter<'T>() etc classes.~

drhumlen commented 4 years ago

https://github.com/Tarmil/FSharp.SystemTextJson/pull/58

drhumlen commented 4 years ago

Merged.