zio-json icon indicating copy to clipboard operation
zio-json copied to clipboard

JsonDecoder's `orElse` and `map` do not defer `unsafeDecodeMissing` to `self`

Open Kalin-Rudnicki opened this issue 2 years ago • 1 comments

  • Is this a deliberate decision, or just was not thought of?
  • I see there is this suspend function, which will at least defer on unsafeDecodeMissing, but then as soon as you map that, its lost.
  • Also, for example, the decoder for Option overrides map to defer on unsafeDecodeMissing, but if you were to map a second time, it would be lost.
  • The only reason I can think not to do this would possibly be performance reasons, but that seems like a really trivial thing, and can imagine it will cause way more problems than its worth.

If it is the case that it is desirable to change this behavior, and defer to self, I would be interested in making a first contribution to change this.

Kalin-Rudnicki avatar Aug 12 '22 16:08 Kalin-Rudnicki

Seems to have been an oversight. Happy to review your PR :)

fsvehla avatar Aug 15 '22 14:08 fsvehla

Just put up a PR for this

Kalin-Rudnicki avatar Aug 20 '22 12:08 Kalin-Rudnicki