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

Paths and operations: Query String in Paths and recommendation #304

Open
thernstig opened this issue Jun 11, 2021 · 0 comments
Open

Paths and operations: Query String in Paths and recommendation #304

thernstig opened this issue Jun 11, 2021 · 0 comments

Comments

@thernstig
Copy link

https://swagger.io/docs/specification/paths-and-operations/ under "Query String in Paths" mentions:

This also means that it is impossible to have multiple paths that differ only in query string, such as:

GET /users?firstName=value&lastName=value
GET /users?role=value

This is because Swagger considers a unique operation as a combination of a path and the HTTP method, and additional parameters do not make the operation unique. Instead, you should use unique paths such as:

GET /users/findByName?firstName=value&lastName=value
GET /users/findByRole?role=value

I cannot make sense of this recommendation, as in making me believe it is almost incorrect and should not be there.

Imagine if you extrapolate this suggesiton so you have name, role, occupation, country etc. Having multiple findBy is impossible especially the more combinations you have.

For me, this is completely logical and valid to filter by certain things:

GET /users?firstName=value&lastName=value
GET /users?role=value

It means I can add/remove firstName, role, occupation, country etc. as I see fit to only limit results that match all of my filters.

@hkosova hkosova self-assigned this Jun 11, 2021
@hkosova hkosova removed their assignment Apr 4, 2022
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

2 participants