softwaremill / softwaremill/tapir

[improvement] zio-http integration not comfortable failed effect usages

Open
#1,782 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.5k
Forks
468
Avg merge
5h 37m
Merged PRs (30d)
34

Description

Tapir version: 0.19.3

From contract programming all looks good, but it becomes quite uncomfortable with latest update

zio-http integration not comfortable failed effect usages

Exsisting tapir library code
` implicit class RichZEndpoint[A, I, E, O, C](e: Endpoint[A, I, E, O, C]) {

def zServerLogic[R](logic: I => ZIO[R, E, O])(implicit aIsUnit: A =:= Unit): ZServerEndpoint[R, C] =
  ServerEndpoint.public(e.asInstanceOf[Endpoint[Unit, I, E, O, C]], _ => logic(_: I).either.resurrect)

def zServerSecurityLogic[R, U](f: A => ZIO[R, E, U]): ZPartialServerEndpoint[R, A, U, I, E, O, C] =
  ZPartialServerEndpoint(e, f)

}`

See logic ZIO[_ , E, _] contract forces to be with same error channel as Endpoint E
if endpoint don't declare error E is Unit
and clients can not use Task[O] and have manually describe in all places InternalServerError

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing RichZEndpoint integration shown in the issue, especially zServerLogic and zServerSecurityLogic, and trace how endpoint error types reach zio-http handlers. Clarify the intended behavior for endpoints without declared errors and for Task[O] handlers. Done means the integration no longer requires manually declaring InternalServerError in every such usage, with corresponding tests for the supported cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.