Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
  • Oct 16 15:22
    tomasherman opened #1537
  • Oct 15 17:57
    tomasherman commented #1526
  • Oct 15 17:54
    tomasherman synchronize #1526
  • Oct 15 17:47
    tomasherman commented #1526
  • Oct 15 17:42
    tomasherman synchronize #1526
  • Oct 15 14:23

    mergify[bot] on master

    Update akka-stream to 2.6.17 Merge pull request #1536 from s… (compare)

  • Oct 15 14:23
    mergify[bot] closed #1536
  • Oct 15 13:23
    mergify[bot] labeled #1536
  • Oct 15 13:22
    scala-steward opened #1536
  • Oct 15 11:54
    bartekzylinski assigned #1434
  • Oct 15 11:43

    mergify[bot] on head-range-support


  • Oct 15 11:43

    adamw on master

    Implemented accept range support Added test Added handling of HEAD requests… and 16 more (compare)

  • Oct 15 11:43
    adamw closed #1527
  • Oct 15 11:23
    bartekzylinski synchronize #1527
  • Oct 15 11:23

    bartekzylinski on head-range-support

    Fixed setup of double endpoints… (compare)

  • Oct 15 10:48
    adamw commented #1203
  • Oct 15 09:35
    xeppaka commented #1203
  • Oct 15 09:09
    micossow synchronize #1508
  • Oct 15 06:49
    xeppaka commented #1203
  • Oct 14 22:20

    mergify[bot] on master

    Update swagger-ui to 3.52.5 Merge pull request #1535 from s… (compare)

after updating to 0.18, the Play interpreter (with default options) suddenly returns 404 for any endpoint. Reason seems to be, that we configured the application context for play via
play.http.context = /something
I found no settings in PlayServerOption so my question is: what is the right way to deal with non empty application context? (You can test this with https://github.com/gaeljw/tapir-play-sample when adding the setting in https://github.com/gaeljw/tapir-play-sample/blob/master/conf/application.conf)
4 replies
Yoann Gasnière

I'm trying to use a SttpClientInterpreter with a SttpBackend[IO, WebSockets] (especially FetchCatsBackend[IO]) backend to handle a websocket in a scala.js client.
According to the docs I should use this import: import sttp.tapir.client.sttp.ws.fs2._ but sbt is unable to resolve it (the "ws" package is not found in the Scala.js version of the lib).
I've followed this example SttpClientTests but it leads to:
error : Cannot prove that sttp.capabilities.WebSockets with sttp.capabilities.Effect[[+A]cats.effect.IO[A]] <:< sttp.capabilities.fs2.Fs2Streams[cats.effect.IO] with sttp.capabilities.WebSockets.

Is handling a WS client side with sttp and cats/ fs2 supported?

I would be very grateful for any help!

2 replies
Batiste Dekimpe

Hi everyone, I'm using the version 0.16.16 (I didn't get the chance to upgrade yet) and starting yesterday, I've seen this error appearing in a refactoring:

could not find implicit value for evidence parameter of type sttp.tapir.Schema

This appears for classes I use in jsonBody, but only in one of my files. In the others, it works as expected. Is there a quick fix I'm missing ?
Thanks a lot in advance

1 reply
Dave Whittaker

Hey all. Hoping to get a little help with outputting OpenAPI. I've got http4s running inside Jetty as we transition away from some legacy stuff. Jetty is also serving assets like CSS files, so I needed to configure http4s to only respond to /api/v2/*, which I did via a mapping like this

          .mountService("api/v2", API.service, dispatcher = dispatcher, mapping = "/api/v2/*")

With the mapping I don't specify /api/v2 as an in param when defining endpoints and as a result OpenAPIDocsInterpreter doesn't seem to be able to determine that the prefix exists. This is particularly a problem when trying to call the endpoint from the swagger UI. The YAML must not contain the /api/v2 prefix so it ends up trying to call [server]/[endpoint_without_prefix]. Any idea how I can fix this?

3 replies
David Geirola
Hi guys why Tapir by default doesn't accumulate errors with Circe for missing elements/nodes ?
3 replies
Hey, I'm new to Scala and I'm really liking this library,
I'm really sorry if this is the wrong place to ask, but I made a custom trait for http responses, and I would love to get some feed back before using this pattern thought my code base
val base = login
      oneOf[HttpResp[LoginErr] | HttpResp[ExternalErr]](

val loginRoute: HttpRoutes[IO] =
    Http4sServerInterpreter[IO]().toRoutes(login)(login => IO(Left(LoginErr())))
trait HttpResp[A: Encoder: Decoder: ClassTag: Schema]:
      def map: OneOfMapping[A] =
        oneOfMapping(code, jsonBody[A].example(apply).description(description))
      def apply: A
      def msg: String
      def code: StatusCode
      def description: String

case class LoginErr(msg: String = "wrong login or password") extends HttpResp[LoginErr]:
    def apply = LoginErr()
    def code = StatusCode.Unauthorized
    def description = "wrong user credentials"

case class ExternalErr(msg: String = "failed to connect to external service") extends HttpResp[ExternalErr]:
    def apply = ExternalErr()
    def code = StatusCode.FailedDependency
    def description = "failed to connect to external service"
3 replies
Denis Novac
Hi everyone. I see there is an XMLBody in Tapir which requires an implicit codec. Is there any library which does such xml codecs? E.g. circe's Codecs are compatible with Tapir's JsonBody.
1 reply
hi team, is there an example of PlayServerInterpreter with zio?
1 reply
Sebastian Voss
Hi All, I'm using .in(header("x-user")) to capture a value which gets added by an auth proxy. Therefore it should not show up in the OpenAPI docs. Would extractFromRequest be the best method to achieve this or is there a better way?
1 reply
How do you use ztapir endpoints and the zhttp interpreter together, seeing ztapir creates endpoints requiring the websockets capability and the zhttp interpreter does not support that capability?
2 replies
But why do ZTapir endpoints always rely on WebSockets capability?
3 replies
I am not using any websockets, and when stripping away that capability with asInstanceOf[...] I can interpret them just fine.
The type signature would be more accurate that way – it's a bit confusing that the capability parameter does not reflect the actual required capabilities of the endpoint. Because I am not actually using WebSockets, there should be no problem handing the endpoints to an interpreter that does not support WebSockets, but that is the case now because of how this is done. Unless there is some huge disadvantage from fixing it, I'd say adding that type parameter would be the correct approach.
1 reply
Hi I am using tapir since a while, and it's really but recently I really went to improve the generated openapi documentation.
I just read about the @description annotation that is really useful to add description to generated schema.
But my case class are defined outside my web module and I don't want to leak dependencies of tapir-core to all my other module. I know I could derive the schema automatically and then modify it using the copy technique.
But I was wondering if others would also think it would be great to have a minimal tapir jar with just schema annotation inside it, so we could use them without having to depend on tapir core?
11 replies
Bárður Viberg Dam
Hi. Is there any way to explicitly set the charset in the Content-Type header in json responses? I have a consumer that if no charset is provided, falls back to another charset than utf-8.
4 replies
Mouafak Mkhallalati

How do I create an optional file part?

case class MyPayload(file: Option[Part[java.io.File]])


Results in this error

Cannot find a codec between a List[T] for some basic type T and: Option[sttp.model.Part[java.io.File]]

Note that the following works fine
case class MyPayload(file: Option[java.io.File])
but I lose the metadata (filename)

And if I use
case class MyPayload(file: Part[java.io.File])
It shows up as required in the docs

5 replies
David Leonhardt
Is there a way to have different input based on content type like it's possible for outputs?
Something like this:
3 replies
Carlos Martin

Hi! I have updated Tapir to version 0.19.0-M5 and some dependencies are missing in the maven repo. For instance: https://repo1.maven.org/maven2/com/softwaremill/sttp/tapir/tapir-swagger-ui-akka-http_2.13/0.19.0-M5/tapir-swagger-ui-akka-http_2.13-0.19.0-M5.pom

In the log of the publish job (gh action) I have not found errors neither the log of the artifact to be published. Thanks!

4 replies
Alex Henning Johannessen
@adamw Seems that the unification of swagger ui does not work for index.html in that it falls back to .getOrElse(MediaType.ApplicationOctetStream) and causing the browser to download the index file
31 replies
Gwenael Cholet
Dear all, I am just new with tapir and trying the first example from github page. Here is the example:
2 replies
val booksListing: Endpoint[(BooksFromYear, Limit, AuthToken), String, List[Book], Any] =
.in(("books" / pathString / pathInt).mapTo[BooksFromYear])
.in(queryLimit.description("Maximum number of books to retrieve"))
I ran error with the jsonBody
Which librairy is supposed to bring it?

Hello. I have server http4s , tapir as api description and zio as server interpreter.

I want to log user id after auth.bearer[String]() passed. But i log incoming request in http4s.

Is there any example, how can i log request with authorization?

4 replies

Hi, guys! I have a question about openapi yaml generation -
I've changed one of my case class fields in api response from Map[String, MyClass] to a List[MyClass], and now it is not marked as a required property (as Map object was).
For example, this:

case class MyResponse(
      @description("String field") myString: String = "Hello",
      @description("List field") myList: List[String] = Nil

Leads to the result -

    - myString
    type: object
        type: array

It seems like an array type fields are not marked by Tapir as required properties by default, is this true?
If so, is there an easy (or the preferred = ) way to do this?)

8 replies
Hi @adamw, it doesn't seem like tapir-swagger-ui-zio-http_2.13:0.19.0-M7 is published.
2 replies
I was just about to say the same – tried to upgrade, but ran into that issue.
1 reply
hey guys, is this "com.softwaremill.sttp.tapir" %% "tapir-json-zio" % "0.19.0-M7" not available for scala 3? It cant seem to download it.
I use play framework, is there a way to get the play Route documentation? or is there an easy way to build the documentation?
1 reply
Anton Solovyev
Hi! Is there some implementations for micrometer or some plans? (like, tapir-prometheus-metrics)
1 reply
Gwenael Cholet

Dear @Adamw, I am trying the following example to expose a route to serve svg file content:

import akka.http.scaladsl.server.Route
import sttp.tapir._
import sttp.tapir.server.akkahttp.AkkaHttpServerInterpreter

import scala.concurrent.Future

val filesRoute: Route = AkkaHttpServerInterpreter().toRoute(

Despite I have tapir-core i am unable to import filesServerEndpoint. Always unknow.
Also how can I add a route to render the file name. Thanks in advance for you answer.

2 replies
is used
with ("site" / "static")("/home/static/data")
Gwenael Cholet
How can we make a swagger UI route def for filesServerEndpoint?
Christopher London

Does anyone know how I can make a query param of Option[List[A]] work? I keep getting Codec errors?

[error] Did you define a codec for: Option[List[String]]? [error] Did you import the codecs for: sttp.tapir.CodecFormat.TextPlain? [error] query[Option[List[String]]]("id_types")

4 replies
Hello. Can i exclude some header("x-id") from openApi documentation?
Maybe there is .ignore method?
2 replies
Gwenael Cholet
Does someone knows how to use the very useful method getFromFile within tapir route/endpoint system? Thanks in advance
Gwenael Cholet
For example if I want to download any file - xlsx, xml, xtx - and to answer it as byte array$
2 replies
Gwenael Cholet
I am also trying the example MultipartFormUploadAkkaServer with object case class UserProfile(name: String, hobby: Option[String], age: Int, photo: Part[File])
2 replies
But I cannot find codec for the Part[File]
could not find implicit value for evidence parameter of type Titi.this.JF[sttp.model.Part[java.io.File]]
implicit val tt: JsonFormat[UserProfile] = jsonFormat4(UserProfile.apply)
Uwe Reimann
Hi. I'm trying to use a base endpoint for authorization. The base endpoint set E to ErrorInfo as described in https://tapir.softwaremill.com/en/latest/endpoint/statuscodes.html. Is it possible to provide additional error mappings in the secured endpoint (like ValidationError), or do I have to provide the error mappings of any specific (secured) endpoint in the base endpoint?
2 replies
Bill Frasure
Hi, I've got a list of ServerEndpoints in my ApplicationLoader, and my colleague is asking for a basic list of all the corresponding URLs.
Any tips for how to get only the hard String values and pathParam values?
The closest I've come so far is serverEndpoint.info.show, but that includes QueryParams, POST payloads, etc
Bill Frasure
Okay I figured it out. Wasn't too hard, but it does rely on internal methods-
import sttp.tapir.EndpointInput.{FixedPath, PathCapture}
import sttp.tapir.internal.RichEndpointInput

serverEndpoint.input.traverseInputs {
        case path: FixedPath[_] => Vector(path.s)
        case pathCapture: PathCapture[_] => Vector (pathCapture.name.map("$" + _) .getOrElse("$unnamedPathVariable") )
1 reply
@adamw I am trying to derive a Schema[Map[User.Id, User]] where User.Id is defined as a newtype (using zio.prelude) with java.util.UUID as the underlying type and I have mapped the Schema[UUID] instance to define the Schema[User.Id] instance. When I use Schema.schemaForMap[User.Id, User] the name of the component in the OpenAPI documentation becomes Map_<refinement>_User. Is there anything I can do to make the macro use a proper name for the newtype? Where would the macro be getting the name <refinement> from in this case?
2 replies

Is it possible to define endpoint that return Seq[T] and response status code different than default?
I would like in case of processing request success return 201 Created together with Seq[MyCustomType] MyCustomType has circe Encoder/Decoder and Schema

Still I'm not able to define it because of type erasure, in docu I see an exaple with Either, but I'm not able to align it for Seq[T] https://tapir.softwaremill.com/en/latest/endpoint/statuscodes.html

6 replies
Thanks in advance for any suggestions :)
basically in case of success I have one scenario: return 201 Created together with Seq[MyCustomType] - is it simple way to express it?

Hello. Is there any way to describe in docs parameters of SeeOther.
I return this:

            .description("Redirect address \n params: `status` - success or fail")

I want to write in docs queryParameter status.

1 reply