Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions demo/apis.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions demo/element/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
Expand Down
106 changes: 106 additions & 0 deletions demo/models/oas31-webhooks/oas31-webhooks.yaml
Original file line number Diff line number Diff line change
@@ -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
71 changes: 71 additions & 0 deletions demo/models/oas32-query-sse/oas32-query-sse.yaml
Original file line number Diff line number Diff line change
@@ -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