Skip to content

Question on Tapir Integration #119

Closed Answered by Iltotore
cosmir17 asked this question in Q&A
May 10, 2023 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

Hi 👋

I never used Tapir but I suggest you to check the ZIO JSON Module. The process should be similar.

Note: I'm not suggesting you to switch to ZIO JSON but to look the module's code because Tapir support probably can be done in a similar way.

I think it should look like this:

//> using scala "3.2.2"
//> using lib "io.github.iltotore::iron:2.1.0"
//> using lib "com.softwaremill.sttp.tapir::tapir-core:1.3.0"

import io.github.iltotore.iron.*
import io.github.iltotore.iron.constraint.all.*

import sttp.tapir.{Schema, Validator, ValidationResult}

inline def ironValidator[A, C](inline constraint: Constraint[A, C]): Validator[A] =
  Validator.custom(
    value =>
      if constraint.test(val…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@2m
Comment options

Answer selected by cosmir17
Comment options

You must be logged in to vote
1 reply
@Iltotore
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants