Skip to content

feat(json-schema-unified): add OAS 3.0 and 2.0 dialects - #11136

Merged
glowcloud merged 11 commits into
feat/json-schema-unifiedfrom
feat/json-schema-unified-oas2-oas3
Nov 23, 2026
Merged

glowcloud merged 11 commits into
feat/json-schema-unifiedfrom
feat/json-schema-unified-oas2-oas3

Conversation

@robert-hebel-sb

@robert-hebel-sb robert-hebel-sb commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Stack 3/3, based on #11135 (unified view for 3.1/3.2) ← #11134 (Tailwind build) ← #11133 (spec graph).

Description

This PR extends the opt-in unified JSON Schema view (unifiedJSONSchemaEnabled) to OpenAPI 2.0 and 3.0. With the option on, every OpenAPI version now renders its Schemas/Models section and Schema tab through json-schema-unified. With it off, nothing changes.

  • Two new dialects, oas30 and swagger2, each with its own keyword list. Every keyword keeps the meaning it has in that version:
    • Boolean exclusiveMaximum/exclusiveMinimum combined with maximum/minimum read as < 10, > 0, (1, 10].
    • 3.0 nullable: true reads as T | null. 3.0 keeps oneOf/anyOf/not, writeOnly, deprecated and the object discriminator.
    • 2.0 has a string discriminator, allOf as its only combiner, and type: file.
    • Keywords outside the version (e.g. const, $defs) are treated like any unknown keyword: shown only with showExtensions. json-schema-5 showed them as plain rows; this change was confirmed.
    • writeOnly still hides properties from 2.0 response schemas, as json-schema-5 does (confirmed), but it isn't rendered as a 2.0 keyword.
  • Nested schema names (2.0/3.0 only): a property or items shows the nested schema's name, its title or else its reference name (category Category), as json-schema-5 does.
  • Reference path (2.0/3.0 only): an expanded nested schema shows its reference path, e.g. #/definitions/Category.
  • Recursive models stay expandable. swagger-client's 2.0/3.0 strategies leave cyclic $refs in place. The plugin looks the definition up by local name (resolved subtree first, else raw JSON, like findDefinition) only when the schema renders, so recursion goes only as deep as the user expands. "Expand all" stops at a reference already resolved higher up the same branch.
  • Models section per version: 2.0 uses definitions with the heading "Models"; 3.0 uses components/schemas with "Schemas". The layout, scroll and lazy-resolve keys are identical to json-schema-5's, so deep links and expansion state behave the same.
  • Parity and browsers:
    • The unified-json-schema Playwright project now covers all four versions (103 tests). Its guard also recognises the json-schema-5 DOM as classic.
    • A new webkit-unified project runs the plugin's own specs in WebKit, for the Tailwind v4 browser floor (Safari 16.4).
    • nodejs.yml and release-swagger-ui.yml now install chromium webkit, and the browser cache key includes WebKit. Still 4 shards.
  • Docs and specs:
    • The all-versions wording that feat(json-schema-unified): add opt-in schema view for OAS 3.1/3.2 #11135 limited to 3.1/3.2 is restored: configuration.md, React README, architecture, json-schema.
    • The json-schema-unified spec gets a 2.0/3.0 dialects section.
    • The goal gets the opt-in capability.
    • The oas-versions spec records a known limitation: the oas31/oas32 Model/Models wrappers cache their instance on a static field keyed by location.pathname. This is inferred from the code and not yet reproduced; it will be fixed separately.
    • CLAUDE.md lists the Playwright projects.

Motivation and Context

This completes "one schema UI for every OpenAPI version" behind the opt-in flag, which is the path to retiring json-schema-5's model views. Example values, parameter input widgets and the 2.0 scheme picker remain out of scope. With the option on, the Schema tab can therefore disagree with Example Value for 2.0/3.0; this is recorded as a known limitation in the module spec.

Points to review closely:

  • the lazy $ref resolution (legacy.ts#getLazyRef, hooks.ts);
  • the CI workflow changes, which add WebKit installs and so make CI slower.

How Has This Been Tested?

The tree of this PR is identical to the fully verified final tree.

  • Unit: npm run test:unit → 1066 passed, 12 skipped. This includes 157 plugin tests, covering per-dialect keyword lists, the text of exclusive bounds, nullable, 2.0 discriminator and type: file, nested names with pointer decoding, the reference path for 2.0/3.0 only, 3.1 naming unchanged, recursive models, and readOnly/writeOnly for 2.0/3.0.
  • e2e, chromium: npx playwright test --project=chromium → 705 passed, 4 skipped. This includes new 2.0/3.0 plugin specs: Models vs Schemas heading, nested name and reference path, exclusive bounds, nullable, discriminator, a recursive model expanded two levels, the Schema tab, and readOnly/writeOnly request→response.
  • e2e parity: npx playwright test --project=unified-json-schema → 103 passed. It re-runs existing schema specs for 2.0, 3.0, 3.1 and 3.2 with the option on.
    • Eight assertions were adapted to intended differences, each in the unified branch only:
      • nullable shows as object | null;
      • deprecated is a chip, and in 2.0 it's hidden as a non-2.0 field;
      • the external-docs layout;
      • oas3-extension opens its extension blocks first;
      • the example value text;
      • one 2.0 nested-state test expands tags instead of id;
      • editor-1868 became stricter.
    • No assertion was weakened.
    • The guard fails when the option is forced to =false.
  • e2e, WebKit: npx playwright test --project=webkit-unified → 52 passed.
  • Build and static checks: npm run build + npm run test:artifact → 8 passed. lint-errors, tsc, e2e:typecheck are clean. check-plugin-conventions → 0 errors.
  • Visual check: screenshots of the 2.0/3.0 Models section and Schema tab, option off vs on, light and dark, were reviewed for differences in what information is shown.

Screenshots (if appropriate):

All captures use this PR's build and the e2e fixtures under test/e2e-playwright/static/documents/features/json-schema-unified/. Before is the classic json-schema-5 view (option off, same as the base); after is unifiedJSONSchemaEnabled=true. Each capture checks that window.ui.getConfigs().unifiedJSONSchemaEnabled really had the expected value.

OpenAPI 2.0 Models section (Pet expanded)

Before (classic) After (unified)
2.0 models before 2.0 models after

After, the view shows constraint chips ([0, 30], > 0, (1, 10]), the read-only marker, the nested schema name (category Category), the 2.0 string discriminator, XML and external docs.

OpenAPI 3.0 Schemas section (Pet expanded)

Before (classic) After (unified)
3.0 schemas before 3.0 schemas after

OpenAPI 3.0 Schema tab (request body of createUser)

Before (classic) After (unified)
3.0 schema tab before 3.0 schema tab after

After, the tab shows the reference path #/components/schemas/User and the write-only marker; the readOnly id is hidden in the request schema.

Dark mode (2.0, unified)

2.0 models after, dark

Checklist

My PR contains...

  • No code changes (src/ is unmodified: changes to documentation, CI, metadata, etc.)
  • Dependency changes (any modification to dependencies in package.json)
  • Bug fixes (non-breaking change which fixes an issue)
  • Improvements (misc. changes to existing features)
  • Features (non-breaking change which adds functionality)

My changes...

  • are breaking changes to a public API (config options, System API, major UI change, etc).
  • are breaking changes to a private API (Redux, component props, utility functions, etc.).
  • are breaking changes to a developer API (npm script behavior changes, new dev system dependencies, etc).
  • are not breaking changes.

Documentation

  • My changes do not require a change to the project documentation.
  • My changes require a change to the project documentation.
  • If yes to above: I have updated the documentation accordingly.

Automated tests

  • My changes can not or do not need to be tested.
  • My changes can and should be tested by unit and/or integration tests.
  • If yes to above: I have added tests to cover my changes.
  • If yes to above: I have taken care to cover edge cases in my tests.
  • All new and existing tests passed.

@glowcloud glowcloud left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Three notes on the 2.0/3.0 dialect code.

getOASDialectOverrides(dialect, {
...dialectOptions,
// read at render time, from the current state
findSchema: (name) =>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Lazy-ref lookup could use the spec selectors. findSchemaDefinition re-implements the lookup that specSelectors.findDefinition (2.0) and specSelectors.findSchema (3.x, via the oas3 wrapper) already do: resolved subtree first, else the raw JSON. I compared them side by side on the same Immutable state (resolved + raw, raw only, neither, empty-Map resolved, null resolved) and the results are identical. They differ only for non-Map values (a string or boolean raw schema): the selector returns them and ours returns null, but getLazyRef's isPlainObject guard rejects them anyway, so rendering doesn't change.

Suggestion: toPlainSchema(specSelectors.findDefinition(name)). toPlainSchema keeps the plain-object conversion, so findSchemaDefinition can go. getDocumentUrl already reads the url selector, so nothing changes there. A test through getUnifiedView against the real selectors would cover the swap, since today's unit test stubs them.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Correction to the comment above: specSelectors.findDefinition isn't a safe replacement for findSchemaDefinition in 2.0, so the lookup stays as it is. With the oas3 plugin loaded (the apis preset always loads it), findDefinition("Node") returns null for a 2.0 document, even though the definition is in the spec. onlyOAS3 (oas3/spec-extensions/wrap-selectors.js) falls back with ori(...args), but args still starts with the state while ori is already bound to it. The original selector therefore receives the state as the schema name. 3.0 works, since it goes through findSchema. My earlier comparison ran the raw selector functions, not the wrapped selectors of a System, so it missed this.

The old renderer has the same problem: with the oas3 plugin loaded, json-schema-5's Model renders a left-in-place $ref in a 2.0 document without its definition: as the raw $ref text, or as an empty expandable object when $$ref is also set (3.0 expands it). findDefinition is the only selector affected: I compared the other onlyOAS3-wrapped spec and auth selectors on a 2.0 document, with and without the plugin, and they return the same values.

This could be fixed in core by dropping the extra state argument in the fallback (ori(...args.slice(1))). That would also make the old renderer expand these refs in 2.0, so it belongs in a separate PR, and the unified lookup could then use findDefinition.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would keep it in follow-ups though to have this bug documented

? plainSchema.$$ref
: undefined
)
const name = isLegacyDialect(dialect)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ref-derived names for the Schema tab's schema differ between dialects. For a schema that comes from a ref like #/components/schemas/User/properties/foo (or #/definitions/User/properties/foo in 2.0):

  • 3.1/3.2 title (getModelName here): User/properties/foo, the remainder after the schemas prefix.
  • 2.0/3.0 title (legacy.ts#getRefSchemaName, via fn.getTitle): foo, the last pointer token.
  • json-schema-5 and oas31 both return the remainder, and nothing for refs that don't point under #/definitions/ or #/components/schemas/. 2.0/3.0 currently names those as well, for example #/components/parameters/X becomes X.

Proposal: fix this in getRefSchemaName only. For 2.0/3.0 it should return the remainder after #/definitions/ (2.0) or #/components/schemas/ (3.0), and nothing for other refs. That aligns it with the 3.1/3.2 title and with the old renderers. The old renderer and the 3.1/3.2 helper stay untouched, and the two copies stay separate. Does that rule sound right, or should deeper pointers show something else, for example only the last token?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

good idea; the UI between 2.0 and 3.0 should be as similar as possible

@glowcloud
glowcloud force-pushed the feat/json-schema-unified-oas2-oas3 branch from c6bda5b to ffa4abb Compare November 17, 2026 08:46
@glowcloud
glowcloud force-pushed the feat/json-schema-unified-oas2-oas3 branch from ffa4abb to 95ee05d Compare November 17, 2026 09:09
@glowcloud
glowcloud force-pushed the feat/json-schema-unified-oas2-oas3 branch from 95ee05d to 34acc10 Compare November 17, 2026 09:39
name={name}
onExpand={handleExpand}
titleAddon={JumpToPath ? <JumpToPath path={specPath} /> : null}
jumpToPath={JumpToPath ? <JumpToPath path={specPath} /> : null}

@glowcloud glowcloud Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nested $ref schemas get no JumpToPath in the unified view. Here the button is placed once per Schemas-section panel (top right). json-schema-5 (2.0/3.0) also renders it for nested schemas: in object-model.jsx, every nested object that is a $ref gets a JumpToPath (.model-jump-to-path), next to the collapsed {…} and after the open brace. It passes the nested spec path (properties,key, additionalProperties, allOf,i, anyOf,i, oneOf,i, not). The root of the Schema tab gets one too when it is a $ref. With unifiedJSONSchemaEnabled on, those buttons disappear for 2.0/3.0 documents. The 3.1/3.2 renderers never called JumpToPath, not even per panel.

Proposal: show it for every nested schema that came from a $ref ($$ref), in all four dialects, with that schema's spec path, at the end of its title row next to the reference path. For 3.1/3.2 that adds buttons that were never rendered there before. JumpToPath is an empty extension point in core, so nothing changes unless a plugin provides it. It also needs the 3.1/3.2 keywords (prefixItems, patternProperties, $defs, …) mapped to spec paths.

Alternative: 2.0/3.0 now, which is parity, and 3.1/3.2 later together with the nested ref names (FOLLOW-UPS 14).

Should we handle JumpToPath for nested references?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this something I was thinking about as well 😅 (src/core/plugins/json-schema-unified/SPEC.md:123-124)

tbh I have no data for this feature being valuable as we haven't got any requests for adding jump to button for OAS 3.1/OAS 3.2 schemas therefore I've decided to not include this feature in unified view

we could have it in follow-ups to have a trace of this decision

.claude/skills/FOLLOW-UPS.md)

17. **Optional, only on client request: the unified schema view has no `JumpToPath` on nested `$ref`
    schemas.** Only each Schemas-section panel carries it (`json-schema-unified/components/Models/SchemaItem.tsx`).
    json-schema-5 also puts it on every nested `$ref` object (`json-schema-5/components/object-model.jsx`),
    with the usage-site spec path (`properties,<key>`, `additionalProperties`, `allOf,<i>`, ...); the
    3.1/3.2 renderers never had it. Core `JumpToPath` renders nothing, so only plugins that override
    it notice (SwaggerEditor jumps to the line). No community request so far (swagger-ui #9380 is
    maintainer-filed). If a client asks:
    - A plugin can already add it without changes here: wrap `JSONSchemaUnified` and pass its
      `jumpToPath` prop for a schema with a local `$$ref`/`$ref`, pointing at the referenced
      definition. Document that prop as an extension point first.
    - The usage-site path needs per-keyword spec-path tracking in the unified renderer (it only tracks
      an expansion path), shared by all four dialects, plus 3.1/3.2 keywords (`prefixItems`,
      `patternProperties`, `$defs`, ...).
    - The `jumpToPath` slot is styled for the panel's top-right corner; nested schemas may need a
      title-row slot.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

added to follow ups 👍

@glowcloud
glowcloud force-pushed the feat/json-schema-unified-oas2-oas3 branch from 34acc10 to b9a1bb7 Compare November 17, 2026 11:20
@glowcloud
glowcloud force-pushed the feat/json-schema-unified-oas2-oas3 branch from b9a1bb7 to 80b6a54 Compare November 17, 2026 12:19
@glowcloud
glowcloud marked this pull request as ready for review November 18, 2026 07:41
@glowcloud
glowcloud requested a review from cka121 November 18, 2026 07:41
@robert-hebel-sb
robert-hebel-sb requested a max review from Copilot November 18, 2026 10:45

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

External references can incorrectly resolve to unrelated local schemas, and referenced properties can bypass annotation filtering, leaving read-only properties in requests and write-only properties in responses.

6 open issues
What changed in this PR

Completes the opt-in unified schema view across supported OpenAPI versions by adding 2.0 and 3.0 dialects. Classic rendering remains the default.

Changes:

  • Add version-specific keyword handling, schema names, reference tooltips, and recursive-model expansion.
  • Extend unit and cross-version parity coverage, plus WebKit testing and CI browser installation.
  • Update configuration docs, architecture records, and known limitations.
File Description
test/​unit/​core/​plugins/​json-schema-unified/​model-views.test.tsx Covers legacy gating, naming, layout, and jump controls.
test/​unit/​core/​plugins/​json-schema-unified/​legacy-dialects.test.tsx Tests legacy keywords, constraints, filtering, and recursion.
test/​unit/​core/​plugins/​json-schema-unified/​keywords.test.tsx Adds explicit element typing.
test/​e2e-playwright/​support/​fixtures.ts Adds legacy-view helpers and broadens parity guards.
test/​e2e-playwright/​static/​documents/​features/​json-schema-unified/​keywords.swagger2.yaml Adds Swagger 2.0 keyword fixtures.
test/​e2e-playwright/​static/​documents/​features/​json-schema-unified/​keywords.openapi30.yaml Adds OpenAPI 3.0 keyword fixtures.
test/​e2e-playwright/​features/​spec-parse-to-json.spec.ts Adapts example assertions for both renderers.
test/​e2e-playwright/​features/​plugins/​oas3/​request-body-complex-schema-properties.spec.ts Uses shared schema locators.
test/​e2e-playwright/​features/​plugins/​oas3/​complex-spec.spec.ts Adapts nested-reference and virtualization checks.
test/​e2e-playwright/​features/​plugins/​oas3/​all-of-circular-ref.spec.ts Adapts circular-composition checks.
test/​e2e-playwright/​features/​plugins/​json-schema-unified/​legacy-dialects.spec.ts Adds legacy dialect browser coverage.
test/​e2e-playwright/​features/​plugins/​json-schema-unified/​classic-fallback.spec.ts Checks legacy rendering with the option off/on.
test/​e2e-playwright/​features/​parameter-schema.spec.ts Uses renderer-independent schema locators.
test/​e2e-playwright/​features/​oas3-extension.spec.ts Handles unified extension accordions.
test/​e2e-playwright/​features/​models-virtualization.spec.ts Shares virtualization assertions across renderers.
test/​e2e-playwright/​features/​model-collapse.spec.ts Shares expansion checks across renderers.
test/​e2e-playwright/​features/​external-docs.spec.ts Adapts schema external-docs checks.
test/​e2e-playwright/​bugs/​swos-63.spec.ts Checks headings through shared locators.
test/​e2e-playwright/​bugs/​editor-1868.spec.ts Checks model updates in both views.
test/​e2e-playwright/​bugs/​6369.spec.ts Covers version-specific deprecated markers.
test/​e2e-playwright/​bugs/​6016.spec.ts Adapts model expansion checks.
test/​e2e-playwright/​bugs/​5660.spec.ts Checks unified nullable labels.
src/​core/​plugins/​oas3/​SPEC.md Documents the existing wrapper-cache limitation.
src/​core/​plugins/​json-schema-unified/​views.ts Supplies current definitions and document URLs.
src/​core/​plugins/​json-schema-unified/​versions.ts Enables 2.0 and 3.0 dialect detection.
src/​core/​plugins/​json-schema-unified/​types.ts Defines lazy-reference hooks and legacy configuration types.
src/​core/​plugins/​json-schema-unified/​styles.ts Adds tooltip and jump-control positioning.
src/​core/​plugins/​json-schema-unified/​SPEC.md Documents legacy dialect behavior and contracts.
src/​core/​plugins/​json-schema-unified/​schemas.ts Adds legacy schema paths, headings, and lookup.
src/​core/​plugins/​json-schema-unified/​registry.ts Registers legacy naming and reference components.
src/​core/​plugins/​json-schema-unified/​legacy.ts Implements legacy schema semantics and lazy references.
src/​core/​plugins/​json-schema-unified/​hooks.ts Adds lazy resolution and bounded deep expansion.
src/​core/​plugins/​json-schema-unified/​dialects.ts Configures legacy keyword and renderer overrides.
src/​core/​plugins/​json-schema-unified/​context.ts Tracks reference targets along expansion branches.
src/​core/​plugins/​json-schema-unified/​components/​Models/​SchemaItem.tsx Moves jump controls to panel corners.
src/​core/​plugins/​json-schema-unified/​components/​Models/​Models.tsx Selects version-specific section headings.
src/​core/​plugins/​json-schema-unified/​components/​Model/​Model.tsx Applies legacy schema naming rules.
src/​core/​plugins/​json-schema-unified/​components/​keywords/​Unsupported.tsx Suppresses unsupported keyword slots.
src/​core/​plugins/​json-schema-unified/​components/​keywords/​Title/​Title.tsx Adds a tooltip peer marker.
src/​core/​plugins/​json-schema-unified/​components/​keywords/​oas/​Swagger2Discriminator.tsx Renders string discriminators.
src/​core/​plugins/​json-schema-unified/​components/​keywords/​oas/​slots.tsx Adds the Swagger 2.0 discriminator slot.
src/​core/​plugins/​json-schema-unified/​components/​keywords/​oas/​SchemaName.tsx Displays supplementary nested schema names.
src/​core/​plugins/​json-schema-unified/​components/​keywords/​oas/​RefPath.tsx Renders legacy reference tooltips.
src/​core/​plugins/​json-schema-unified/​components/​keywords/​oas/​Examples.tsx Gates plural examples by dialect.
src/​core/​plugins/​json-schema-unified/​components/​JSONSchema/​JSONSchema.tsx Integrates lazy references, labels, and panel controls.
src/​core/​plugins/​json-schema-unified/​components/​Accordion/​Accordion.tsx Adds a tooltip-trigger peer marker.
src/​core/​plugins/​json-schema-document/​selectors.ts Exports the selector System interface.
src/​core/​plugins/​json-schema-2020-12/​SPEC.md Documents unified replacement of both model views.
playwright.config.ts Expands parity coverage and adds WebKit.
goal-and-requirements.md Records the all-version opt-in capability.
flavors/​swagger-ui-react/​README.md Documents expanded version support.
docs/​usage/​configuration.md Updates option scope and customization guidance.
CLAUDE.md Documents parity and WebKit projects.
architecture.md Updates the unified renderer’s documented scope.
.github/​workflows/​release-swagger-ui.yml Installs WebKit for release checks.
.github/​workflows/​nodejs.yml Installs and caches both browsers.
.claude/​skills/​FOLLOW-UPS.md Records renderer limitations and follow-up work.

Review effort: Max

@glowcloud
glowcloud force-pushed the feat/json-schema-unified-oas2-oas3 branch from ac7826e to 5aeaf9c Compare November 18, 2026 14:37
@glowcloud
glowcloud requested a max review from Copilot November 18, 2026 14:50

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread playwright.config.ts Resolved

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Reference merging can silently discard overlapping allOf constraints, and unresolved regressions also affect schema expansion state and tooltip accessibility.

9 open issues
2 previously missed issues

In code that hasn't changed since last review

High severity Merging referenced schemas drops overlapping constraint arrays

src/​core/​plugins/​json-schema-unified/​legacy.ts:229

Overlapping arrays other than required are replaced here, unlike the classic renderer's refSchema.mergeDeep(schema) (json-schema-5/components/model.jsx:77-80), which concatenates lists. For example, if a leftover $ref and its definition both contain allOf, mergeLazyRef({allOf: [A]}, {$ref: "…", allOf: [B]}) returns only [B], silently dropping A's constraints. OAS 3.0.4 describes these definitions as “validated independently but together compose a single object.” Preserve the classic list-merge behavior and add a regression case with overlapping combiner arrays.

Medium severity Schema expansion state is not read or synchronized

src/​core/​plugins/​json-schema-unified/​versions.ts:44

With default depth settings, layoutActions.show(["components", "schemas", "Pet"], true) no longer expands Pet in the unified 3.0 view; the same regression affects ["definitions", "Pet"] in 2.0. SchemaItem writes layout state on clicks but never reads it, so both existing per-schema state and later external expand/collapse actions are ignored. Feed the per-schema isShown value into the unified expansion state and keep it synchronized with user toggles.

2 resolved since last review

Review effort: Max

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

@robert-hebel-sb
robert-hebel-sb deleted the feat/json-schema-unified-oas2-oas3 branch November 19, 2026 12:08
@robert-hebel-sb
robert-hebel-sb restored the feat/json-schema-unified-oas2-oas3 branch November 19, 2026 12:09
@robert-hebel-sb

Copy link
Copy Markdown
Contributor Author

sending virtual approval ✅

robert-hebel-sb and others added 11 commits November 23, 2026 07:48
No ref-derived names for nested schemas in OAS 3.1/3.2, the reference
path shown inline instead of as the json-schema-5 tooltip, and the
ignored document part of an unresolved 2.0/3.0 local ref.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Reverts the revert of "ui improvements for jump to and references":
the reference path tooltip (shown through the title toggle's peer
variants) and the jump-to button at the top right of the panel.

The isolation test keeps its current selector check.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A schema from a `$ref` is named after what follows `#/definitions/` or
`#/components/schemas/`, so `#/definitions/A/properties/b` is `A/properties/b`
and not `b`. A reference that points elsewhere gets no name. This matches the
3.1/3.2 title and json-schema-5. Both prefixes apply in both dialects.

Also track two follow-ups in FOLLOW-UPS.md: nested `JumpToPath` for `$ref`
schemas, and the core `findDefinition` bug with the oas3 plugin on 2.0.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Export the `System` interface of the json-schema-document selectors, so the
plugin's declaration can name it (TS4023). Type the DOM nodes the unified
schema tests read: `getDOMNode()` is `any` without enzyme types, which made
`Array.from` yield `unknown`. Cast the 2.0/3.0 boolean bounds to `Schema`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- Filter a property by the readOnly/writeOnly of the definition its `$ref`
  points to when the resolver left the reference in place, unless the
  reference sets the keyword itself.
- Do not repeat a title next to a member of allOf, oneOf, anyOf or
  prefixItems: its name already holds it (`#0 Base`).
- Track in FOLLOW-UPS that the 2.0/3.0 `not` label copies the 3.1 one
  (item 13), why a lookup by document URL is not trivial (item 16) and
  that `nullable` is shown without an explicit `type` (item 19).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…alects

- Describe the title button of a dereferenced schema by its reference
  path tooltip: the tooltip gets an id built from the schema's encoded
  path, and the button an `aria-describedby` pointing at it.
- Keep a `__proto__` property when a reference's siblings are merged over
  its definition, by merging into a prototype-free object.
- Say in the README that `npm run e2e` needs WebKit as well as Chromium.
- Name the 2.0 keyword test after what it asserts (no `nullable`).
- Track in FOLLOW-UPS that a reference to an alias schema shows a
  reference row in an operation's Schema tab (item 20).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…ection

A schema of the Schemas section now expands or collapses when
`layoutActions.show` stores a value for its key (`["definitions", name]` in
2.0, `["components", "schemas", name]` in 3.x), as json-schema-5 does. The
layout state is read for the root of each item; when nothing is stored the
depth settings still decide. A schema shown this way requests its resolved
subtree like a click does.

The element of each schema gets the id `model-<name>`, as the one of
json-schema-5's model item.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Editing the spec clears the resolved subtrees, and the schema of the
Schemas section is replaced by the raw one. The effect that asks for the
subtree of a shown schema did not depend on the schema, so an open schema
kept its references unresolved (`$ref` rows) until it was closed and
opened again. It now runs when its schema changes too, and asks only when
the schema is shown and not resolved.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@glowcloud
glowcloud force-pushed the feat/json-schema-unified-oas2-oas3 branch from 32cee3f to 71bd7dd Compare November 23, 2026 06:48
@glowcloud
glowcloud merged commit 12d377b into main Nov 23, 2026
9 checks passed
swagger-bot pushed a commit that referenced this pull request Nov 23, 2026
# [5.36.0](v5.35.1...v5.36.0) (2026-11-23)

### Features

* **json-schema-unified:** add OAS 3.0 and 2.0 dialects ([#11136](#11136)) ([12d377b](12d377b)), closes [#0](https://github.com/swagger-api/swagger-ui/issues/0)
* **json-schema-unified:** add opt-in schema view for OAS 3.1/3.2 ([#11135](#11135)) ([29d5bdc](29d5bdc))
@swagger-bot

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 5.36.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants