-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
Overloading #298
Comments
+1 |
1 similar comment
+1 |
I think this duplicates a lot of the discussion on #333 and could be closed, but +1 from me as well. |
+1 |
+1 Lack of operator overloading is exactly the problem I've been having with Swagger :( |
Link to parent #565 |
@mrpotes - can you give an example from your own use case? I'm having a bit of a hard time coming up with a real use case this applies to. The use cases I may be able to come up with should be resolved by something other than operation overloading (but should be resolved). |
@webron Yep, sure. For context, consider a RESTful HTTP user service, /users, which permits create, update, read, delete, patch using the usual HTTP verbs:
However, for users there are other non-RESTful operations that you would also want to expose - for example, forgot password. We implement that service as a POST to /users?action=forgotPassword. Both POST operations, the create and the forgot password, have distinct, fixed schemas and are best exposed as distinct |
By the way, the link to parent issue #565 doesn't appear to have worked afaics |
@mrpotes Thanks for the explanation. I believe this relates more to what constitutes a unique operation than allowing multiple definitions per path - but the idea is clear. @jasonh-n-austin linked to the parameters meta issue, I'll link to the other one. We're in the process of organizing the tickets before diving into them, which is why you don't see any active work on the meta issues yet. Parent issue: #574. |
While this is too large of a change for the 3.x line, it is being addressed under the "Signature, please!" principle of OAS 4 Moonwalk. Therefore I'm closing this in favor of the work happening in the Moonwalk repo. |
For response and operation overloading, we can use
oneOf
of JSON Schema. It's flexible and doesn't require a lot of changes in the specs.Here is an example of how
oneOf
can solve response overloading:We can also use
oneOf
for operator overloading:One thing that we should be careful about describing overloading is that Swagger should never describe the logic of how and why any of options will work.
The text was updated successfully, but these errors were encountered: