Hello, to please my workplace’s API gateway, I’m trying to make the OpenAPI generated by Tapir explicitly add explode: true in the spec of a query parameter that takes a list:
I have a custom wrapper class to hold a non-empty set of Ints
final case class Tiles(ids: NonEmptySet[Int])
object Tiles {
def from(ids: Seq[Int]): Option[Tiles] =
NonEmptySet.fromSet(SortedSet(ids: _*)).map(Tiles(_))
}
We can change the code linked above as well, if explicitly specifying true would have any uses? (well I guess it would, since you have a problem with it, question is if that’s a rare exception or a rule )
Hi Adam, thanks for the suggestion but it doesn’t seem to work either.
The extension is properly added to the OpenAPI object but the attribute gets lost during serialization there:
Because jsonWithoutExt contains explode: null by default. This behavior would also affect other extension attributes trying to override those of the model specification.
A simple fix would be to swap the deepMerge operands:
But I don’t know if it’s a more desirable behavior. I believe letting EndpointToOpenAPIPaths set the explode attribute explicitly even when redundant might be better.
Hm I think I tested this on your example and it worked, but maybe it was somehow simplified. I think the overriding behavior you describe is fine, let’s try opening a PR and we’ll see if any tests fail