@angelmunoz content in the fediverse

Home
@alexzeitler@mastodon.social Ye...

@angelmunoz@misskey.cloud Yeah but don't have to...

@@angelmunoz...

@angelmunoz@misskey.cloud Yeah but don't have to deal with unexpected null values in F# anyway? Client can lack the property having a value at all or send a null value instead.

@alexzeitler@mastodon.social Yeah you have but knowing that you need to do it kind of makes it approach it differently

I could simply add that rule in my thoth.json decoders or the try catch in the deserialization step

but if I set the binding to a record without optional properties then I would blindly trust the F# compiler that I wouldn't get the exception

I guess you could argue that you'd need to make every property (or at least the most likely) optional at the edge and have some sort of mapping function to avoid this

Still my issues would lay on binding to non-optional properties and letting the framework to set them to null which is something I've been bitten before in other tools like LiteDB