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
A body parameter that is an array of string values:
1382
-
```json
1383
-
{
1384
-
"description": "user to add to the system",
1385
-
"content": {
1386
-
"text/plain": {
1387
-
"schema": {
1388
-
"type": "array",
1389
-
"items": {
1390
-
"type": "string"
1391
-
}
1392
-
}
1393
-
}
1394
-
}
1395
-
}
1396
-
```
1397
-
1398
-
```yaml
1399
-
description: user to add to the system
1400
-
required: true
1401
-
content:
1402
-
text/plain:
1403
-
schema:
1404
-
type: array
1405
-
items:
1406
-
type: string
1407
-
```
1408
-
1409
-
1410
1381
#### <a name="mediaTypeObject"></a>Media Type Object
1411
1382
Each Media Type Object provides schema and examples for the media type identified by its key.
1412
1383
@@ -1566,9 +1537,35 @@ requestBody:
1566
1537
properties: {}
1567
1538
```
1568
1539
1569
-
In this example, the contents in the `requestBody` MUST be stringified per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server. In addition, the `address` field complex object will be stringified.
1540
+
In this example, the contents in the `requestBody` MUST be encoded per [RFC1866](https://tools.ietf.org/html/rfc1866) when passed to the server. In addition, the `address` field complex object will be serialized to a string representation prior to encoding.
1541
+
1542
+
When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [Encoding Object](#encodingObject)'s [`style`](#encodingStyle) property as `form`.
1543
+
1544
+
With this example, given an `id` of `f81d4fae-7dec-11d0-a765-00a0c91e6bf6` and a US-style address (with ZIP+4) as follows:
1545
+
1546
+
```json
1547
+
{
1548
+
"streetAddress": "123 Example Dr.",
1549
+
"city": "Somewhere",
1550
+
"state": "CA",
1551
+
"zip": "99999+1234"
1552
+
}
1553
+
```
1554
+
1555
+
Assuming the most compact representation of the JSON value (with unnecessary whitespace removed), we would expect to see the following request body, where space characters have been replaced with `+` and `+`, `"`, `{`, and `}` have been percent-encoded to `%2B`, `%22`, `%7B`, and `%7D`, respectively:
1570
1556
1571
-
When passing complex objects in the `application/x-www-form-urlencoded` content type, the default serialization strategy of such properties is described in the [`Encoding Object`](#encodingObject)'s [`style`](#encodingStyle) property as `form`.
Note that the `id` keyword is treated as `text/plain` per the [Encoding Object](#encodingObject)'s default behavior, and is serialized as-is.
1562
+
If it were treated as `application/json`, then the serialized value would be a JSON string including quotation marks, which would be percent-encoded as `%22`.
1563
+
1564
+
Here is the `id` parameter (without `address`) serialized as `application/json` instead of `text/plain`, and then encoded per RFC1866:
1565
+
1566
+
```urlencoded
1567
+
id=%22f81d4fae-7dec-11d0-a765-00a0c91e6bf6%22
1568
+
```
1572
1569
1573
1570
##### Special Considerations for `multipart` Content
0 commit comments