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:
1122
+
An optional query parameter of a integer value, allowing multiple values by repeating the query parameter
1123
+
(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:
1141
+
A free-form query parameter, allowing arbitrary parameters of a `type: "integer"`:
1123
1142
1124
1143
```yaml
1125
1144
in: query
@@ -1129,9 +1148,16 @@ schema:
1129
1148
additionalProperties:
1130
1149
type: integer
1131
1150
style: form
1151
+
examples:
1152
+
Pagination:
1153
+
dataValue: {
1154
+
"page": 4,
1155
+
"pageSize": 50
1156
+
}
1157
+
serializeValue: page=4&pageSize=50
1132
1158
```
1133
1159
1134
-
A complex parameter using `content` to define serialization:
1160
+
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.
1192
+
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.
1193
+
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:
1194
+
1195
+
```yaml
1196
+
in: querystring
1197
+
content:
1198
+
application/x-www-form-urlencoded:
1199
+
schema:
1200
+
type: object
1201
+
properties:
1202
+
foo:
1203
+
type: string
1204
+
bar:
1205
+
type: boolean
1206
+
examples:
1207
+
spacesAndPluses:
1208
+
description: Note handling of spaces and "+" per media type.
1209
+
dataValue:
1210
+
foo: a + b
1211
+
bar: true
1212
+
serializedValue: foo=a+%2B+b&bar=true
1213
+
examples:
1214
+
spacesAndPluses:
1215
+
description: |
1216
+
Note that no additional percent encoding is done, as this
1217
+
media type is URI query string-ready by definition.
1218
+
dataValue:
1219
+
foo: a + b
1220
+
bar: true
1221
+
serializedValue: foo=a+%2B+b&bar=true
1151
1222
```
1152
1223
1153
-
A querystring parameter that uses JSON for the entire string (not as a single query parameter value):
1224
+
A querystring parameter that uses JSON for the entire string (not as a single query parameter value).
1225
+
The `dataValue` field is shown at both levels to fully illustrate both ways of providing an example.
1226
+
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:
1259
+
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:
1177
1267
1178
1268
```yaml
1179
1269
in: querystring
@@ -1183,11 +1273,14 @@ content:
1183
1273
schema:
1184
1274
type: string
1185
1275
example: $.a.b[1:1]
1276
+
examples:
1277
+
Selector:
1278
+
serializedValue: "%24.a.b%5B1%3A1%5D"
1186
1279
```
1187
1280
1188
1281
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.
1189
1282
1190
-
Assuming a path of `/foo` and a server of `https://example.com`, the full URL incorporating the value from the `example` field would be:
1283
+
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