Paths components without ``/`` separator

Hi, I have an endpoint that looks like this: /foo/<param>.json.

I am not sure how to describe path components not separated by a / ?

I used this workaround but it’s a bit ugly:

  val ep ="foo" / pathWithSuffix[LocalDate]("bar", ".json"))

  def pathWithSuffix[T](name: String, suffix: String)(using c: PlainCodec[T]): EndpointInput.PathCapture[T] =
      .map(_.stripSuffix(suffix))(_ + suffix)

Path segments are always separated by a / - I think your solution is the correct one from tapir’s point of view.

OK, do you think it is worth an addition to the tapir DSL ? Maybe I can come up with some syntax on PathCapture to end up like:"foo" / path[T]("bar").withPrefix("baz"))"foo" / path[T]("bar").withSuffix(".json"))"foo" / path[T]("bar").surroundedBy("baz", ".json"))

Or in the style of scodec:"foo" / "baz" ~ path[T]("bar"))"foo" / path[T]("bar") ~ ".json")"foo" / "baz" ~ path[T]("bar") ~ ".json")

Sure, this might be a good idea :slight_smile: I think I prefer the named variants much more (withPrefix etc.). The withSuffix should be especially useful.