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

Ensure method signatures are minimal

Open nikileg opened this issue 5 months ago • 1 comments

Requirements by @987Nabil

We need to ensure, that method signatures are minimal. Meaning not only minimal in the amount of params but in the power the handed over params can do. One such example you see below in the original text of the issue.

Original

Is your feature request related to a problem? Please describe. The method Body.to[A] currently requires a BinaryCodec[A] instance, though it only performs decoding operations. This creates unnecessary constraints as users must implement a full codec even when only decoding functionality is needed.

Describe the solution you'd like I suggest changing the method signature to use BinaryDecoder[A] instead:

def to[A](implicit decoder: BinaryDecoder[A], trace: Trace): Task[A]

Describe alternatives you've considered Keeping the current implementation if there are backward compatibility concerns

Additional context Similar consideration might apply to encoding methods (from, fromStream, fromStreamEnv) which currently require BinaryCodec but only use encoding functionality.

nikileg avatar Jul 24 '25 18:07 nikileg

This can't be done in a binary compatible way. In 4.0 this structure will change anyway. I will keep this issue open for tracking and ensuring APIs a minimal in requirements to preform their functionality.

987Nabil avatar Nov 30 '25 07:11 987Nabil