I have a set of Tapir ZServerEndpoint which I want to include in a zio-http server which also runs other, non-tapir defined endpoints. When I add them as-is it works as expected but when I try to serve the routes at a different root (nested routes), it always returns a 404.
When I print all routePatterns the routes are as expected but somehow the behaviour does not reflect this.
I am wondering if I am doing something wrong or if the Tapir conversion add some strict root-path checks?
Small example:
val tapirRoutes = ZioHttpInterpreter().toHttp(endpoint.in("foo").zServerLogic(_ => ZIO.unit)) val allRoutes = tapirRoutes ++ (literal("bar") / tapirRoutes)
When calling /foo I get an OK response but when I call /bar/foo it returns a 404.
Why would this happen?
Adam, do you have any idea what could cause this? I am happy to try and fix it if it really is a bug but I do not really know where to look for this one. Perhaps you can help me get kick-started and point me to some relevant lines-of-code?
I suspect it might be something with pattern generation & request path consumption in ZioHttpInterpreter. Maybe we’re using the entire request path to do the matching, not the “unconsumed” path? I’d start looking there.