-
Notifications
You must be signed in to change notification settings - Fork 461
chore: make endpoint.show customizable in interpreter #4895
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: make endpoint.show customizable in interpreter #4895
Conversation
|
Thanks for the PR :) Could you maybe share an example, of how the current |
|
Yeah that's rather long ;) I don't think |
|
Yep, will do, thanks for taking a look. |
|
Here's a somewhat compact reproduction: object test {
import eu.timepit.refined.api._
import eu.timepit.refined.string._
import eu.timepit.refined._
import io.estatico.newtype.macros._
import sttp.tapir._
import sttp.tapir.codec.newtype._
import sttp.tapir.codec.refined._
import sttp.tapir.generic.auto._
type NumRegex = MatchesRegex[W.`"""\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d\\d"""`.T]
@newtype case class NumString(value: String Refined NumRegex)
case class Numbers(
a: NumString,
b: NumString,
c: NumString,
d: NumString,
e: NumString,
)
object Numbers {
implicit lazy val schema: Schema[Numbers] = Schema.derived
}
val instance = endpoint.post
.name("test numbers endpoint")
.tag("test")
.in("numbers")
.in(sttp.tapir.formBody[Numbers])
def main(args: Array[String]): Unit = {
println(instance.show)
}
} |
|
to narrow it down a bit more: it comes from the validator of the refined type: but when we .show just that schema directly: |
|
I'd propose a different fix: #4910 |

for highly-newtyped/refined-typed endpoints Endpoint.show is sort of a nightmare to wade thru in the logs so just wanted to suggest this.