@@ -1128,20 +1128,38 @@ A request body with a referenced model definition.
1128
1128
"schema": {
1129
1129
"$ref": "#/components/schemas/User"
1130
1130
},
1131
- "examples": [ "http://foo.bar/examples/user-example.json" ]
1131
+ "examples": {
1132
+ "user" : {
1133
+ "summary": "User Example",
1134
+ "valueUrl": "http://foo.bar/examples/user-example.json"
1135
+ }
1136
+ }
1132
1137
},
1133
1138
"application/xml": {
1134
1139
"schema": {
1135
1140
"$ref": "#/components/schemas/User"
1136
1141
},
1137
- "examples": [ "http://foo.bar/examples/user-example.xml" ]
1142
+ "examples": {
1143
+ "user" : {
1144
+ "summary": "User example in XML",
1145
+ "valueUrl": "http://foo.bar/examples/user-example.xml"
1146
+ }
1147
+ }
1138
1148
},
1139
1149
"text/plain": {
1140
- "examples": [ "http://foo.bar/examples/user-example.txt" ]
1150
+ "examples": {
1151
+ "user" : {
1152
+ "summary": "User example in Plain text",
1153
+ "valueUrl": "http://foo.bar/examples/user-example.txt"
1154
+ }
1155
+ }
1141
1156
},
1142
1157
"*/*": {
1143
- "example": {
1144
- "$ref": "http://foo.bar/examples/user-example.whatever"
1158
+ "examples": {
1159
+ "user" : {
1160
+ "summary": "User example in other format",
1161
+ "valueUrl": "http://foo.bar/examples/user-example.whatever"
1162
+ }
1145
1163
}
1146
1164
}
1147
1165
}
@@ -1155,18 +1173,26 @@ content:
1155
1173
schema:
1156
1174
$ref: '#/components/schemas/User'
1157
1175
examples:
1158
- - 'http://foo.bar/examples/user-example.json'
1176
+ user:
1177
+ summary: User Example
1178
+ valueUrl: 'http://foo.bar/examples/user-example.json'
1159
1179
'application/xml':
1160
1180
schema:
1161
1181
$ref: '#/components/schemas/User'
1162
1182
examples:
1163
- - 'http://foo.bar/examples/user-example.xml'
1183
+ user:
1184
+ summary: User Example in XML
1185
+ valueUrl: 'http://foo.bar/examples/user-example.xml'
1164
1186
'text/plain':
1165
1187
examples:
1166
- - 'http://foo.bar/examples/user-example.txt'
1188
+ user:
1189
+ summary: User example in text plain format
1190
+ valueUrl: 'http://foo.bar/examples/user-example.txt'
1167
1191
'*/*':
1168
- example:
1169
- $ref: 'http://foo.bar/examples/user-example.whatever'
1192
+ examples:
1193
+ user:
1194
+ summary: User example in other format
1195
+ valueUrl: 'http://foo.bar/examples/user-example.whatever'
1170
1196
` ` `
1171
1197
1172
1198
A body parameter that is an array of string values :
@@ -1216,22 +1242,40 @@ Each key in the Content Object is the media type of the [Media Type Object](#med
1216
1242
"type": "string"
1217
1243
}
1218
1244
},
1219
- "examples": [
1220
- ["Bob","Diane","Mary","Bill"],
1221
- []
1222
- ]
1245
+ "examples": {
1246
+ "list": {
1247
+ "summary": "List of names",
1248
+ "value" : ["Bob","Diane","Mary","Bill"]
1249
+ },
1250
+ "empty":{
1251
+ "summary": "Empty List",
1252
+ "value": []
1253
+ }
1254
+ }
1223
1255
},
1224
1256
"application/xml": {
1225
- "examples": [
1226
- "<Users><User name='Bob'/><User name='Diane'/><User name='Mary'/><User name='Bill'/></Users>",
1227
- "<Users/>"
1228
- ]
1257
+ "examples": {
1258
+ "list": {
1259
+ "summary": "List of names",
1260
+ "value": "<Users><User name='Bob'/><User name='Diane'/><User name='Mary'/><User name='Bill'/></Users>"
1261
+ },
1262
+ "empty": {
1263
+ "summary":"Empty",
1264
+ "value": "<Users/>"
1265
+ }
1266
+ }
1229
1267
},
1230
1268
"text/plain": {
1231
- "examples": [
1232
- "Bob,Diane,Mary,Bill",
1233
- ""
1234
- ]
1269
+ "examples": {
1270
+ "list": {
1271
+ "summary": "List of names",
1272
+ "value": "Bob,Diane,Mary,Bill"
1273
+ },
1274
+ "empty": {
1275
+ "summary": "Empty",
1276
+ "value" : ""
1277
+ }
1278
+ }
1235
1279
}
1236
1280
}
1237
1281
` ` `
@@ -1244,21 +1288,33 @@ content:
1244
1288
items:
1245
1289
type: string
1246
1290
examples:
1247
- -
1248
- - Bob
1249
- - Diane
1250
- - Mary
1251
- - Bill
1252
- - {}
1291
+ list:
1292
+ summary: List of Names
1293
+ value:
1294
+ - Bob
1295
+ - Diane
1296
+ - Mary
1297
+ - Bill
1298
+ empty:
1299
+ summary: Empty
1300
+ value: {}
1253
1301
1254
1302
'application/xml':
1255
1303
examples:
1256
- - "<Users><User name='Bob'/><User name='Diane'/><User name='Mary'/><User name='Bill'/></Users>"
1257
- - "<Users/>"
1304
+ list:
1305
+ summary: List of names
1306
+ value: "<Users><User name='Bob'/><User name='Diane'/><User name='Mary'/><User name='Bill'/></Users>"
1307
+ empty:
1308
+ summmary: Empty list
1309
+ value: "<Users/>"
1258
1310
'text/plain':
1259
1311
examples:
1260
- - "Bob,Diane,Mary,Bill"
1261
- - ""
1312
+ list:
1313
+ summary: List of names
1314
+ value: "Bob,Diane,Mary,Bill"
1315
+ empty:
1316
+ summary: Empty
1317
+ value: ""
1262
1318
` ` `
1263
1319
1264
1320
# ### <a name="mediaTypeObject"></a>Media Type Object
@@ -1889,8 +1945,9 @@ schemas:
1889
1945
properties:
1890
1946
name:
1891
1947
type: string
1892
- example:
1893
- $ref: http://example.org/petapi-examples/OpenApi.json#/components/examples/name-example
1948
+ examples:
1949
+ name:
1950
+ $ref: http://example.org/petapi-examples/OpenApi.json#/components/examples/name-example
1894
1951
1895
1952
# in a request body, note the plural ` examples` as the Content-Type is set to `*`:
1896
1953
requestBody :
@@ -2781,14 +2838,22 @@ example:
2781
2838
"required": [
2782
2839
"name"
2783
2840
],
2784
- "examples": [
2785
- {
2786
- "name": "Puma",
2787
- "id": 1
2788
- }, {
2789
- "name": "Ferguson",
2790
- "id": 2
2791
- }]
2841
+ "examples": {
2842
+ "cat": {
2843
+ "summary": "Big cat example",
2844
+ "value": {
2845
+ "name": "Puma",
2846
+ "id": 1
2847
+ }
2848
+ },
2849
+ "dog": {
2850
+ "summary": "Family dog example",
2851
+ "value": {
2852
+ "name": "Ferguson",
2853
+ "id": 2
2854
+ }
2855
+ }
2856
+ }
2792
2857
}
2793
2858
` ` `
2794
2859
@@ -2803,10 +2868,16 @@ properties:
2803
2868
required:
2804
2869
- name
2805
2870
examples:
2806
- - name: Puma
2807
- id: 1
2808
- - name: Ferguson
2809
- id: 2
2871
+ cat:
2872
+ summary: Big cat example
2873
+ value:
2874
+ name: Puma
2875
+ id: 1
2876
+ dog:
2877
+ summary: Family Dog
2878
+ value:
2879
+ name: Ferguson
2880
+ id: 2
2810
2881
` ` `
2811
2882
2812
2883
# ##### Models with Composition
0 commit comments