Skip to content

fix: generate correct examples for different request content types #1283#1284

Merged
sserrata merged 1 commit intomainfrom
fix/1283-multiple-content-types
Jan 26, 2026
Merged

fix: generate correct examples for different request content types #1283#1284
sserrata merged 1 commit intomainfrom
fix/1283-multiple-content-types

Conversation

@sserrata
Copy link
Member

Code examples were showing incorrect request body parameters when switching between content types (e.g., JSON vs XML). This occurred because a single example was generated at build time and reused for all content types.

Changes:

  • Dynamically generate request examples based on the current content type's schema
  • Update body in Redux state when content type changes
  • Add lazy loading to MimeTabs in RequestSchema to prevent rendering all schemas
  • Force LiveApp components to remount when content type changes using key prop
  • Add test case with different schemas for JSON and XML content types

Fixes #1283

@sserrata sserrata self-assigned this Jan 23, 2026
@sserrata sserrata added the bug Something isn't working label Jan 23, 2026
…1283)

Code examples were showing incorrect request body parameters when switching
between content types (e.g., JSON vs XML). This occurred because a single
example was generated at build time and reused for all content types.

Changes:
- Dynamically generate request examples based on the current content type's schema
- Update body in Redux state when content type changes
- Add lazy loading to MimeTabs in RequestSchema to prevent rendering all schemas
- Force LiveApp components to remount when content type changes using key prop
- Add test case with different schemas for JSON and XML content types

Fixes #1283
@sserrata sserrata force-pushed the fix/1283-multiple-content-types branch from b21eca2 to 50cdc40 Compare January 23, 2026 17:21
@github-actions
Copy link

Size Change: +1.55 kB (+0.07%)

Total Size: 2.17 MB

Filename Size Change
demo/.docusaurus/globalData.json 60.7 kB +215 B (+0.36%)
demo/.docusaurus/registry.js 87.9 kB +308 B (+0.35%)
demo/.docusaurus/routes.js 83.1 kB +281 B (+0.34%)
demo/.docusaurus/routesChunkNames.json 34.4 kB +121 B (+0.35%)
demo/build/assets/js/main.********.js 644 kB +573 B (+0.09%)
demo/build/assets/js/runtime~main.********.js 21 kB +50 B (+0.24%)
ℹ️ View Unchanged
Filename Size
demo/.docusaurus/codeTranslations.json 2 B
demo/.docusaurus/docusaurus.config.mjs 14.7 kB
demo/.docusaurus/i18n.json 372 B
demo/.docusaurus/site-metadata.json 1.51 kB
demo/build/assets/css/styles.********.css 163 kB
demo/build/index.html 96.8 kB
demo/build/petstore/add-pet/index.html 29.3 kB
demo/build/petstore/create-user/index.html 24 kB
demo/build/petstore/create-users-with-array-input/index.html 24.1 kB
demo/build/petstore/create-users-with-list-input/index.html 24.1 kB
demo/build/petstore/delete-order/index.html 23.8 kB
demo/build/petstore/delete-pet/index.html 24.1 kB
demo/build/petstore/delete-user/index.html 24.3 kB
demo/build/petstore/find-pets-by-status/index.html 24.8 kB
demo/build/petstore/find-pets-by-tags/index.html 25.4 kB
demo/build/petstore/get-inventory/index.html 23.1 kB
demo/build/petstore/get-order-by-id/index.html 24.1 kB
demo/build/petstore/get-pet-by-id/index.html 24.9 kB
demo/build/petstore/get-user-by-name/index.html 24.4 kB
demo/build/petstore/login-user/index.html 24.9 kB
demo/build/petstore/logout-user/index.html 23.7 kB
demo/build/petstore/new-pet/index.html 24.3 kB
demo/build/petstore/pet/index.html 22.5 kB
demo/build/petstore/place-order/index.html 23.3 kB
demo/build/petstore/schemas/apiresponse/index.html 24.6 kB
demo/build/petstore/schemas/cat/index.html 38.8 kB
demo/build/petstore/schemas/category/index.html 25.7 kB
demo/build/petstore/schemas/dog/index.html 39 kB
demo/build/petstore/schemas/honeybee/index.html 39.1 kB
demo/build/petstore/schemas/id/index.html 22.7 kB
demo/build/petstore/schemas/order/index.html 26.8 kB
demo/build/petstore/schemas/pet/index.html 38.6 kB
demo/build/petstore/schemas/tag/index.html 24.1 kB
demo/build/petstore/schemas/user/index.html 46.4 kB
demo/build/petstore/store/index.html 21.5 kB
demo/build/petstore/subscribe-to-the-store-events/index.html 30.2 kB
demo/build/petstore/swagger-petstore-yaml/index.html 30.2 kB
demo/build/petstore/update-pet-with-form/index.html 24.3 kB
demo/build/petstore/update-pet/index.html 24.7 kB
demo/build/petstore/update-user/index.html 24.3 kB
demo/build/petstore/upload-file/index.html 24.1 kB
demo/build/petstore/user/index.html 22.2 kB

compressed-size-action

@github-actions
Copy link

Visit the preview URL for this PR (updated for commit 50cdc40):

https://docusaurus-openapi-36b86--pr1284-8wroggg7.web.app

(expires Sun, 22 Feb 2026 17:25:47 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata sserrata merged commit 47258df into main Jan 26, 2026
10 checks passed
@sserrata sserrata deleted the fix/1283-multiple-content-types branch January 26, 2026 15:56
sserrata added a commit that referenced this pull request Jan 27, 2026
Major performance improvement: The new `externalJsonProps` option (enabled by default) dramatically reduces build times and bundle sizes by externalizing large JSON props from MDX files.

- New `externalJsonProps` plugin option significantly improves build performance
- Sticky positioning for the API Explorer right panel improves UX on long API pages
- Dynamic request body updates when switching anyOf/oneOf tabs

#### 🚀 New Feature

- feat(plugin): add externalJsonProps option (enabled by default) to improve build performance (#1279)
- feat(theme): add sticky positioning to API Explorer right panel (#1288)
- feat: dynamically update request body when anyOf/oneOf tab changes (#1287)

#### 🐛 Bug Fix

- fix: render inline enum values in anyOf schemas (#1286)
- fix: generate correct examples for different request content types (#1284)

#### 🏠 Refactoring

- refactor: change plugin and theme types.ts to types.d.ts (#1281)
- refactor: externalize using create() and drop size threshold requirement (#1280)

#### 📝 Documentation

- docs: sync README and intro.mdx with plugin docs

#### 🤖 Dependencies

- chore(deps): bump lodash from 4.17.21 to 4.17.23 (#1282)

#### Committers: 3

- dependabot[bot]
- Ollie Monk
- Steven Serrata
@sserrata sserrata mentioned this pull request Jan 27, 2026
sserrata added a commit that referenced this pull request Jan 27, 2026
Major performance improvement: The new `externalJsonProps` option (enabled by default) dramatically reduces build times and bundle sizes by externalizing large JSON props from MDX files.

- New `externalJsonProps` plugin option significantly improves build performance
- Sticky positioning for the API Explorer right panel improves UX on long API pages
- Dynamic request body updates when switching anyOf/oneOf tabs

#### 🚀 New Feature

- feat(plugin): add externalJsonProps option (enabled by default) to improve build performance (#1279)
- feat(theme): add sticky positioning to API Explorer right panel (#1288)
- feat: dynamically update request body when anyOf/oneOf tab changes (#1287)

#### 🐛 Bug Fix

- fix: render inline enum values in anyOf schemas (#1286)
- fix: generate correct examples for different request content types (#1284)

#### 🏠 Refactoring

- refactor: change plugin and theme types.ts to types.d.ts (#1281)
- refactor: externalize using create() and drop size threshold requirement (#1280)

#### 📝 Documentation

- docs: sync README and intro.mdx with plugin docs

#### 🤖 Dependencies

- chore(deps): bump lodash from 4.17.21 to 4.17.23 (#1282)

#### Committers: 3

- dependabot[bot]
- Ollie Monk
- Steven Serrata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Incorrect code example for requests supporting several content types

1 participant