Skip to content

Conversation

amumurst
Copy link
Contributor

@amumurst amumurst commented Sep 24, 2025

This is attempting to fix the issue where you can not add overlapping method for zio-http. If I add two methods

GET /foo/bar/ and POST /foo/bar zio-http will currently mark them as duplicates in zio-http since the method is hard coded to be Any in the ZioHttpInterpreter

Setting these will trigger:
https://github.com/zio/zio-http/blob/443db4097f33d348d293ef3f55abdc5cb7198d6d/zio-http/shared/src/main/scala/zio/http/Routes.scala#L280

Which has called unique from:
https://github.com/zio/zio-http/blob/443db4097f33d348d293ef3f55abdc5cb7198d6d/zio-http/shared/src/main/scala/zio/http/Routes.scala#L324

by calling the method in which checks equals on method:
https://github.com/zio/zio-http/blob/443db4097f33d348d293ef3f55abdc5cb7198d6d/zio-http/shared/src/main/scala/zio/http/RoutePattern.scala#L130

Which is why they are marked as overlapping even when they have different methods.

It might well be that this is too simple and there is no real good solution for this; but hoping that its just an oversight 🙏

(should resolve some of the issues mentioned here? https://github.com/softwaremill/tapir/blob/master/doc/server/ziohttp.md?plain=1#L59)

@amumurst amumurst marked this pull request as draft September 24, 2025 12:17
@amumurst
Copy link
Contributor Author

Tests fails so it seems it was not that simple..

@adamw
Copy link
Member

adamw commented Sep 25, 2025

I think there might a step later in the pattern-generation where we combine patterns for multiple endpoints, so that if you have GET /foo and POST /foo Tapir-endpoints, you end up with a single ZIO-HTTP pattern. So maybe that's the problem. But generally generating these patterns correctly has been definitely non-trivial (and still is lacking in some respects)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants