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

Path template matching needs more specific matching rules according to method matching #2343

Open
wsalembi opened this issue Sep 7, 2020 · 0 comments
Labels
request matching Matching requests to URL templates, media types, etc.

Comments

@wsalembi
Copy link

wsalembi commented Sep 7, 2020

The path template matching rules in the spec lead to confusion in several implementations of OpenAPI validators.
https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.3.md#path-templating-matching

Given the specification https://petstore3.swagger.io. What is the right result when a client sends a request
curl -X POST "https://petstore3.swagger.io/api/v3/pet/findByStatus"

Should this call be matched with path "/pet/findByStatus" and then result in a 405 Method Not Allowed error since the path has no POST verb.

Or can this call be matched with path "/pet/{petId}" and result in a call to operationId updatePetWithForm?

Per specification: When matching URLs, concrete (non-templated) paths would be matched before their templated counterparts. Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. In case of ambiguous matching, it's up to the tooling to decide which one to use.

So per spec: POST to /pet/findByStatus should match the path /pet/findByStatus since it's an exact match of a concrete path.

What should vendors to if paths match, but verbs don't? Continue matching with other paths or abort?

@MikeRalphson MikeRalphson self-assigned this Apr 10, 2021
@MikeRalphson MikeRalphson changed the title Path template matching needs more specific matching rules according to verb matching Path template matching needs more specific matching rules according to method matching Feb 21, 2023
@handrews handrews added the request matching Matching requests to URL templates, media types, etc. label Jan 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
request matching Matching requests to URL templates, media types, etc.
Projects
None yet
Development

No branches or pull requests

3 participants