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

pathItem has a wrong key when using regexes. #49

Closed
Fifi31 opened this issue Nov 3, 2022 · 1 comment · Fixed by #50
Closed

pathItem has a wrong key when using regexes. #49

Fifi31 opened this issue Nov 3, 2022 · 1 comment · Fixed by #50

Comments

@Fifi31
Copy link

Fifi31 commented Nov 3, 2022

Hi,
Following this issue, there is a problem when using regexes on path.

Let's say I have 2 routes : GET /users/{userID:[^/]+} and POST /users/{userID:[^/]+}.

In helper.go, in Spec.SetupOperation(), we get the pathItem (l.40) from s.Paths.MapOfPathItemValues by using the path as key (so in this case, /users/{userID:[^/]+}). But at the end of the method, we set the new pathItem under the key /users/{userID} (the path without the regex). When we setup the operation for the next method, we get the pathItem under the key /users/{userID:[^/]+}, which is empty, so the first routes is overridden completely by the second one.

I think getting the pathItem after the regex substitution should solve the issue (so after l. 51, maybe at l.54 because the first use of pathItem is at line 55).

@vearutop
Copy link
Member

vearutop commented Nov 3, 2022

Thank you for spotting this bug and investigating the code. 👍
You're right with the suggested solution. 💪

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 a pull request may close this issue.

2 participants