Zio-http: Set method on route handlers to prevent overlap#4833
Draft
amumurst wants to merge 1 commit into
Draft
Conversation
Contributor
Author
|
Tests fails so it seems it was not that simple.. |
Member
|
I think there might a step later in the pattern-generation where we combine patterns for multiple endpoints, so that if you have |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/andPOST /foo/barzio-http will currently mark them as duplicates in zio-http since the method is hard coded to be Any in the ZioHttpInterpreterSetting 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)