From b9f127a6d872f692b2b038d48b176c60cf0d3284 Mon Sep 17 00:00:00 2001 From: "Henry H. Andrews" Date: Thu, 16 May 2024 12:12:40 -0700 Subject: [PATCH] Encoding Obj contentType takes a media range (3.0.4) The "the two types" appears to have come from an example involving two types, and the TSC agrees that there was no intention to limit it to two. The syntax described also matches media type ranges, which is what is used for keys under `content` keywords that take objects of Media Type Objects. As that is analogous to the use of `contentType` in the Encoding Object, this change aligns the wording. The guidance on default values was difficult to format in a readable way inside of the fixed fields table, so this change also moves it to its own table. --- versions/3.0.4.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/versions/3.0.4.md b/versions/3.0.4.md index b125dab467..c8e70e739f 100644 --- a/versions/3.0.4.md +++ b/versions/3.0.4.md @@ -1601,7 +1601,7 @@ A single encoding definition applied to a single schema property. ##### Fixed Fields Field Name | Type | Description ---|:---:|--- -contentType | `string` | The Content-Type for encoding a specific property. Default value depends on the property type: for `string` with `format` being `binary` – `application/octet-stream`; for other primitive types – `text/plain`; for `object` - `application/json`; for `array` – the default is defined based on the inner type. The value can be a specific media type (e.g. `application/json`), a wildcard media type (e.g. `image/*`), or a comma-separated list of the two types. +contentType | `string` | The Content-Type for encoding a specific property. The value is a media type or [media type range](https://tools.ietf.org/html/rfc7231#appendix-D). Default value depends on the property type as shown in the table below. headers | Map[`string`, [Header Object](#headerObject) \| [Reference Object](#referenceObject)] | A map allowing additional information to be provided as headers, for example `Content-Disposition`. `Content-Type` is described separately and SHALL be ignored in this section. This property SHALL be ignored if the request body media type is not a `multipart`. style | `string` | Describes how a specific property value will be serialized depending on its type. See [Parameter Object](#parameterObject) for details on the [`style`](#parameterStyle) property. The behavior follows the same values as `query` parameters, including default values. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. explode | `boolean` | When this is true, property values of type `array` or `object` generate separate parameters for each value of the array, or key-value-pair of the map. For other types of properties this property has no effect. When [`style`](#encodingStyle) is `form`, the default value is `true`. For all other styles, the default value is `false`. This property SHALL be ignored if the request body media type is not `application/x-www-form-urlencoded`. @@ -1609,6 +1609,17 @@ Field Name | Type | Description This object MAY be extended with [Specification Extensions](#specificationExtensions). +###### Default Values for `contentType` + +The default values for `contentType` are as follows: + +Property Type | Property Format | Default `contentType` +------------- | --------------- | --------------------- +`string` | `binary` | `application/octet-stream` +`string`, `number`, `integer`, or `boolean` | _n/a_ | `text/plain` +`object` | _n/a_ | `application/json` +`array` | _n/a_ | according to the `type` and `format` of the `items` schema + ##### Encoding Object Example `multipart/form-data` allows for binary parts: