Skip to content
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

Response example generation for XML and CSV #2347

Open
wants to merge 16 commits into
base: main
Choose a base branch
from

Conversation

rishitank
Copy link

What/Why/How?

As part of implementing api-docs at Adthena, we had the need to auto-generate response examples for XML and CSV based on the OpenAPI schema provided.

  • This PR implements XML and CSV response example generation for Redoc if a response example is not provided.
  • The code for XML generation was adapted from RapiDoc's implementation and ported over to TypeScript.
  • The feature can be enabled via a redoc option.

Reference

Testing

Screenshots (optional)

Check yourself

  • Code is linted
  • Tested
  • All new/updated code is covered with tests

@lornajane
Copy link
Contributor

Thank you! It's quite a big pull request, so we're going to need some time to prioritise and review this, but thank you so much for this :)

(if anyone else tries it from the branch, let us know how you get on?)

@LeWolOnline
Copy link

@lornajane
Hello! Could you please provide an update on this PR? I'm experiencing the same issue it solves.
Thank you!

@LittleGM
Copy link

LittleGM commented Jun 7, 2024

Oh, I'm experiencing the same issue. @lornajane, any updates?

@kamukondiwa
Copy link

Hi @lornajane, is there any update on this? I can see that there are conflicts on this PR now, I wonder if you are implementing it yourselves?

@@ -251,6 +251,7 @@ You can use all of the following options with the standalone version of the <red
* **path-only**: displays a path in the sidebar navigation item.
* **id-only**: displays the operation id with a fallback to the path in the sidebar navigation item.
* `showWebhookVerb` - when set to `true`, shows the HTTP request method for webhooks in operations and in the sidebar.
* `codeSamplesLanguages` - enables code sample generation for the provided list of languages.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why this is needed? Can we not determine this from the content type? (application/json, vs application/xml, vs text/csv)?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is used to allow the user to control for which media types they want code examples to show up rather than showing all code examples for all media types supported (in case the user doesn't want code examples for certain media types to show up by default).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants