Closed jvliwanag closed 3 years ago
This is an interesting suggestion. From my reading, we're essentially moving from using getField
for each field in a record:
to attempting to use getFieldOptional
for each field, falling back to getField
:
I'm intrigued, but this would be a significant change so I'd like to leave this open for a time to allow some discussion. Thank you for taking the time to write this up!
Anything we can do to see this go through? Would love to use argonaut records directly for simple web api’s.
I'll leave this open for a little while to let other maintainers weigh in, but if I haven't merged it in a week please ping me and I will @jvliwanag -- thanks!
I'm fine with it - I probably wouldn't choose to have it work this way personally if I was designing a library from scratch, as I don't think you can distinguish between the field missing and having no value present now, right? But Maybe
collapsing happens with the encoding used elsewhere so it's already established that this library doesn't care about that kind of distinction.
Are we good with this @thomashoneyman ? :)
On a side note, I do prefer Nothing
be encoded as missing fields. I'll open a separate issue on that.
Decodes missing fields in a record as
Nothing
.Adds a helper type class
DecodeJsonField
Fixes #92