swagger-api / swagger-api/swagger.io-docs

Paths and operations: Query String in Paths and recommendation

Open
#304 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Astro
Stars
1.6k
Forks
407
Avg merge
2m
Merged PRs (30d)
2

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the “Query String in Paths” section at swagger.io/docs/specification/paths-and-operations/ and review the surrounding OpenAPI guidance on paths, operations, and parameters. Compare the recommendation with the relevant specification rules and determine whether the wording needs clarification or correction; done means the documentation accurately explains valid query filtering and operation uniqueness.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi
Domain
documentation
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.