question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support an operation to have multiple specifications per path (e.g. multiple POST operation per path)

See original GitHub issue

with POST actions especially, there can be several unrelated operations that would be better presented to the user as separate POST actions in swagger-ui because they do very different things to the same resource. Each of these different operations should have a unique description string and unique media types to select from and other unique parameters (such as query parameters), and thus have separate presentation in swagger-ui. By simply allowing only just schema overloading, there is no way for me to constrain query parameter A to be used with just media type X, and query parameter B to be used with media type Y. These are implemented as two independent operations and it would be nice to be able to model them independently in Swagger.

So I think a proposal i saw elsewhere to annotate the operations themselves (to provide unique keys in the JSON object) would actually be more flexible than other workarounds to the fact that Swagger only allows one POST per path when a REST API may in fact support many independent POST calls.

i.e. something like

paths:
 /a/b/c:
   get: ....
   put: ...
   post.optimize: spec for the optimize operation
   post.merge: spec for the merge operation

(Initially discussed in #146)

Issue Analytics

  • State:open
  • Created 9 years ago
  • Reactions:105
  • Comments:66 (10 by maintainers)

github_iconTop GitHub Comments

22reactions
DavidBiesackcommented, Dec 11, 2015

What we are doing in the interim is to use #tag in the paths to differentiate these.

/a/b/c: post: /a/b/c#merge: post:

We have customized Swagger UI to hide these tags and remove them from the Try It/curl actions

Each of these post operations can have their own parameters/produces/consumes.

I realize that almost none of the existing Swagger ecosystem will work with this, but we need to move forward, and this is the path we’re taking. It was the easiest and lowest impact change to Swagger UI and the swagger documents, and it works fairly well. Our expectation is to be able to transform our use to wherever Swagger.Next goes.

16reactions
bkeeler-redoxcommented, Jul 3, 2020

Wow, this is a big gap in OpenAPI, so it’s quite surprising to see how long this discussion has been ongoing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Paths and Operations - Swagger
A single path can support multiple operations, for example GET /users to get a list of users and POST /users to add a...
Read more >
OpenAPi 3.0.3 - can I use two POST methods for the same path
OpenAPI only allows one POST/GET/etc. operation per path, but you can define multiple possible request bodies by using oneOf:
Read more >
Open Api documentation for a single endpoint multiple posts ...
Here is the corresponding feature request: Support an operation to have multiple specifications per path (e.g. multiple POST operation per ...
Read more >
Step 4: The paths object (OpenAPI tutorial) | Documenting APIs
Each item in the path object contains an operation object. (Operations are the GET, POST, PUT, and DELETE methods we explored in the ......
Read more >
OpenAPI Definition & Online Tools | Open API Standards List
In either YAML or JSON, OpenAPI paths contain an array of endpoints. ... the Swagger Specification, many companies have signed on to support...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found