Skip to content

Two path items have the same signature - must include Http-Method into check #170

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

Closed
ahoehma opened this issue Sep 13, 2020 · 3 comments · Fixed by #224
Closed

Two path items have the same signature - must include Http-Method into check #170

ahoehma opened this issue Sep 13, 2020 · 3 comments · Fixed by #224
Labels
Milestone

Comments

@ahoehma
Copy link

ahoehma commented Sep 13, 2020

Hi,

I think I found a little bug in the diff algorithm ... please correct my if I'm wrong 😃

My schema contains something like this:
GET /api/vi/configuration/{configurationId}
POST /api/vi/configuration/{productId}

If run the diff then I got an error because of found more then one "/api/vi/configuration/{}".

I tried to fix this by adding an additional check:

Optional<String> result =
        right.keySet().stream()
             .filter(s -> normalizePath(s).equals(template))
             .findFirst();

to

Optional<String> result =
        right.keySet().stream()
            .filter(s -> normalizePath(s).equals(template) && right.get(s).readOperations().equals(leftPath.readOperations()))
            .findFirst();

to com.qdesrame.openapi.diff.core.compare.PathsDiff.diff(Map<String, PathItem>, Map<String, PathItem>)

The exception is gone ... but now I have strange compare results if the api is 100% equal. So I guess my fix is not 100% complete yet.

Any ideas?

@joschi
Copy link
Contributor

joschi commented Sep 13, 2020

@ahoehma Thanks for reporting this!

Could you please post a minimal but valid excerpt of your OpenAPI specifications (old and new) so that we can reproduce the issue?

@Oxydation
Copy link

Hello,
I`ve run into the same exception and have attached (as requested) a valid excerpt of a OpenAPI spec (reduced to the essential parts). You can use this as old and new file. The diff algo does seem to ignore the naming of the params, here "deviceId" for one and "dashboardId" for the other when comparing the paths.

swagger_old_small.txt

@kotsaris
Copy link

Just stumbled on this bug myself. Triple checked the available endpoints and no duplicates.
Same endpoint exists for two different HttpMethods
GET /businessunits/{id}
PUT /businessunits/{name}

Error: Reason: Two path items have the same signature: /businessunits/{}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants