Skip to content

@W-23748896 feat(composition): render meaningful labels for oneOf/anyOf/allOf variants (OAS 3.1) - #100

Merged
alexpmule merged 4 commits into
mainfrom
W-23748896-composition-labels
Aug 24, 2026
Merged

alexpmule merged 4 commits into
mainfrom
W-23748896-composition-labels

Conversation

@alexpmule

@alexpmule alexpmule commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

@W-23748896

What

Renders meaningful labels for oneOf / anyOf / allOf composition variants.

AMF names inline composition members with placeholder labels (item0, item1, … and amf_inline_type…). This detects those placeholders (_isPlaceholderTypeLabel) and substitutes a meaningful label so the composition variants read clearly instead of showing item0 / item1.

Why

TD-0333486 — OAS 3.1/3.2 support in API Console v6. AC1: composition schemas must render readable variant labels.

Tests

18/18 green in chromium + firefox: 15 inline AMF expanded-model tests + 3 real-model tests loading the oas31-webhooks compact model through the full expand pipeline (this.skip() if the fixture is absent — degrades to skip, never red). The fixtures are whitelisted in .gitignore and committed so the real-model tests run in CI.

Screenshot

Screenshot 2026-08-23 at 9 54 18 PM

…iants (OAS 3.1)

OAS 3.1/3.2 inline composition members compile to AMF shapes with
synthetic names (item0, item1, amf_inline_type...). These leaked into
the variant tab labels, so users saw 'item0'/'item1' instead of readable
option names.

Detect placeholder labels via _isPlaceholderTypeLabel and replace them:
scalar members fall back to their range data type, object members to
'Option N'. Named $ref members (EmailContact, PetBase) keep their names.

Covered by two suites: composition-labels.test.js builds AMF nodes inline
(generator-independent), and composition-labels-fixture.test.js loads a
real AMF-5.11 oas31-webhooks model through the full expand pipeline and
asserts the rendered labels (skips, never reds, if the fixture is absent).

W-23748896
@alexpmule
alexpmule force-pushed the W-23748896-composition-labels branch from b179fa8 to 4087ca3 Compare August 18, 2026 22:17
alexpmule and others added 3 commits August 20, 2026 15:19
…p generator to 0.4.0

Bump @api-components/api-model-generator ^0.2.14 -> ^0.4.0 (amf-client-js 5.11
supports OAS 3.1/3.2). Add a real OAS 3.1 demo spec exercising oneOf/anyOf/allOf
composition and register it so prepare generates its model. Make
test/amf-loader.js @graph-aware (amf-client-js 5.11 emits flattened @graph
models) and rewrite the composition-label tests to drive the generated model
instead of hand-building AMF inline.

The generated models are prepare artifacts: untrack demo/oas31-webhooks*.json
and drop their .gitignore whitelist (they regenerate via `npm run prepare`).
Adapt property-document-mixin / property-shape-document tests to the 5.11
compact shape (context-relative IRIs; source maps stripped from compact models).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…egistry

The lockfile had 20 `resolved` URLs pointing at the internal
nexus-proxy.repo.local.sfdc.net mirror, which the public GitHub Actions
runner cannot resolve — `npm install` failed with ENOTFOUND before any
test ran. Regenerated with an explicit --registry=https://registry.npmjs.org/
so every tarball resolves from the public registry. Versions are unchanged
(generator 0.4.0, amf-helper-mixin 4.5.38, amf-client-js 5.11.12531);
local suite: 572 passed, 0 failed.
@alexpmule
alexpmule marked this pull request as ready for review August 24, 2026 00:53
@alexpmule
alexpmule merged commit 26cb2db into main Aug 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants