Skip to content

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

Draft
alexpmule wants to merge 2 commits into
mainfrom
W-23748896-composition-labels
Draft

@W-23748896 feat(composition): render meaningful labels for oneOf/anyOf/allOf variants (OAS 3.1)#100
alexpmule wants to merge 2 commits into
mainfrom
W-23748896-composition-labels

Conversation

@alexpmule

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.

Scope

Draft for review.

…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
…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>
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.

1 participant