zio/zio-json

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

Kalin-Rudnicki opened this issue · 2 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.

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

Just put up a PR for this