1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
# The complete example from our README.md file.
openapi: "3.1.0"
info:
title: Example OpenAPI definition
paths:
/widgets:
post:
requestBody:
required: true
content:
application/json:
schema:
# This becomes `$ref: "#/components/schemas/WidgetPost`.
$interface: "Widget#Post"
responses:
201:
content:
application/json:
schema:
# This becomes `$ref: "#/components/schemas/Widget`.
$interface: "Widget"
components:
# You can declare schemas normally if you wish.
schemas:
# But we also support interface definitions.
interfaces:
Resource:
emit: false # Do not include this in generated output.
members:
id:
required: true
schema:
# Normal OpenAPI / JSON Schema definitions.
type: string
format: uuid
Widget:
# Include all fields from `Resource`.
$includes: "Resource"
description: |
A displayable widget.
members:
# We can override properties from `Resource` using JSON
# Merge Patch syntax.
id:
schema:
example: e35a3c8d-5486-49ec-9b23-6747afc19570
name:
required: true
mutable: true
schema:
type: string
comment:
mutable: true
schema:
type: string
readonly:
required: true
# This can't be updated once the object is created.
mutable: false
# But we do allow this to be set at creation time.
# If omitted, `initializable` defaults to the value
# of the `mutable` option.
initializable: true
schema:
type: string