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)

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
Stanislav Bolsun
Hello, I have tapir Schema for some type A and want to generate open-api doc for the type A only. Can I do it? (without generation whole documentation, I need only yaml with single A type description as object).
4 replies

hi everyone!
I've stumbled upon this: I have this in the endpoint definition:


and in the openapi spec it generates it as optional:

"requestBody": {
  "content": {
    "application/json": {
      "schema": {
        "type": "array",
        "items": {
          "$ref": "#/components/schemas/MyData"
  "required": false

is there a reason for this or is it a bug? can I somehow tell tapir that it's not optional?

3 replies

@ex0ns: hi! :)

I think the reason is that the array is required by default as it's top level, but the array might be empty

that's what I want, but "required": false says it's not even required, and openapi generator for typescript generates the body as optional

and if someone sends a POST request with body=undefined, the backend will try to parse the body as a JSON array and will fail because it will be empty (empty body)

@yurique Iterables are rendered as optional in the documentation because tapir has the opinion that there isn't really any difference between an empty array and an undefined array in JSON. And in most cases that's true, for example with your List[MyData] the codec should generate an empty list if there isn't defined one in the JSON which will fulfill the requirements of the spec.
I agree with Yurique that in some condition, it does cause issue, as for the empty body instead of body with empty list

In the meantime a solution might be to have a fallback when parsing a List in the backend, where you would return an empty list in case of failure, that is far from perfect, but would not be too hard to implement (custom encoder), or you could wrap the list in an object and use it in the json body

final case class RequestBodyData(data: List[MyData])

But the resulting JSON would look like

  "data": [ ] 
well, circe doesn't think an empty string is parseable as an empty list ;)
scala> import io.circe.parser._
import io.circe.parser._

scala> parse("")
val res0: Either[io.circe.ParsingFailure,io.circe.Json] = Left(io.circe.ParsingFailure: exhausted input)
@ex0ns: I was thinking about wrapping that list into a case class, the best I could think of

but this doesn't seem right:

tapir has the opinion that there isn't really any difference between an empty array and an undefined array

to be sure I sent an empty body to that endpoint (with http4s backend), got a Bad Request with a message from circe:
"Invalid value for: body (DecodingFailure at : C[A])"
Patrick Roemer
I'm trying to get a query parameter with a default value. What I have is this:
implicit val xyzSchema: Schema[XYZ] =
    .default(XYZ.X, Some(XYZ.X.tag))

implicit val xyzCodec: PlainCodec[XYZ] =
    .mapDecode(s => DecodeResult.fromOption(XYZ(s)))(_.tag)
5 replies
Works, but if I pass an invalid value (that returns None from XYZ#apply()), it will be accepted and reverted to the default value X. What I'd want is that the default fallback is only applied if the query parameter isn't present at all, but a decode failure if an invalid value is given. Am I doing anything wrong and/or can this be achieved somehow?
Patrick Roemer
Another question: I have an endpoint that generates the same output shape for error responses in the 400s range. I came across this discussion:
The suggested #map() approach seems to work fine in general, but of course the OpenAPI doc only shows the describedStatusCode. Is there any way to get a 4XX range rendered instead? (I guess not, but perhaps I'm missing some trick.)
2 replies