From 68dde60cf61c50923e9db2d13c2c393a0a60e501 Mon Sep 17 00:00:00 2001 From: alexp mule Date: Mon, 10 Aug 2026 15:28:58 -0300 Subject: [PATCH] test(demo): add OAS 3.1 and 3.2 demo fixtures for TD-0333486 Adds two demo specs and registers them in the model manifest and demo app picker so the console has real OAS 3.1/3.2 models to render against: - oas31-webhooks.yaml: top-level webhooks + allOf/if-then-else/oneOf/anyOf - oas32-query-sse.yaml: QUERY method + text/event-stream (SSE) via itemSchema Both parse with conforms:true under AMF 5.11.x. Generated models are build artifacts (demo/models/*.json, gitignored), produced by generate-model once api-model-generator republishes with OAS 3.1/3.2 support (api-components/api-model-generator#20). W-23748889 (parent W-23735927). --- demo/apis.json | 2 + demo/element/app.js | 2 + .../models/oas31-webhooks/oas31-webhooks.yaml | 106 ++++++++++++++++++ .../oas32-query-sse/oas32-query-sse.yaml | 71 ++++++++++++ 4 files changed, 181 insertions(+) create mode 100644 demo/models/oas31-webhooks/oas31-webhooks.yaml create mode 100644 demo/models/oas32-query-sse/oas32-query-sse.yaml diff --git a/demo/apis.json b/demo/apis.json index 61808f54..9c120985 100644 --- a/demo/apis.json +++ b/demo/apis.json @@ -15,6 +15,8 @@ "models/apic-83/apic-83.raml": "RAML 1.0", "models/multi-server/multi-server.yaml": { "type": "OAS 3.0", "mime": "application/yaml" }, "models/oas-3-api/oas-3-api.yaml": { "type": "OAS 3.0", "mime": "application/yaml" }, + "models/oas31-webhooks/oas31-webhooks.yaml": { "type": "OAS 3.1", "mime": "application/yaml" }, + "models/oas32-query-sse/oas32-query-sse.yaml": { "type": "OAS 3.2", "mime": "application/yaml" }, "models/async-api/async-api.yaml": "ASYNC 2.0", "models/APIC-553/APIC-553.raml": "RAML 1.0", "models/APIC-554/APIC-554.raml": "RAML 1.0", diff --git a/demo/element/app.js b/demo/element/app.js index b0efa75f..eade00c5 100644 --- a/demo/element/app.js +++ b/demo/element/app.js @@ -22,6 +22,8 @@ class ApicApplication extends DemoBase { ['demo-api', 'Demo API'], ['multi-server', 'Multi Server API'], ['oas-3-api', 'OAS 3 API'], + ['oas31-webhooks', '★ OAS 3.1 - Webhooks (TD-0333486)'], + ['oas32-query-sse', '★ OAS 3.2 - QUERY + SSE (TD-0333486)'], ['async-api', 'AsyncAPI'], ['APIC-553', 'APIC-553'], ['APIC-557', 'APIC-557'], diff --git a/demo/models/oas31-webhooks/oas31-webhooks.yaml b/demo/models/oas31-webhooks/oas31-webhooks.yaml new file mode 100644 index 00000000..e456befb --- /dev/null +++ b/demo/models/oas31-webhooks/oas31-webhooks.yaml @@ -0,0 +1,106 @@ +openapi: 3.1.0 +info: + title: Webhooks + Schema Composition Spike + version: 1.0.0 +paths: + /pets: + get: + operationId: listPets + summary: List pets + responses: + "200": + description: A list of pets + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/Pet" + +# Top-level `webhooks` map of Path Item Objects, confirmed in OAS 3.1.0 spec +# (versions/3.1.0.md, field `webhooks`, sibling to `paths`/`components`). +webhooks: + newPet: + post: + operationId: newPetWebhook + summary: Notify subscriber of a newly created pet + requestBody: + required: true + content: + application/json: + schema: + $ref: "#/components/schemas/Pet" + responses: + "200": + description: Webhook received successfully + +components: + schemas: + Pet: + # allOf: base fields + discriminated extra fields + allOf: + - $ref: "#/components/schemas/PetBase" + - $ref: "#/components/schemas/PetKindFields" + + PetBase: + type: object + required: [id, name] + properties: + id: + type: integer + name: + type: string + kind: + type: string + enum: [dog, cat] + + # if/then/else conditional (JSON Schema 2020-12, dialect used by OAS 3.1) + PetKindFields: + if: + properties: + kind: + const: dog + then: + properties: + breed: + type: string + required: [breed] + else: + properties: + indoor: + type: boolean + required: [indoor] + + # oneOf: mutually exclusive contact methods + ContactMethod: + oneOf: + - $ref: "#/components/schemas/EmailContact" + - $ref: "#/components/schemas/PhoneContact" + + EmailContact: + type: object + required: [email] + properties: + email: + type: string + format: email + + PhoneContact: + type: object + required: [phone] + properties: + phone: + type: string + + # anyOf: owner may have one or more identifiers present + OwnerIdentifiers: + anyOf: + - required: [ownerId] + properties: + ownerId: + type: integer + - required: [ownerEmail] + properties: + ownerEmail: + type: string + format: email diff --git a/demo/models/oas32-query-sse/oas32-query-sse.yaml b/demo/models/oas32-query-sse/oas32-query-sse.yaml new file mode 100644 index 00000000..69807d8d --- /dev/null +++ b/demo/models/oas32-query-sse/oas32-query-sse.yaml @@ -0,0 +1,71 @@ +openapi: 3.2.0 +info: + title: QUERY Method + SSE Streaming Spike + version: 1.0.0 +paths: + /pets: + # `query` is a Path Item Object fixed field (sibling to get/post/etc.), + # confirmed in OAS 3.2.0 spec (versions/3.2.0.md, field `path-item-query`): + # "A definition of a QUERY operation, as defined in the most recent IETF + # draft (draft-ietf-httpbis-safe-method-w-body) ... on this path." + # QUERY is safe/idempotent but carries a request body (unlike GET). + query: + operationId: queryPets + summary: Search pets using a structured filter body + requestBody: + required: true + content: + application/json: + schema: + type: object + properties: + kind: + type: string + maxAge: + type: integer + responses: + "200": + description: Matching pets + content: + application/json: + schema: + type: array + items: + type: object + properties: + id: + type: integer + name: + type: string + + /pets/events: + get: + operationId: streamPetEvents + summary: Stream pet lifecycle events via Server-Sent Events + responses: + "200": + description: A live stream of pet events + content: + # Confirmed in OAS 3.2.0 spec: `itemSchema` on the Media Type + # Object describes each individual event in a streaming/ + # sequential media type; `text/event-stream` is explicitly + # called out under "Special Considerations for Server-Sent + # Events" and demonstrated with itemSchema in that section. + text/event-stream: + itemSchema: + type: object + required: [event] + properties: + event: + type: string + enum: [petCreated, petUpdated, petDeleted] + data: + contentMediaType: application/json + contentSchema: + type: object + required: [id] + properties: + id: + type: integer + retry: + type: integer