Skip to content

Something funky is happening with paths after upgrade from 0.13.1 to 0.13.3 #220

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
zupo opened this issue Mar 13, 2020 · 10 comments · Fixed by #222
Closed

Something funky is happening with paths after upgrade from 0.13.1 to 0.13.3 #220

zupo opened this issue Mar 13, 2020 · 10 comments · Fixed by #222

Comments

@zupo
Copy link
Contributor

zupo commented Mar 13, 2020

I maintain an example Pyramid app that uses openapi-core under the hood. When upgrading the library from 0.13.1 to 0.13.3 I've encountered a strange bug: responses fail because they don't match schemas of other endpoints. Weird, right? Read on.

In the PR linked above, you can see that I had to move the endpoint definition for /articles/{slug}/ to a position after endpoint definitions of more specific endpoints, such as /articles/{slug}/comments, /articles/{slug}/comments/{id} and /articles/{slug}/favorite. Otherwise, a valid request to /articles/{slug}/comments would fail during response validation with ValidationError:'article' is a required property.

It seems that something changed in how paths are registered and this change now requires that more specific subpaths are now defined before less specific paths. I.e. /item/{id} needs to be defined below /item/{id}/foo in openapi.yaml file.

I haven't yet managed to isolate this bug further. @p1c2u do you have any ideas off the top of your head what could cause this?

@sarangsbabu367
Copy link

@zupo can you check the issue you are facing is #219 , I reported this issue.

@zupo
Copy link
Contributor Author

zupo commented Mar 15, 2020

I don't think these two are the same.

@p1c2u
Copy link
Collaborator

p1c2u commented Mar 16, 2020

Hi @zupo
yeah it must be some problem with path finder

@svdgraaf
Copy link

Can confirm, having the same issue...

@p1c2u
Copy link
Collaborator

p1c2u commented Mar 17, 2020

Prepared test #221 for the use case. Looks like this issue exists in combination with pyramid integration.

@zupo
Copy link
Contributor Author

zupo commented Mar 17, 2020

Hmm, OK. Let me take another look at it.

@zupo
Copy link
Contributor Author

zupo commented Mar 17, 2020

@svdgraaf: are you using pyramid_openapi3 or sth. else?

@svdgraaf
Copy link

I'm generating my own openapi config from AWS ApiGateway, and the order of methods is "random", this works fine on 0.13.1, but on 0.13.3 it started matching the wrong endpoints, eg: POST /keys/[id]/tokens was mapped to POST /tokens. If I manually switch the methods around in the openapi spec, it works.

I downgraded to 0.13.1 again, and now it works. So something broke in between, haven't looked further yet.

@p1c2u
Copy link
Collaborator

p1c2u commented Mar 17, 2020

Now I see the problem. Prepared test with potential fix for the case.

@SirEdvin
Copy link

SirEdvin commented Apr 2, 2020

@p1c2u when you will make new release?

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.

5 participants