Questions tagged [tapir]

Tapir is a declarative, type-safe web endpoints library, written in Scala. The endpoints can be interpreted as a server (integrating with akka http, http4s, play, finatra, vertx and others), as a client (using sttp client) or as openapi / asyncapi documentation.

The tapir source code is available on GitHub. Usage documentation is also available.

Tapir endpoints are described as values, using a Scala API. Thanks to Scala's type system, a number of properties are checked at compile-time.

35 questions
3
votes
1 answer

Circe,Tapir and JodaTime

I have a case class like final case class MyClass(id: Long, eventData: EventsDTO) final case class EventsDTO( customerId: Long, eventName: String, processTime: DateTime //JodaTime ) I have custom encoder and decoder as val…
Arjun Karnwal
  • 379
  • 3
  • 13
3
votes
1 answer

Tapir Custom Codec

I am stuck at a place, I am using scala, tapir and circe. sealed abstract class S1Error extends Product with Serializable object S1Error { final case class SError(error: SMError) extends S1Error } sealed abstract class SMError(message:…
Arjun Karnwal
  • 379
  • 3
  • 13
3
votes
2 answers

Tapir - Method too large

Im defining endpoints using tapir however i get the following compilation error. [info] Compiling 3 Scala sources to /endpoints/target/scala-2.13/classes ... [error] Error while emitting/endpoints/Session$ [error] Method too large:…
Kay
  • 17,906
  • 63
  • 162
  • 270
3
votes
0 answers

Tapir - List type for input parameter not working

I am defining an API endpoint using tapir which goes like this import io.circe.generic.auto._ import sttp.model.StatusCode import sttp.tapir.json.circe._ import sttp.tapir._ val endpo: Route[List[String], String] = endpoint.post …
Arjun Karnwal
  • 379
  • 3
  • 13
2
votes
0 answers

Retrieve query parameter with RFC3986 reserved characters not decoded in Tapir/http4s

I'm new to Scala (and thus tapir/http4s) and I would like to get a query parameter with RFC 3986 reserved characters not percent-decoded. Indeed, I'm using some reserved characters as delimiters (namely , and :) but when…
FredericS
  • 413
  • 4
  • 9
2
votes
1 answer

How to create an endpoint with Tapir in Scala with multiple Schemas

I’m just heading an issue when I’m trying to create an endpoint with multiple bodies shape. My model looks like this: sealed trait FileExampleTrait { def kind: String } case class FileExampleOne(name: String, length: Int) extends FileExampleTrait…
2
votes
1 answer

How to make an Scala Enumeration implement a Trait without modifying the original Enum?

I'm toying with Scala for the first time so bear with me. Also using tapir to declare an API, where I'm having issues providing a Schema for an enum. I have a bunch of enums defined that are part of my domain model and that extend Scala's…
1
vote
1 answer

sttp/tapir - testing endpoint with JSON body

I have some tapir endpoints defined as part of a zio-http server. Everything works for real, including those POST endpoints with JSON bodies. However, I've been unable to get a unit test using SttpBackendStub & TapirStubInterpreter to work for…
1
vote
1 answer

Redoc documentation for tapir endpoint with sealed heirarchy not rendering as expected

I'm trying to define a tapir endpoint, which will accept two potential different payloads (in the snippet below, two different ways of defining a Thing). I'm broadly following the instructions here: https://circe.github.io/circe/codecs/adt.html, and…
user3468054
  • 610
  • 4
  • 11
1
vote
1 answer

How to customise logging in tapir?

I'm sure this is a ridiculous question... I'm trying to enable tapir's logging as described here: https://tapir.softwaremill.com/en/v0.19.0-m4/server/debugging.html ... but even having looked at the ServerOptions docs, I'm not getting anywhere. My…
user3468054
  • 610
  • 4
  • 11
1
vote
0 answers

Scala, Tapir - implicit problem with oneOfVariantFromMatchType from tapir

I have created few own errors: sealed trait Error case class FirstError extends Error case class SecondError extends Error I added it to tapir: val firstError = oneOfVariantFromMatchType(StatusCode.BadRequest,…
Developus
  • 1,400
  • 2
  • 14
  • 50
1
vote
1 answer

Scala, Tapir, ZIO - add metrics interceptor with default error handler

Have a question regarding Prometheus metrics in Tapir and ZIO. I have a simple code: val metrics = PrometheusMetrics.default[Task]() val options: ZioHttpServerOptions[Any] = ZioHttpServerOptions .customiseInterceptors …
Developus
  • 1,400
  • 2
  • 14
  • 50
1
vote
1 answer

Tapir with Akka HTTP file upload - Sending an 2xx 'early' response before end of request was received

I use tapir + akka http for the service. One of the endpoints downloads files. val load : Endpoint[Source[ByteString, Any], Any, Any, AkkaStreams] = endpoint .post .in("load") .in(streamBody(AkkaStreams)( …
John
  • 103
  • 1
  • 11
1
vote
1 answer

ZIO 1.0.3 changes the way environments work and now http4s Blaze won't run

I'm using ZIO for the first time and I started with a boilerplate stub from https://github.com/guizmaii/scala-tapir-http4s-zio/blob/master/src/main/scala/example/HttpApp.scala that uses ZIO version 1.0.0-RC17 to set up and run an http4s Blaze…
emote_control
  • 745
  • 6
  • 21
1
vote
0 answers

Tapir, Circe, Schema

I have a case class like this case class OffboardingError1( userId: Option[String], error: OffboardingErrorType1 ) object OffboardingError1 { implicit val encode: Encoder[OffboardingError1] = deriveEncoder[OffboardingError1] …
priyanka Dhiman
  • 95
  • 3
  • 11
1
2 3