Skip to content

Commit 6c21f32

Browse files
committed
adde examples object
1 parent 99706c1 commit 6c21f32

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

versions/3.0.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,6 +1152,51 @@ name: pet
11521152
description: Pets operations
11531153
```
11541154

1155+
#### <a name="examplesObject"></a>Examples Object
1156+
1157+
Anywhere an `example` may be given, allow a $ref object. This does mean that `example` can be either a string primitive or an object, like `additionalProperties`:
1158+
1159+
```yaml
1160+
# in a model
1161+
definitions:
1162+
properties:
1163+
name:
1164+
type: string
1165+
example:
1166+
$ref: http://foo.bar#/examples/name-example.json
1167+
1168+
# in a parameter:
1169+
parameters:
1170+
- name: address
1171+
in: body
1172+
schema:
1173+
$ref: '#/definitions/Address'
1174+
examples:
1175+
'application/json':
1176+
$ref: http://foo.bar#/examples/address-example.json
1177+
'application/xml':
1178+
$ref: http://foo.bar#/examples/address-example.xml
1179+
'text/plain':
1180+
$ref: http://foo.bar#/examples/address-example.txt
1181+
default:
1182+
$ref: http://foo.bar#/examples/address-example.whatever
1183+
- name: zip
1184+
in: query
1185+
type: string
1186+
format: zip
1187+
example:
1188+
$ref: http://foo.bar#/examples/zip-example
1189+
# in a response:
1190+
responses:
1191+
200:
1192+
description: your car appointment has been booked
1193+
schema:
1194+
$ref: '#/definitions/SuccessResponse'
1195+
examples:
1196+
'application/json':
1197+
$ref: http://foo.bar#/examples/address-example.json
1198+
```
1199+
11551200
#### <a name="referenceObject"></a>Reference Object
11561201

11571202
A simple object to allow referencing other definitions in the specification. It can be used to reference parameters and responses that are defined at the top level for reuse.

0 commit comments

Comments
 (0)