You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An optional query parameter of a string value, allowing multiple values by repeating the query parameter:
1295
+
An optional query parameter of a string value, allowing multiple values by repeating the query parameter
1296
+
(Note that we use `"%20"` in place of `" "` (space) because that is how RFC6570 handles it; for guidance on using `+` to represent the space character, see [Appendix E](#appendix-e-percent-encoding-and-form-media-types) for more guidance on these escaping options):
A free-form query parameter, allowing undefined parameters of a specific type:
1314
+
A free-form query parameter, allowing arbitrary parameters of `type: "integer"`:
1296
1315
1297
1316
```yaml
1298
1317
in: query
@@ -1302,9 +1321,16 @@ schema:
1302
1321
additionalProperties:
1303
1322
type: integer
1304
1323
style: form
1324
+
examples:
1325
+
Pagination:
1326
+
dataValue: {
1327
+
"page": 4,
1328
+
"pageSize": 50
1329
+
}
1330
+
serializeValue: page=4&pageSize=50
1305
1331
```
1306
1332
1307
-
A complex parameter using `content` to define serialization:
1333
+
A complex parameter using `content` to define serialization, with multiple levels and types of examples shown to make the example usage options clear — note that `dataValue` is the same at both levels and does not need to be shown in both places in normal usage, but `serializedValue` is different:
A querystring parameter using regular form encoding, but managed with a Media Type Object.
1365
+
This shows spaces being handled per the `application/x-www-form-urlencoded` media type rules (encode as `+`) rather than the RFC6570 process (encode as `%20`); see [Appendix E](appendix-e-percent-encoding-and-form-media-types) for further guidance on this distinction.
1366
+
Examples are shown at both the media type and parameter level to emphasize that, since `application/x-www-form-urlencoded` is suitable for use in query strings by definition, no further encoding or escaping is applied to the serialized media type value:
1367
+
1368
+
```yaml
1369
+
in: querystring
1370
+
content:
1371
+
application/x-www-form-urlencoded:
1372
+
schema:
1373
+
type: object
1374
+
properties:
1375
+
foo:
1376
+
type: string
1377
+
bar:
1378
+
type: boolean
1379
+
examples:
1380
+
spacesAndPluses:
1381
+
description: Note handling of spaces and "+" per media type.
1382
+
dataValue:
1383
+
foo: a + b
1384
+
bar: true
1385
+
serializedValue: foo=a+%2B+b&bar=true
1386
+
examples:
1387
+
spacesAndPluses:
1388
+
description: |
1389
+
Note that no additional percent encoding is done, as this
1390
+
media type is URI query string-ready by definition.
1391
+
dataValue:
1392
+
foo: a + b
1393
+
bar: true
1394
+
serializedValue: foo=a+%2B+b&bar=true
1324
1395
```
1325
1396
1326
-
A querystring parameter that uses JSON for the entire string (not as a single query parameter value):
1397
+
A querystring parameter that uses JSON for the entire string (not as a single query parameter value).
1398
+
The `dataValue` field is shown at both levels to fully illustrate both ways of providing an example.
1399
+
As seen below, this is redundant and need not be done in practice:
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:
1432
+
Assuming a path of `/foo`, a server of `https://example.com`, the full URL incorporating the value from `serializedValue` would be:
Note that in this example we not only do not repeat `dataValue`, but we use the shorthand `example` because the `application/jsonpath` value is a string that, at the media type level, is serialized as-is:
1350
1440
1351
1441
```yaml
1352
1442
in: querystring
@@ -1356,11 +1446,14 @@ content:
1356
1446
schema:
1357
1447
type: string
1358
1448
example: $.a.b[1:1]
1449
+
examples:
1450
+
Selector:
1451
+
serializedValue: "%24.a.b%5B1%3A1%5D"
1359
1452
```
1360
1453
1361
1454
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.
1362
1455
1363
-
Assuming a path of `/foo` and a server of `https://example.com`, the full URL incorporating the value from the `example` field would be:
1456
+
Assuming a path of `/foo` and a server of `https://example.com`, the full URL incorporating the value from `serializedValue` would be:
0 commit comments