steamclock / netable

A Swift library for encapsulating network APIs using Codable in a type-oriented way.
MIT License
99 stars 3 forks source link

Add support for partially decoding arrays #107

Closed brendanlensink closed 1 year ago

brendanlensink commented 1 year ago

For #106, #104

This PR adds a new convenience container called LossyArray that's meant to help with partially decoding arrays of objects, where you don't want to fail the whole request if one of the objects fails to decode.

I'm still working on getting some convenience finalizes together, but generics are hard 😵 In the meantime, I thought it would be good to get your feedback on how this seems.

Also fixes RetryConfiguration not being marked as Sendable and reformats the README to be a little more accessible

nbrooke commented 1 year ago

This looks reasonable as a starting point, three comments:

brendanlensink commented 1 year ago

@nbrooke reworked this to use a new Request param: arrayDecodeStrategy.

This feels a little janky, especially in the SmartUnwrap case... but it's hard for me to tell if that might just be the cost of doing business with all the generics, etc or if there's a way to simplify things a little.