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

I'm trying to document an existing API that uses a single path with query parameters to specify the different actions: #62

Open
cobertvc opened this issue Aug 16, 2023 · 1 comment

Comments

@cobertvc
Copy link

I'm trying to document an existing API that uses a single path with query parameters to specify the different actions:

/api?action=action1&some-param=1
/api?action=action2&other-aparam=2

If I would put all parameters under a single path, that would force all parameters under that path, too and would mix a lot of parameters that are only valid on certain actions.

The Swagger editor doesn't let me create multiple entries for the same path, even if the action parameter is required with a different value on each. and doesn't accept /api?action=action1 as a separate path either.

Is the unique path a requirement from Swagger or from the OpenAPI spec ?

Is there a good workaround how to handle this ?

Thanks!

Originally posted by @willamowius in OAI/OpenAPI-Specification#3344

@whitlockjc
Copy link
Member

In your examples, the path is identical because the path portion of the API is /api. This is why we don't support a "path" as being a combination of path and query parameters. This is an OpenAPI rule. As for how you can handle this, you could have a single /api path and use the path-level parameters to document action and the other parameters. I'm sure you're wanting to document a certain combination of parameters as a single "API" but that isn't support in OpenAPI right now (parameter dependencies) and this is documented here: https://swagger.io/docs/specification/describing-parameters/#dependencies

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