Skip to content

Commit 6bb80f8

Browse files
committed
clarifications
1 parent 6c21f32 commit 6bb80f8

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

versions/3.0.md

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1154,7 +1154,11 @@ description: Pets operations
11541154

11551155
#### <a name="examplesObject"></a>Examples Object
11561156

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`:
1157+
Anywhere an `example` may be given, allow a $ref object. This does mean that `example`, structurally, can be either a string primitive or an object, like `additionalProperties`.
1158+
1159+
In locations where the field being provided an `example` is a scalar value _or_ has it's content-type definition determined by a higher-level construct (a response payload, for example, uses the `produces` attribute to select the correct message format), the plural `examples` shall be used, and the payload format be specified as a key to the example.
1160+
1161+
In all cases, the payload is expected to be compatible with the type schema for the value that it is accompanying. Tooling vendors may choose to valide compatibility automatically, and reject the example value(s) if they are not compatible.
11581162

11591163
```yaml
11601164
# in a model
@@ -1163,35 +1167,35 @@ definitions:
11631167
name:
11641168
type: string
11651169
example:
1166-
$ref: http://foo.bar#/examples/name-example.json
1170+
$ref: http://foo.bar#/examples/name-example
11671171
1168-
# in a parameter:
1172+
# in a parameter, note the plural `examples` as the content-type is set by `consumes`:
11691173
parameters:
11701174
- name: address
11711175
in: body
11721176
schema:
11731177
$ref: '#/definitions/Address'
11741178
examples:
11751179
'application/json':
1176-
$ref: http://foo.bar#/examples/address-example.json
1180+
$ref: 'http://foo.bar#/examples/address-example.json'
11771181
'application/xml':
1178-
$ref: http://foo.bar#/examples/address-example.xml
1182+
$ref: 'http://foo.bar#/examples/address-example.xml'
11791183
'text/plain':
1180-
$ref: http://foo.bar#/examples/address-example.txt
1184+
$ref: 'http://foo.bar#/examples/address-example.txt'
11811185
default:
1182-
$ref: http://foo.bar#/examples/address-example.whatever
1183-
- name: zip
1184-
in: query
1185-
type: string
1186-
format: zip
1186+
$ref: 'http://foo.bar#/examples/address-example.whatever'
1187+
- name: 'zip'
1188+
in: 'query'
1189+
type: 'string'
1190+
format: 'zip'
11871191
example:
1188-
$ref: http://foo.bar#/examples/zip-example
1189-
# in a response:
1192+
$ref: 'http://foo.bar#/examples/zip-example'
1193+
# in a response, note the plural `examples`:
11901194
responses:
11911195
200:
11921196
description: your car appointment has been booked
1193-
schema:
1194-
$ref: '#/definitions/SuccessResponse'
1197+
schema:
1198+
$ref: '#/definitions/SuccessResponse'
11951199
examples:
11961200
'application/json':
11971201
$ref: http://foo.bar#/examples/address-example.json

0 commit comments

Comments
 (0)