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

Equivalent paths are not allowed even though the path + verb combination is different (OpenAPI Rule 'path-params' issue) #2767

Open
dilanka-cacib opened this issue Dec 30, 2024 · 0 comments

Comments

@dilanka-cacib
Copy link

dilanka-cacib commented Dec 30, 2024

The Bug

My OpenAPI file has 2 endpoint paths with different path + verb combination as below.

  1. /path/{id} -> DELETE
  2. /path/{source} -> GET

When I validate the OpenAPI file using spectral, I receive policy rule fail from OpenAPI Rule 'path-params' with below error.

Paths "/path/{id}" and "/path/{source}" must not be equivalent.

To Reproduce

  1. Download this zip file: spectral-path-param-issue.zip
  2. Unzip it.
  3. Run command cd spectral-path-param-issue
  4. Run command spectral lint spectral-path-param-issue.yaml

Expected behavior

Since, verbs are different for each endpoint, I shouldn't receive an error.

Screenshots

image

Environment

  • Library version: 6.14.2
  • OS: Windows 10 Enterprise

Findings

After I debugged the library, I found oasPathParam is not considering different verbs when its looking for uniquePaths here.
image

Additional context

I found same issue has reported to swagger-editor here: swagger-api/swagger-editor#1677 and they have fixed it.
I can see, swagger editor is working fine now with my OpenAPI file.

image

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