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
Copy file name to clipboardExpand all lines: src/oas.md
+47-19Lines changed: 47 additions & 19 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1708,7 +1708,7 @@ These fields MAY be used either with or without the RFC6570-style serialization
1708
1708
1709
1709
| Field Name | Type | Description |
1710
1710
| ---- | :----: | ---- |
1711
-
| <a name="encoding-content-type"></a>contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). Default value depends on the property type as shown in the table below. |
1711
+
| <a name="encoding-content-type"></a>contentType | `string` | The `Content-Type` for encoding a specific property. The value is a comma-separated list, each element of which is either a specific media type (e.g. `image/png`) or a wildcard media type (e.g. `image/*`). See [Detecting Media Types](#detecting media types) for related security concerns. Default value depends on the property type as shown in the table below. |
1712
1712
| <a name="encoding-headers"></a>headers | Map[`string`, [Header Object](#header-object) \| [Reference Object](#reference-object)] | A map allowing additional information to be provided as headers. `Content-Type` is described separately and SHALL be ignored in this section. This field SHALL be ignored if the media type is not a `multipart`. |
1713
1713
1714
1714
This object MAY be extended with [Specification Extensions](#specification-extensions).
@@ -1974,29 +1974,52 @@ multipart/mixed:
1974
1974
1975
1975
###### Example: Ordered Multipart With Required Header
1976
1976
1977
-
As described in [[?RFC2557]], a set of HTML pages can be sent in a `multipart/related` payload, preserving links among themselves by defining a `Content-Location` header for each page.
1977
+
As described in [[?RFC2557]], a set of resources making up a web pages can be sent in a `multipart/related` payload, preserving links among themselves by defining a `Content-Location` header for each page.
1978
+
The first part is used as the root resource (unless using `Content-ID`, which RFC2557 advises against), so we use `prefixItems` and `prefixEncoding` to define that it must be an HTML resource, and then allow any of several different types of resources in any order to follow.
1978
1979
1979
-
See [Appendix D](appendix-d-serializing-headers-and-cookies) for an explanation of why `content: {text/plain: {...}}` is used to describe the header value.
1980
+
The `Content-Location` header is defined using `content: {text/plain: {...}}` to avoid percent-encoding its URI value; see [Appendix D](appendix-d-serializing-headers-and-cookies) for further details.
1980
1981
1981
1982
```yaml
1982
-
multipart/related:
1983
-
schema:
1984
-
items:
1985
-
type: string
1986
-
itemEncoding:
1987
-
contentType: text/html
1988
-
headers:
1989
-
Content-Location:
1990
-
required: true
1991
-
content:
1992
-
text/plain:
1993
-
schema:
1994
-
type: string
1995
-
format: uri
1983
+
components:
1984
+
headers:
1985
+
RFC2557ContentId:
1986
+
description: Use Content-Location instead of Content-ID
1987
+
schema: false
1988
+
RFC2557ContentLocation:
1989
+
required: true
1990
+
content:
1991
+
text/plain:
1992
+
schema:
1993
+
$comment: Use a full URI (not a relative reference)
1994
+
type: string
1995
+
format: uri
1996
+
requestBodies:
1997
+
RFC2557:
1998
+
content:
1999
+
multipart/related; type=text/html:
2000
+
schema:
2001
+
prefixItems:
2002
+
- type: string
2003
+
items:
2004
+
anyOf:
2005
+
- type: string
2006
+
- $comment: To allow binary, this must always pass
While the above example could have used `itemSchema` instead, if the payload is expected to be processed all at once, using `schema` ensures that tools will wait until the complete response is available before processing.
1999
-
2000
2023
###### Example: Streaming Multipart
2001
2024
2002
2025
This example assumes a device that takes large sets of pictures and streams them to the caller.
@@ -4138,6 +4161,11 @@ The rules for connecting a [Security Requirement Object](#security-requirement-o
4138
4161
4139
4162
OpenAPI Descriptions may contain references to external resources that may be dereferenced automatically by consuming tools. External resources may be hosted on different domains that may be untrusted.
4140
4163
4164
+
### Detecting Media Types
4165
+
4166
+
Scenarios such as those documented under [Example: Ordered Multipart With Required Header](#example-ordered-multipart-with-required-header) can require an implementation to test whether data matches one of several different media types.
4167
+
Each media type has its own security considerations to be taken into accound during such testing.
4168
+
4141
4169
### Handling Reference Cycles
4142
4170
4143
4171
References in an OpenAPI Description may cause a cycle. Tooling must detect and handle cycles to prevent resource exhaustion.
0 commit comments