-
Notifications
You must be signed in to change notification settings - Fork 160
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
Path with several "{...}" incorrectly parsed #358
Comments
dedece35
pushed a commit
to dedece35/openapi-diff
that referenced
this issue
Mar 29, 2022
dedece35
pushed a commit
to dedece35/openapi-diff
that referenced
this issue
Mar 29, 2022
you can see the PR : #359 |
joschi
pushed a commit
that referenced
this issue
Jun 7, 2022
Fixes #358 Co-authored-by: David DE CARVALHO <[email protected]>
hello @joschi when do you think that there will be a new release ? thank you. best regards, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Explanation
When a path contains several variables with "{}" characters, the template computed for this URL is incorrect.
Example with URL template computed correctly :
/avis/by_id_utilisateur-{id_utilisateur}
/avis/by_id_utilisateur-{}
Example with URL template incorrect :
/avis/by_id_utilisateur-{id_utilisateur}_code_support-{code_support}
/avis/by_id_utilisateur-{}
If we have an API with these two paths,
/avis/by_id_utilisateur-{id_utilisateur}
and/avis/by_id_utilisateur-{id_utilisateur}_code_support-{code_support}
thus de verification will fail with an error
Two path items have the same signature: /avis/by_id_utilisateur-{}
.This is because of wrong templates computed during the control process.
Analysis / Solution
After, an analysis of code, this template URL computation was made by a method that does a replace from a regex pattern.
This pattern is wrong, we should have "\{([^/{}]+)}" to exclude "{" and "}" from detection.
I tested this pattern locally and it's ok for me with this last regex pattern.
If you want I can correct it. I will create a PR if nobody does it before me :p
thanks.
David.
The text was updated successfully, but these errors were encountered: