Skip to content

Commit 3383d8d

Browse files
committed
Parameter Object example updates
1 parent 6aa77bc commit 3383d8d

File tree

1 file changed

+34
-9
lines changed

1 file changed

+34
-9
lines changed

src/oas.md

Lines changed: 34 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,6 +1100,10 @@ schema:
11001100
type: integer
11011101
format: int64
11021102
style: simple
1103+
examples:
1104+
number:
1105+
dataValue: [12345678, 90099]
1106+
serializedValue: "12345678,90099"
11031107
```
11041108

11051109
A path parameter of a string value:
@@ -1111,6 +1115,13 @@ description: username to fetch
11111115
required: true
11121116
schema:
11131117
type: string
1118+
examples:
1119+
"Edsger Dijkstra":
1120+
dataValue: edijkstra
1121+
serializedValue: edijkstra
1122+
Diṅnāga:
1123+
dataValue: diṅnāga
1124+
serializedValue: di%E1%B9%85n%C4%81ga
11141125
```
11151126

11161127
An optional query parameter of a string value, allowing multiple values by repeating the query parameter:
@@ -1126,18 +1137,26 @@ schema:
11261137
type: string
11271138
style: form
11281139
explode: true
1140+
examples:
1141+
stuff:
1142+
dataValue: [this, that, theother]
1143+
serializedValue: id=this&id=that&id=theother
11291144
```
11301145

1131-
A free-form query parameter, allowing undefined parameters of a specific type:
1146+
A free-form query parameter, allowing undefined parameters of a `type: "string"`:
11321147
11331148
```yaml
11341149
in: query
11351150
name: freeForm
11361151
schema:
11371152
type: object
11381153
additionalProperties:
1139-
type: integer
1154+
type: string
11401155
style: form
1156+
examples:
1157+
freeForm:
1158+
dataValue: {"yeah": "I'm", "free": "forming"}
1159+
serializedValue: yeah=I%27m&free=forming
11411160
```
11421161
11431162
A complex parameter using `content` to define serialization:
@@ -1170,13 +1189,17 @@ content:
11701189
# Allow an arbitrary JSON object to keep
11711190
# the example simple
11721191
type: object
1173-
example: {
1174-
"numbers": [1, 2],
1175-
"flag": null
1176-
}
1192+
examples:
1193+
minimized:
1194+
summary: JSON should be serialized with minimal whitespace
1195+
dataValue: {
1196+
"numbers": [1, 2],
1197+
"flag": null
1198+
}
1199+
serializedValue: '{"numbers":[1,2],"flag":null}'
11771200
```
11781201

1179-
Assuming a path of `/foo`, a server of `https://example.com`, the full URL incorporating the value from the `example` field (with whitespace minimized) would be:
1202+
Assuming a path of `/foo`, a server of `https://example.com`, the full URL incorporating the value from the `serializedValue` field would be:
11801203

11811204
```uri
11821205
https://example.com/foo?%7B%22numbers%22%3A%5B1%2C2%5D%2C%22flag%22%3Anull%7D
@@ -1191,12 +1214,14 @@ content:
11911214
application/jsonpath:
11921215
schema:
11931216
type: string
1194-
example: $.a.b[1:1]
1217+
examples:
1218+
simpleSelector:
1219+
dataValue: $.a.b[1:1]
11951220
```
11961221

11971222
As there is not, as of this writing, a [registered](#media-type-registry) mapping between the JSON Schema data model and JSONPath, the details of the string's allowed structure would need to be conveyed either in a human-readable `description` field, or through a mechanism outside of the OpenAPI Description, such as a JSON Schema for the data structure to be queried.
11981223

1199-
Assuming a path of `/foo` and a server of `https://example.com`, the full URL incorporating the value from the `example` field would be:
1224+
Assuming a path of `/foo` and a server of `https://example.com`, the full URL incorporating the value from the `dataValue` field would be:
12001225

12011226
```uri
12021227
https://example.com/foo?%24.a.b%5B1%3A1%5D

0 commit comments

Comments
 (0)