Redocly / redoc

📘 OpenAPI/Swagger-generated API Reference Documentation
https://redocly.github.io/redoc/
MIT License
23.58k stars 2.3k forks source link

callbacks section is missing from generated documentation #1961

Closed IlanAvigdor-af closed 2 years ago

IlanAvigdor-af commented 2 years ago

When using an OpenAPI definition which includes callbacks, for example this one, the callbacks section is not visible in the generated UI. I'm not sure whether it's a configuration issue or a bug.

Expected behavior For an OpenAPI definition doc which includes callbacks, a callbacks section should appear in the generated documentation.

Minimal reproducible OpenAPI snippet(if possible) https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/callback-example.yaml

This is how the callbacks looks like when the Demo site is used, but this section is not visible when using redoc in our site callbackssample

AlexVarchuk commented 2 years ago

Hi @IlanAvigdor-af, thank you for the issue. I tried to reproduce it but had no success. I use link which you included in the issue. Can you provide more details on how you use redoc on your site?

Thanks.

IlanAvigdor-af commented 2 years ago

Hi Alex,

Thank you for investigating this. Adding Shahaf, who implemented it. Shahaf, can you please explain how we use redoc in our site?

-ilan

On Thu, Apr 14, 2022 at 5:22 PM AlexVarchuk @.***> wrote:

Hi @IlanAvigdor-af https://github.com/IlanAvigdor-af, thank you for the issue. I tried to reproduce it but had no success. I use link https://github.com/OAI/OpenAPI-Specification/blob/main/examples/v3.0/callback-example.yaml which you included in the issue. Can you provide more details on how you use redoc on your site?

Thanks.

— Reply to this email directly, view it on GitHub https://github.com/Redocly/redoc/issues/1961#issuecomment-1099238565, or unsubscribe https://github.com/notifications/unsubscribe-auth/AVWMAQ76XQXD4G3PX7MLT4TVFASYLANCNFSM5TNQDGGQ . You are receiving this because you were mentioned.Message ID: @.***>

shahafs-af commented 2 years ago

Hi Alex,

I'm using it via this vue-redoc-wrapper https://github.com/hnluu8/vue-redoc-wrapper

Installed npm "redoc": "^2.0.0-rc.66" in node.js with vue web application.

Is there a way to see which redoc version is actually used in the redoc UI?

Thanks, Shahaf

AlexVarchuk commented 2 years ago

@shahafs-af Hi! Thank you for the details. You can check the version of redoc in your node_modules/redoc. Callback support added in redoc in 2.0.0-rc.27 version.

Please check your version of redoc and let me know. Also, you can lint your definition using openapi-cli, to make sure your definition is valid.

npx @redocly/openapi-cli lint path-to-root-file.yaml
shahafs-af commented 2 years ago

Hi Alex, redoc version is 2.0.0-rc.66 After running the command you specified above, there were some errors and warning , which I fixed until eventually there were no errors or warning per the updated file.

I've also tested it after installing and using openapi cli with the command openapi preview-docs openapi.json and the callbacks do appear correctly viewing it locally at http://127.0.0.1:8080/#operation/post-v2-content-image which callbacks section appear just below.

It seems like the section is not even created per the html div. Please see two screen captures. One from the openapi cli command local webpage and the other from the Vue web application I'm hosting

Screen Shot 2022-04-16 at 19 47 35 Screen Shot 2022-04-16 at 19 46 11

What else can I check?

Thank you, Shahaf

AlexVarchuk commented 2 years ago

Hi @shahafs-af. Seems the problem is in vue-redoc-wrapper. Can you try to use redoc-standalone in your project without vue-redoc-wrapper? Here is example of that

Screenshot 2022-04-18 at 11 35 20

.

shahafs-af commented 2 years ago

Hey @AlexVarchuk, I've tried the above and it caused an error in Vue. This is becasue Vue (or any other frontend framework) is not working very well when there is another script or framework which manipulate the html elements as suggested , is there support for Vue?

We might need to use to a different documentation framework if we cannot have some compatibility, would appreciate your help on this,

Thanks, Shahaf

AlexVarchuk commented 2 years ago

Hi @shahafs-af. The additional installing the latest version of redoc doesn't help you. It should be fixed in the vue-redoc-wrapper. That lib uses the old version of redoc (2.0.0-rc.18) in devDependencies. You should open an issue on that lib or fork it(vue-redoc-wrapper) and fix it problem.

AlexVarchuk commented 2 years ago

Hi @shahafs-af. If you have more questions feel free to reopen this issue.