Repository navigation
Conversation
…on-for-redoc' of https://github.com/Adthena/adthena-redoc into feature-FBI-451-implement-xml-response-example-generation-for-redoc
…onse-example-generation-for-redoc FBI-451: Implement XML example code generation for Redoc
…-sample-generation-for-redoc FBI-459: Implement CSV code sample generation for redoc
|
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?) |
|
@lornajane |
|
Oh, I'm experiencing the same issue. @lornajane, any updates? |
|
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? |
| * **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. |
There was a problem hiding this comment.
I wonder why this is needed? Can we not determine this from the content type? (application/json, vs application/xml, vs text/csv)?
There was a problem hiding this comment.
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).
|
@rishitank Thank you for the contribution! 🙏 |
For text/csv (and application/csv, +csv, x-csv, comma-separated-values) media types, PayloadDisplay now renders a flat record, or an array of flat records, as CSV: a header row plus RFC 4180-quoted rows. Payloads that are not tabular keep the previous rendering. String CSV examples are shown as plain text instead of C-like highlighting. Re-contributes the CSV half of Redocly#2347 for v3. The format is derived from the media type, so the codeSamplesLanguages option is no longer needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01117LuacuBxMJUn1wJkfdyL
|
Thanks @AlexVarchuk! I can't reopen this one, because its branch lived in a fork I no longer have access to. So I've opened a new PR rebased onto v3 v3 already generates XML examples, so #2869 covers only the CSV half. It works the format out from the content type rather than adding the |
* feat: render CSV request and response examples For text/csv (and application/csv, +csv, x-csv, comma-separated-values) media types, PayloadDisplay now renders a flat record, or an array of flat records, as CSV: a header row plus RFC 4180-quoted rows. Payloads that are not tabular keep the previous rendering. String CSV examples are shown as plain text instead of C-like highlighting. Re-contributes the CSV half of #2347 for v3. The format is derived from the media type, so the codeSamplesLanguages option is no longer needed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01117LuacuBxMJUn1wJkfdyL * feat: wire CSV rendering into PayloadDisplay and add tests Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01117LuacuBxMJUn1wJkfdyL * feat: render CSV payloads in PayloadDisplay Completes the previous commit, which only added the CSV unit tests: PayloadDisplay now uses jsonToCsv for CSV media types, with tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01117LuacuBxMJUn1wJkfdyL * fix: show CSV examples untruncated; correct the changeset Generated CSV tables are no longer cut at MAX_DISPLAYED_STRING_LENGTH, matching the XML and form-urlencoded views. The changeset no longer claims string CSV examples changed: clike already rendered as plain text. Documents LF row separators and the absence of formula-injection escaping, and tests an own __proto__ key. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01117LuacuBxMJUn1wJkfdyL --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Redocly/redoc#2347 (2023) was closed when Redoc v3 shipped. Its CSV half was re-raised against v3 as Redocly/redoc#2869 and merged on 15 Oct 2026; the XML half became fixes to openapi-sampler, Redocly/openapi-sampler#223, still in review. Same wording as the portfolio's open-source card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01117LuacuBxMJUn1wJkfdyL
…es await review (#2) The Redoc line still described the 2023 PR (Redocly/redoc#2347) as open. It now says the examples were first proposed in 2023 and later requested by other developers, CSV is merged into v3 for the next release (Redocly/redoc#2869, merged 15 Oct 2026, after redoc@3.0.1), and the XML fixes to openapi-sampler await review (Redocly/openapi-sampler#223). Reviewed by CodeRabbit (approved 564170d) and an independent Claude fact-check of every claim. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01117LuacuBxMJUn1wJkfdyL
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.
Reference
Testing
Screenshots (optional)
Check yourself