-1

I'm trying to document an existing API with OpenAPI 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 to create a logical separation between the different functionality, 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?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Gene Vincent
  • 5,237
  • 9
  • 50
  • 86
  • OpenAPI is a documentation spec for RESTful APIs. The API you describe does not conform to [RESTful principles](https://stackoverflow.com/questions/4024271/rest-api-best-practices-where-to-put-parameters). – esqew Aug 14 '23 at 14:44
  • As explained in the [linked question](https://stackoverflow.com/q/40495880/113116), this is not supported by the OpenAPI Specification. – Helen Aug 14 '23 at 16:59

0 Answers0