-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
[openapi-3] callbacks support #411
Comments
As the callback object wraps a pathItem object, in widdershins and openapi-gui I've rendered callbacks by repeating the pathItem template/component, but within a visually distinct containing |
Is there any update on this issue? |
Hi - inquiring if this is being considered. IMO it would be a highly valuable feature. |
I would also be interested in such a feature. Example OpenAPI spec: callback.yaml (based on the Swagger callbacks documentation page) Rendering on the ReDoc Interactive Demo (not working yet). As comparison how other tools are doing this: OpenAPI-GUI:mentioned by @MikeRalphson in #411 (comment) (more an editor than a display, but the interesting point in the "callbacks" tab)Swagger-UI:In my opinion, the problem with representing the callbacks under an operation makes sense from an Editing point of view but is not really what the used need: But often when you look at a reference documentation you are more interested by "what can call me?", meaning by a list of all callback-operations that can be send by the server and that you need to handle. An implementation could be:
|
This is PoC to display callback events in ReDoc. See Redocly/redoc#411
Because our callbacks operation are always the same (we send a given Schema as Request-Body of a POST method), I have implemented a small PoC of what I have described above: There is a main section "Callbacks events" and each callback is documented as separated entry in the tree. See spec: todoAppWithCallbacks.yaml (ReDoc live demo) This is using the I would prefer to have an I did not investigate how to create links between the operation and the callback description. |
@jmini I don't know if the issue is your api definition, or with the implementation in Redoc. Here is what I noticed. I think my confusion is mainly due to the api definition mismatching names event, event name and eventType. I suppose this could be resolved by tightening up that definition. Overall, this seems kind of cool. I understand the desire to not have this:
However, I can't see where in the definition it would show that the callback is made via a |
First of all, thank you for your feedback and sorry for the delay. I agree the OpenAPI spec that I have proposed to test this might not be ideal (design is not perfect), but is representative of the spec we are currently using in the project (some stuff can not be changed for backward compatibility). I totally get your point about the Nevertheless this is not enforced by the OpenAPI spec, it is possible to have a registration operation that do not let you filter the kind of event you would like to receive (probably you do just get all events). The prototype I have proposed in my previous comment is something that can be done with the current ReDoc version by adding the The Callbacks are defined under the path If would be great if based of this input, ReDoc would automatically: 1a) Create the “Callbacks events” in the tree In this section you see all the callback events that can be received, with a label indicating the HTTP method and maybe an other marked (I have used In my example there are only “POST” request callback, but you could also imagine that the sever is sending other calls to the client that is receiving the callback request. 1b) For each Callback event, instead of my quick hack "Following request-body is send as POST…", a complete representation of the operation should be displayed:
2a) In the Operation where the callbacks are defined: There should be a section that indicates that callbacks are defined for this operation: I am not sure about the position, it should probably be after "Responses". 2b) The other way around: in one page displaying one callback, you could also imagine a link to the registration operation (the operation that defines the callback in the OpenAPI Spec). I hope this makes my vision for Callbacks in ReDoc more clear. If not feel free to ask. |
Hi everyone, are there any news regarding the callback support of redoc? |
It appears to be supported in my currently used 2.0.0-rc.27 Fixed by #1224 |
Are callbacks supported for redoc-cli? I followed the guide to add callbacks at https://swagger.io/docs/specification/callbacks/. Can't seem to get it to build properly. Builds just fine on swagger. The version of redoc-cli is 0.9.7.
No Callback tab on redocWorks on SwaggerEdited: Added images. |
@jaspersorrio what version of |
Could you explain what this means? Can you share your definition? or minimal reproducible sample? |
Hi @RomanHotsiy, You may use this snippet to reproduce the "bug".
|
I just run The latest version of redoc-cli is:
You must have cached the older one. Try adding version explicitly |
@RomanHotsiy, you just saved me so much time, I am so grateful for your help. Thank You so much!!! |
OpenAPI 3.0 has callbacks support: https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#operation-object
It would be great to support them in ReDoc but I don't have any idea of how to visualize them yet.
Let's share ideas/discuss it here.
The text was updated successfully, but these errors were encountered: