Conversation
…and callbacks RequestSchema was rendering only the schema tree via SchemaNode, with no example tabs — unlike ResponseSchema which wraps everything in SchemaTabs and adds ExampleFromSchema, ResponseExample, and ResponseExamples tabs. This meant: - Callback request bodies whose schemas had top-level `example` or `examples` showed no sample values in the Callbacks section - Regular request bodies with schema/MediaTypeObject-level examples also lacked the Example tab in the docs view Fix: mirror ResponseSchema's SchemaTabs + ExampleFromSchema/ResponseExample/ ResponseExamples pattern inside RequestSchema for both the single-mime and multi-mime code paths. Demo specs added under demo/examples/tests/callbackExamples.yaml. Closes #1251 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Size Change: +7.73 kB (+0.35%) Total Size: 2.23 MB
ℹ️ View Unchanged
|
|
Visit the preview URL for this PR (updated for commit 25fc6cf): https://docusaurus-openapi-36b86--pr1370-we7e4nsv.web.app (expires Thu, 30 Apr 2026 00:01:02 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: bf293780ee827f578864d92193b8c2866acd459f |
Code ReviewOverall: Solid fix that closes a real gap. The approach — mirroring Observations1. Potential duplicate example tabs When a schema has a top-level
2. Reusing The components work correctly, but their names and the translation key ( 3. {firstBody &&
ExampleFromSchema({
schema: firstBody,
mimeType: mimeType,
})}
4. No automated test coverage The demo YAML is good for visual/manual verification, but there are no Jest/unit tests for the new rendering paths. If there's a pattern in the repo for component snapshot tests or similar, this would be a good candidate. Not a blocker if the project convention is manual QA only. 5. Single-mime fallback path const firstBody = mediaTypeObject?.schema ?? body.content![randomFirstKey];The fallback Summary
Good fix — the core change is sound and the test plan covers the main cases. The duplicate tab scenario is the only item I'd consider addressing before shipping if UX consistency matters here. |
…/examples present When a MediaTypeObject has an explicit `example` or `examples`, both ExampleFromSchema and ResponseExample/ResponseExamples would render — showing duplicate tabs with identical content since sampleResponseFromSchema picks up schema.example. Suppress ExampleFromSchema when an explicit media-level example is already provided. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
RequestSchemawas rendering only the schema tree with no example tabs, unlikeResponseSchemawhich wraps everything inSchemaTabsand addsExampleFromSchema,ResponseExample, andResponseExamplestabs.This caused two gaps:
exampleorexamples(including via$ref) showed nothing in the Callbacks sectionFix: mirror
ResponseSchema'sSchemaTabs+ExampleFromSchema/ResponseExample/ResponseExamplespattern insideRequestSchemafor both the single-mime and multi-mime code paths. Since callbacks render viacreateRequestBodyDetails→RequestSchema, this fixes both surfaces in one change.Test plan
example→ "Example" tab appears in the Callbacks sectionexample→ "Example" tab appearsexample→ "Example" tab appears (regression guard)examples(multiple) → tabbed examples appearexample/examplesdefined → no extra tab, schema renders as beforeDemo specs added under
demo/examples/tests/callbackExamples.yaml.Closes #1251
🤖 Generated with Claude Code