Skip to content

Commit 2ce5114

Browse files
committed
More info and better formatting in media type registry
Add specification links, add parent sections, link to Objects, use a name and description, use the name of the registry, add some notes to specifications where appropriate.
1 parent bda90e1 commit 2ce5114

File tree

10 files changed

+190
-46
lines changed

10 files changed

+190
-46
lines changed

_includes/media-type-entry.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
# <a href=".">{{ page.collection }}</a>
1+
# <a href=".">Media Type Registry</a>
22

3-
## {{ page.description }}
3+
## {{ page.name }}: {{ page.description }}
44

55
**Media Type(s):**
66

7-
{% for media_type in page.media_types %}• <tt>{{ media_type.name }}</tt>{% unless media_type.registered %} _<small>(not IANA-registered)</small>_{% endunless %}{% unless forloop.last %}<br />{% endunless %}{% endfor %}
7+
{% for media_type in page.media_types %}• <tt>{{ media_type.name }}</tt> <small>({% if media_type.iana %}[IANA]({{ media_type.iana }}){% else %}not IANA-registered{% endif %})</small> – {% for spec in media_type.specifications %}[{{ spec.name }}]({{ spec.url }}){% if spec.note %} <small>({{ spec.note }})</small>{% endif %}{% unless forloop.last %}, {% endunless %}{% endfor %}{% unless forloop.last %}<br />{% endunless %}{% endfor %}
88
{% if page.default_for %}
99

10-
This page also applies to any unknown {{ page.default_for }} media type.
10+
This page also applies to any unrecognized {{ page.default_for }} media type.
1111
{% endif %}
1212

1313
{% if page.references %}
1414
**OAS References:**
1515

16-
{% for ref in page.references %}• [{{ ref.section }}](https://spec.openapis.org/oas/latest.html#{{ ref.anchor }})<br />{% endfor %}
16+
{% for ref in page.references %}• [{{ ref.section }}](https://spec.openapis.org/oas/latest.html#{{ ref.anchor }}){% if ref.parent %} ([{{ ref.parent }}](https://spec.openapis.org/oas/latest.html#{{ ref.parentAnchor }})){% endif %}{% unless forloop.last %}<br />{% endunless %}{% endfor %}
1717
{% endif %}
1818

1919
## Summary

registries/_media-type/binary.md

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,50 @@
11
---
22
owner: handrews
3-
description: Binary
3+
name: Binary
4+
description: Non-text-based media types
45
media_types:
56
- name: application/octet-stream
6-
registered: true
7+
iana: https://www.iana.org/assignments/media-types/application/octet-stream
8+
specifications:
9+
- name: RFC2045
10+
url: https://www.rfc-editor.org/rfc/rfc2045
11+
- name: RFC2046 §4.5.1
12+
url: https://www.rfc-editor.org/rfc/rfc2046#section-4.5.1
713
- name: audio/*
8-
registered: true
14+
iana: https://www.iana.org/assignments/media-types/media-types.xhtml#audio
15+
specifications:
16+
- name: RFC2045
17+
url: https://www.rfc-editor.org/rfc/rfc2045
18+
- name: RFC2046 §4.2
19+
url: https://www.rfc-editor.org/rfc/rfc2046#section-4.3
920
- name: image/*
10-
registered: true
21+
iana: https://www.iana.org/assignments/media-types/media-types.xhtml#image
22+
specifications:
23+
- name: RFC2045
24+
url: https://www.rfc-editor.org/rfc/rfc2045
25+
- name: RFC2046 §4.2
26+
url: https://www.rfc-editor.org/rfc/rfc2046#section-4.2
1127
- name: video/*
12-
registered: true
28+
iana: https://www.iana.org/assignments/media-types/media-types.xhtml#video
29+
specifications:
30+
- name: RFC2045
31+
url: https://www.rfc-editor.org/rfc/rfc2045
32+
- name: RFC2046 §4.4
33+
url: https://www.rfc-editor.org/rfc/rfc2046#section-4.4
1334
default_for: binary
1435
references:
1536
- section: Working with Binary Data
1637
anchor: working-with-binary-data
38+
parent: Working with Data
39+
parentAnchor: Working with Data
1740
- section: Binary Streams
1841
anchor: binary-streams
42+
parent: Media Type Object
43+
parentAnchor: media-type-object
44+
- section: "`Content-Transfer-Encoding` and `contentEncoding`"
45+
anchor: content-transfer-encoding-and-contentencoding
46+
parent: Encoding Object
47+
parentAnchor: encoding-object
1948
layout: default
2049
---
2150

@@ -24,7 +53,7 @@ As of OAS v3.1, binary data is modeled using an empty Schema Object, in accordan
2453
{% endcapture %}
2554

2655
{% capture remarks %}
27-
As specified in the linked reference section ("Working with Binary Data"), modeling binary data that has been encoded into a string is handled differently from raw binary data, with two variations: With an Encoding Object or with the Schema Object's `contentMediaType` and `contentEncoding`.
56+
As specified in [Working with Binary Data](https://spec.openapis.org/oas/latest.html#working-with-binary-data), modeling binary data that has been encoded into a string is handled differently from raw binary data, with two variations: With the [Schema Object](https://spec.openapis.org/oas/latest.html#schema-object)'s `contentMediaType` and `contentEncoding`, or with a `Content-Transfer-Encoding` header in the [Encoding Object](https://spec.openapis.org/oas/latest.html#encoding-object) (for media types that use Encoding Objects). Consult the specification for how these two mechanisms interact when they both apply.
2857

2958
In OAS v3.0, raw binary content was modeled as `type: string, format: binary`, while `type: string, format: byte` was used for base64-encoded binary. This was dropped in favor of JSON Schema draft 2020-12's support because it did not allow specifying the media type along with the binary encoding.
3059
{% endcapture %}

registries/_media-type/forms.md

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
11
---
22
owner: handrews
3-
description: Forms
3+
name: Forms
4+
description: Ordered name-value pairs
45
media_types:
56
- name: application/x-www-form-urlencoded
6-
registered: true
7+
iana: https://www.iana.org/assignments/media-types/application/x-www-form-urlencoded
8+
specifications:
9+
- name: WHATWG URL
10+
url: https://url.spec.whatwg.org/#application/x-www-form-urlencoded
11+
- name: HTTP 4.01 §17.13.4.1
12+
url: https://www.w3.org/TR/html401/interact/forms.html#h-17.13.4.1
13+
note: historical
14+
- name: RFC1866 §8.2.1
15+
url: https://datatracker.ietf.org/doc/html/rfc1866#section-8.2.1
16+
note: historical but cited by later RFCs and the OAS
717
- name: multipart/form-data
8-
registered: true
18+
iana: https://www.iana.org/assignments/media-types/multipart/form-data
19+
specifications:
20+
- name: RFC7578
21+
url: https://www.rfc-editor.org/rfc/rfc7578.html
922
references:
10-
- section: Encoding the x-www-form-urlencoded Media Type
11-
anchor: encoding-the-x-www-form-urlencoded-media-type
1223
- section: Encoding By Name
1324
anchor: encoding-by-name
25+
parent: Encoding Usage and Restrictions
26+
parentAnchor: encoding-usage-and-restrictions
27+
- section: Encoding the `x-www-form-urlencoded` Media Type
28+
anchor: encoding-the-x-www-form-urlencoded-media-type
29+
parent: Encoding Object
30+
parentAnchor: encoding-object
1431
- section: Encoding multipart Media Types
1532
anchor: encoding-multipart-media-types
33+
parent: Encoding Object
34+
parentAnchor: encoding-object
1635
- section: "Appendix C: Using RFC6570-Based Serialization"
1736
anchor: appendix-c-using-rfc6570-based-serialization
1837
- section: "Appendix E: Percent-Encoding and Form Media Types"
@@ -25,10 +44,12 @@ Web-style form data consists of name-value pairs, with duplicate names allowed,
2544
{% endcapture %}
2645

2746
{% capture remarks %}
28-
Both form media types use the Encoding Object to map object properties from schema-ready data structures to name-value pairs, with special rules for arrays causing each array value to be treated as a separate pair with the same name.
47+
Both form media types use the [Encoding Object](https://spec.openapis.org/oas/latest.html#encoding-object) to map object properties from schema-ready data structures to name-value pairs, with special rules for arrays causing each array value to be treated as a separate pair with the same name.
2948
While the ordering of pairs is significant in these formats, the OAS does not (as of v3.2) provide a way to control such ordering.
3049

31-
As of OAS v3.2, endpoint URL query strings can be modeled as a media type using `in: querystring` in the Parameter Object. The query string can also be modeled using multiple `in: query` Parameter Objects through mechanisms similar to the Encoding Object.
50+
As of OAS v3.2, endpoint URL query strings can be modeled as a media type using `in: querystring` in the [Parameter Object](https://spec.openapis.org/oas/latest.html#parameter-object). The query string can also be modeled using multiple `in: query` Parameter Objects through mechanisms similar to the Encoding Object.
51+
52+
Note that URL-encoded forms have been defined by different standards organizations at different times, leading to inconsistencies regarding percent-encoding in later standards and implementations; this is addressed in detail in [Appendix E](https://spec.openapis.org/oas/latest.html#appendix-e-percent-encoding-and-form-media-types).
3253
{% endcapture %}
3354

3455
{% include media-type-entry.md summary=summary remarks=remarks %}

registries/_media-type/linksets.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
11
---
22
owner: handrews
3-
description: Link Sets
3+
name: Link Sets
4+
description: Sets of RFC8288 Web Links
45
media_types:
56
- name: application/linkset
6-
registered: true
7+
iana: https://www.iana.org/assignments/media-types/application/linkset
8+
specifications:
9+
- name: RFC9264
10+
url: https://www.rfc-editor.org/rfc/rfc9264
11+
- name: RFC8288
12+
url: https://www.rfc-editor.org/rfc/rfc8288
713
- name: application/linkset+json
8-
registered: true
14+
iana: https://www.iana.org/assignments/media-types/application/linkset+json
15+
specifications:
16+
- name: RFC9264
17+
url: https://www.rfc-editor.org/rfc/rfc9264
918
references:
1019
- section: Modeling Link Headers
1120
anchor: modeling-link-headers
21+
parent: Header Object
22+
parentAnchor: header-object
1223
layout: default
1324
---
1425

@@ -18,7 +29,7 @@ The JSON form for linksets is used to define the schema-ready data form for mode
1829

1930
{% capture remarks %}
2031
In addition to modeling the `Link` header, these two media types are supported anywhere else a media type document is allowed.
21-
In all cases, the `application/linkset+json` data model is used with the Schema Object, with the choice of the parent key for the Media Type Object (with or without `+json`) determining only the serialization.
32+
In all cases, the `application/linkset+json` data model is used with the [Schema Object](https://spec.openapis.org/oas/latest.html#schema-object), with the choice of the parent key for the [Media Type Object](https://spec.openapis.org/oas/latest.html#media-type-object) (with or without `+json`) determining only the serialization.
2233
{% endcapture %}
2334

2435
{% include media-type-entry.md summary=summary remarks=remarks %}

registries/_media-type/sequential_json.md

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,38 @@
11
---
22
owner: handrews
3-
description: Sequential JSON
3+
name: Sequential JSON
4+
description: Multiple concatenated JSON documents suitable for streaming
45
media_types:
56
- name: application/jsonl
67
registered: false
8+
specifications:
9+
- name: JSON Lines
10+
url: https://jsonlines.org/
11+
- name: application/json-seq
12+
registered: https://www.iana.org/assignments/media-types/application/json-seq
13+
specifications:
14+
- name: RFC7464
15+
url: https://www.rfc-editor.org/rfc/rfc7464
16+
- name: RFC8091
17+
url: https://www.rfc-editor.org/rfc/rfc8091
718
- name: application/x-ndjson
819
registered: false
9-
- name: application/json-seq
10-
registered: true
20+
specifications:
21+
- name: Newline Delimited JSON
22+
url: https://github.com/ndjson/ndjson-spec
1123
references:
1224
- section: Sequential Media Types
1325
anchor: sequential-media-types
26+
parent: Media Types
27+
parentAnchor: media-types
1428
- section: Streaming Sequential Media Types
1529
anchor: streaming-sequential-media-types
16-
- section: Sequential JSON (examples)
30+
parent: Media Type Object
31+
parentAnchor: media-type-object
32+
- section: Sequential JSON
1733
anchor: sequential-json
34+
parent: Media Type Examples
35+
parentAnchor: media-type-examples
1836
layout: default
1937
---
2038

registries/_media-type/sequential_multipart.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,50 @@
11
---
22
owner: handrews
3-
description: Sequential Multipart
3+
name: Sequential Multipart
4+
description: Multipart subtypes with unnamed parts
45
media_types:
56
- name: multipart/*
6-
registered: true
7+
iana: https://www.iana.org/assignments/media-types/media-types.xhtml#multipart
8+
specifications:
9+
- name: RFC2045
10+
url: https://www.rfc-editor.org/rfc/rfc2045
11+
- name: RFC2046 §5.1
12+
url: https://www.rfc-editor.org/rfc/rfc2046#section-5.1
713
- name: multipart/mixed
8-
registered: true
14+
iana: https://www.iana.org/assignments/media-types/multipart/mixed
15+
specifications:
16+
- name: RFC2045
17+
url: https://www.rfc-editor.org/rfc/rfc2045
18+
- name: RFC2046 §5.1.3
19+
url: https://www.rfc-editor.org/rfc/rfc2046#section-5.1.3
920
- name: multipart/alternative
10-
registered: true
21+
iana: https://www.iana.org/assignments/media-types/multipart/alternative
22+
specifications:
23+
- name: RFC2045
24+
url: https://www.rfc-editor.org/rfc/rfc2045
25+
- name: RFC2046 §5.1.4
26+
url: https://www.rfc-editor.org/rfc/rfc2046#section-5.1.4
1127
- name: multipart/related
12-
registered: true
28+
iana: https://www.iana.org/assignments/media-types/multipart/related
29+
specifications:
30+
- name: RFC2389
31+
url: https://www.rfc-editor.org/rfc/rfc2389
32+
- name: RFC2557
33+
url: https://www.rfc-editor.org/rfc/rfc2557
1334
- name: multipart/byteranges
14-
registered: true
35+
iana: https://www.iana.org/assignments/media-types/multipart/byteranges
36+
specifications:
37+
- name: RFC9110 §14.6
38+
url: https://www.rfc-editor.org/rfc/rfc9110#name-media-type-multipart-bytera
1539
references:
1640
- section: Encoding By Position
1741
anchor: encoding-by-position
18-
- section: Encoding multipart Media Types
42+
parent: Encoding Usage and Restrictions
43+
parentAnchor: encoding-usage-and-restrictions
44+
- section: Encoding `multipart` Media Types
1945
anchor: encoding-multipart-media-types
46+
parent: Encoding Object
47+
parentAnchor: encoding-object
2048
layout: default
2149
---
2250

registries/_media-type/sse.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,28 @@
11
---
22
owner: handrews
3-
description: Server-Sent Events
3+
name: Server-Sent Events
4+
description: Event streams for SSE
45
media_types:
56
- name: text/event-stream
6-
registered: false
7+
iana: false
8+
specifications:
9+
- name: WHATWG HTML §Server-Sent Events
10+
url: https://html.spec.whatwg.org/multipage/server-sent-events.html#parsing-an-event-stream
11+
- name: WHATWG HTML §IANA
12+
url: https://html.spec.whatwg.org/multipage/iana.html#text/event-stream
713
references:
814
- section: Sequential Media Types
915
anchor: sequential-media-types
16+
parent: Media Types
17+
parentAnchor: media-types
1018
- section: Special Considerations for `text/event-stream` Content
1119
anchor: special-considerations-for-text-event-stream-conten
12-
- section: Server-Sent Event Streams (example)
20+
parent: Media Type Object
21+
parentAnchor: media-type-object
22+
- section: Server-Sent Event Stream
1323
anchor: server-sent-event-streams
24+
parent: Media Type Examples
25+
parentAnchor: media-type-examples
1426
layout: default
1527
---
1628

registries/_media-type/text.md

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,22 @@
11
---
22
owner: handrews
3-
description: Text
3+
name: Text
4+
description: Text-based media types
45
media_types:
56
- name: text/*
6-
registered: true
7+
iana: https://www.iana.org/assignments/media-types/media-types.xhtml#text
8+
specifications:
9+
- name: RFC2045
10+
url: https://www.rfc-editor.org/rfc/rfc2045
11+
- name: RFC2046 §4.1
12+
url: https://www.rfc-editor.org/rfc/rfc2046#section-4.1
713
- name: text/plain
8-
registered: true
14+
iana: https://www.iana.org/assignments/media-types/text/plain
15+
specifications:
16+
- name: RFC2046 §4.1.3
17+
url: https://www.rfc-editor.org/rfc/rfc2046#section-4.1.3
18+
- name: RFC3676
19+
url: https://www.rfc-editor.org/rfc/rfc3676
920
default_for: text-based (not just <tt>text/*</tt>)
1021
references:
1122
- section: Parameter Object
@@ -27,7 +38,7 @@ A plain text document is modeled as a single string.
2738
In addition to normal use as HTTP message contents or `multipart` parts, `text/plain` is useful with the `content` field of the Parameter Object or Header Object to work around the automatic percent-encoding triggered by the use of the `schema` field.
2839
In particular, cookies with multiple values are not well-served by `style: form` and are better modeled as text.
2940

30-
Note that unlike JSON strings, the contents of the string representing the plain text are not quoted when serializing to a document. While a Schema Object of `{type: string, const: foo}` for JSON validates the JSON value `"foo"`, for plain text it validates `foo`, without quotes.
41+
Note also that unlike JSON strings, the contents of the string representing the plain text are not quoted when serializing to a document. While a Schema Object of `{type: string, const: foo}` for JSON validates the JSON value `"foo"`, for plain text it validates `foo`, without quotes.
3142
{% endcapture %}
3243

3344
{% include media-type-entry.md summary=summary remarks=remarks %}

registries/_media-type/xml.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,28 @@
11
---
22
owner: handrews
3-
description: XML
3+
name: XML
4+
description: Extensible markup language
45
media_types:
56
- name: application/xml
6-
registered: true
7+
iana: https://www.iana.org/assignments/media-types/application/xml
8+
specifications:
9+
- name: RFC7303
10+
url: https://www.rfc-editor.org/rfc/rfc7303
11+
- name: XML 1.0
12+
url: https://www.w3.org/TR/xml/
13+
note: commonly used
14+
- name: XML 1.1
15+
url: https://www.w3.org/TR/xml11/
16+
note: rarely used
17+
- name: WHATWG DOM
18+
url: https://dom.spec.whatwg.org/
719
references:
820
- section: XML Object
921
anchor: xml-object
1022
- section: XML Modeling
1123
anchor: xml-modeling
24+
parent: Schema Object
25+
parentAnchor: schema-object
1226
layout: default
1327
---
1428

@@ -17,7 +31,7 @@ XML is modeled using the OAS's `xml` extension keyword for JSON Schema, which ha
1731
{% endcapture %}
1832

1933
{% capture remarks %}
20-
As of OAS v3.2, the XML Object uses the `nodeType` field to determine the type of [interface node](https://dom.spec.whatwg.org/#interface-node) to which a given Schema Object corresponds: `element`, `attribute`, `text`, `cdata`, or `none`. If `nodeType` is set to `none`, a Schema Object does not correspond to anything and the nodes corresponding to its immediate subschemas are placed directly under the node of its parent schema.
34+
As of OAS v3.2, the [XML Object](https://spec.openapis.org/oas/latest.html#xml-object) uses the `nodeType` field to determine the type of [interface node](https://dom.spec.whatwg.org/#interface-node) to which a given Schema Object corresponds: `element`, `attribute`, `text`, `cdata`, or `none`. If `nodeType` is set to `none`, a Schema Object does not correspond to anything and the nodes corresponding to its immediate subschemas are placed directly under the node of its parent schema.
2135

2236
Certain behaviors are retained for compatibility with OAS v3.1, including implicit text nodes for elements with a primitive type, and somewhat complex rules for the default value of `nodeType`.
2337
In OAS v3.1 and earlier, only elements, their implicit primitive-type text nodes, and attributes were supported, with the now-deprecated `attribute` and `wrapped` flags as controls.

0 commit comments

Comments
 (0)