Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflicting Routes cause 405 Error #943

Open
mathiasmah opened this issue Aug 5, 2024 · 0 comments
Open

Conflicting Routes cause 405 Error #943

mathiasmah opened this issue Aug 5, 2024 · 0 comments

Comments

@mathiasmah
Copy link

Describe the bug
I ran into an issue, that the Validator returned a 405 Error for an existing Route.
The Problem is that there is a conflict between two routes, where one is an explicit path and the other looks the same but contains a path parameter.

Here are the routes that cause the issue:

[POST | DELETE] /v1/products/{id}/{flagName}

[GET] [/v1/products/{idordivanr}/list

The Validator matches for calls that should go to the second route, also the first one, and then gives the error since GET is not a valid method.
In express, I can work around this issue by the order the routes are registered, but for the validator the order does not matter, it always searches the route alphabetically.

I think I found the relevant lines in the source code:

We finally managed to work around this, by changing the parameter of the second route, so that it alphabetically appears before the first route. (idordivanr -> divanrorid)

So I'm not sure if this is even a bug, or by design.
I just wanted to let you know that I ran in to this issue, and I am curious what the reasons are for this.
What does the Open API Specification say about this? I didn't really find anything.
Maybe this is ready just bad design by my side? Because nobody else seems to be having this issue.

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

No branches or pull requests

1 participant