Hi, I have endpoint with 23+ query params, and of sake of convenience I`ve mapped them to case class.
and it works just fine untill 23rd parameter in list. The error is following:
The arity of the source type doesn't match the arity of the target type
So my question is how to handle such cases(23+ query params mapped to case class)?
This is a limitation in scala (2, in scala 3 it could’ve worked, but tapir is cross built to scala 2 as well)
- As a general rule of thumb, you probably want to avoid classes and function with high arity
- You can group subsets of parameters, and compose, e.g. something like:
Yes, we have tuple operations defined only up to 22: https://github.com/softwaremill/tapir/blob/462ca9dfa4ee78c7e8dd0c3422ef779f1e44968c/core/src/main/boilerplate-gen/sttp/tapir/typelevel/TupleOps.scala#L724
As @hochgi mentioned, we could fix this using Scala 3, but so far this code is kept the same for Scala 2/ Scala 3. Not that we wouldn’t welcome a PR changing this, but so far nobody complained