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

Query String in Paths #2438

Closed
EmDee opened this issue Jan 11, 2021 · 4 comments
Closed

Query String in Paths #2438

EmDee opened this issue Jan 11, 2021 · 4 comments

Comments

@EmDee
Copy link

EmDee commented Jan 11, 2021

The spec doesn't seem to define, if query strings are allowed in paths or not.

According to the docs on swagger.io (section Query String in Paths) this is not allowed.

There are some related issues that doesn't seem to have a definitive answer either, e.g. #123.

Are there official specs regarding this problem?

@darrelmiller
Copy link
Member

The phase path is based on the RFC3986 definition. Therefore, paths can't contain query parameters.

@EmDee
Copy link
Author

EmDee commented Jan 16, 2021

Is this something that should be made more explicit in the specification?

When reading the specification regarding the paths object it states Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical. which would be the case for paths which only differentiate in their query params, however, the next sentence states In case of ambiguous matching, it's up to the tooling to decide which one to use. which seems to nullify the previous sentence or am I misunderstanding this?

@SteveNay-vz
Copy link

I think you're overlooking the distinction between paths and query strings, which is pretty explicit in RFC3986. The path stops where the query string starts; even if a request contains query strings, they are not considered part of the path. The description of the paths object in the specification is about paths only; it should not be understood to apply to query strings at all.

Your statement about "paths which only differentiate in their query params," confuses the two concepts. Two paths which only differentiate in their query params would be one and the same path, not two different paths.

@MikeRalphson
Copy link
Member

which would be the case for paths which only differentiate in their query params

In

Templated paths with the same hierarchy but different templated names MUST NOT exist as they are identical.

The key word is templated. The guidance refers to paths such as /users/{name} and /users/{id}.

Closing, as the spec currently as written conveys the intent.

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

4 participants