Skip to content

Fix nested anyOf/oneOf schema rendering with lazy tabs#1248

Merged
sserrata merged 2 commits intomainfrom
bug/fix-nested-oneof-anyof
Nov 17, 2025
Merged

Fix nested anyOf/oneOf schema rendering with lazy tabs#1248
sserrata merged 2 commits intomainfrom
bug/fix-nested-oneof-anyof

Conversation

@sserrata
Copy link
Member

  • Add lazy rendering to SchemaTabs to ensure only selected tab content is rendered
  • Generate unique IDs for each anyOf/oneOf tab group to prevent value collisions
  • Add fallback labels for schemas without title or type
  • Support implicit object types (schemas with properties but no explicit type: object)
  • Add proper spacing (1rem) between badges and tabs, and after tab containers

Fixes rendering issues where:

  • All tab contents were visible simultaneously regardless of selection
  • Nested oneOf schemas weren't displaying correctly
  • Tab selection wasn't properly isolated
  • Visual spacing was missing between badges and tabs

Description

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate)

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

…cing

- Add lazy rendering to SchemaTabs to ensure only selected tab content is rendered
- Generate unique IDs for each anyOf/oneOf tab group to prevent value collisions
- Add fallback labels for schemas without title or type
- Support implicit object types (schemas with properties but no explicit type: object)
- Add proper spacing (1rem) between badges and tabs, and after tab containers

Fixes rendering issues where:
- All tab contents were visible simultaneously regardless of selection
- Nested oneOf schemas weren't displaying correctly
- Tab selection wasn't properly isolated
- Visual spacing was missing between badges and tabs
@sserrata sserrata self-assigned this Nov 17, 2025
@sserrata sserrata added the bug Something isn't working label Nov 17, 2025
@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Size Change: +1.18 kB (+0.05%)

Total Size: 2.14 MB

Filename Size Change
demo/.docusaurus/globalData.json 55.9 kB +233 B (+0.42%)
demo/.docusaurus/registry.js 81 kB +335 B (+0.42%)
demo/.docusaurus/routes.js 76.7 kB +299 B (+0.39%)
demo/.docusaurus/routesChunkNames.json 31.7 kB +130 B (+0.41%)
demo/build/assets/js/main.********.js 714 kB +627 B (+0.09%)
demo/build/assets/js/runtime~main.********.js 20 kB +50 B (+0.25%)
demo/build/petstore/schemas/user/index.html 44.8 kB -523 B (-1.15%)
ℹ️ View Unchanged
Filename Size Change
demo/.docusaurus/codeTranslations.json 2 B 0 B
demo/.docusaurus/docusaurus.config.mjs 14.6 kB 0 B
demo/.docusaurus/i18n.json 267 B 0 B
demo/.docusaurus/site-metadata.json 1.51 kB 0 B
demo/build/assets/css/styles.********.css 145 kB 0 B
demo/build/index.html 84.4 kB 0 B
demo/build/petstore/add-pet/index.html 27.8 kB 0 B
demo/build/petstore/create-user/index.html 22.5 kB 0 B
demo/build/petstore/create-users-with-array-input/index.html 22.6 kB 0 B
demo/build/petstore/create-users-with-list-input/index.html 22.6 kB 0 B
demo/build/petstore/delete-order/index.html 22.5 kB 0 B
demo/build/petstore/delete-pet/index.html 22.6 kB 0 B
demo/build/petstore/delete-user/index.html 22.8 kB 0 B
demo/build/petstore/find-pets-by-status/index.html 23.2 kB 0 B
demo/build/petstore/find-pets-by-tags/index.html 23.9 kB 0 B
demo/build/petstore/get-inventory/index.html 21.8 kB 0 B
demo/build/petstore/get-order-by-id/index.html 22.8 kB 0 B
demo/build/petstore/get-pet-by-id/index.html 23.3 kB 0 B
demo/build/petstore/get-user-by-name/index.html 22.9 kB 0 B
demo/build/petstore/login-user/index.html 23.4 kB 0 B
demo/build/petstore/logout-user/index.html 22.2 kB 0 B
demo/build/petstore/new-pet/index.html 22.7 kB 0 B
demo/build/petstore/pet/index.html 21 kB 0 B
demo/build/petstore/place-order/index.html 22 kB 0 B
demo/build/petstore/schemas/apiresponse/index.html 23.3 kB 0 B
demo/build/petstore/schemas/cat/index.html 37.2 kB 0 B
demo/build/petstore/schemas/category/index.html 24.3 kB 0 B
demo/build/petstore/schemas/dog/index.html 37.6 kB 0 B
demo/build/petstore/schemas/honeybee/index.html 37.7 kB 0 B
demo/build/petstore/schemas/id/index.html 21.4 kB 0 B
demo/build/petstore/schemas/order/index.html 25.5 kB 0 B
demo/build/petstore/schemas/pet/index.html 37.1 kB 0 B
demo/build/petstore/schemas/tag/index.html 22.7 kB 0 B
demo/build/petstore/store/index.html 20.2 kB 0 B
demo/build/petstore/subscribe-to-the-store-events/index.html 28.8 kB 0 B
demo/build/petstore/swagger-petstore-yaml/index.html 29 kB +25 B (+0.09%)
demo/build/petstore/update-pet-with-form/index.html 22.7 kB 0 B
demo/build/petstore/update-pet/index.html 23.1 kB 0 B
demo/build/petstore/update-user/index.html 22.8 kB 0 B
demo/build/petstore/upload-file/index.html 22.6 kB 0 B
demo/build/petstore/user/index.html 20.7 kB 0 B

compressed-size-action

@github-actions
Copy link

github-actions bot commented Nov 17, 2025

Visit the preview URL for this PR (updated for commit 15526be):

https://docusaurus-openapi-36b86--pr1248-ee56d94p.web.app

(expires Wed, 17 Dec 2025 17:18:07 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

Adds /anyof-nested-oneof-with-properties test operation that demonstrates:
- anyOf containing multiple oneOf arrays
- oneOf schemas with properties but no explicit type: object
- Schema with both oneOf and properties at the same level (layer3)
- Complex nesting similar to ethernet-interfaces schema

This test case validates the fixes for lazy tab rendering, unique tab IDs,
and proper handling of implicit object types.
@sserrata sserrata merged commit 583f646 into main Nov 17, 2025
10 checks passed
@sserrata sserrata deleted the bug/fix-nested-oneof-anyof branch November 17, 2025 17:45
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.

1 participant