Internet-Draft | REST API Media Types | October 2024 |
Polli | Expires 16 April 2025 | [Page] |
This document registers the following media types used in APIs on the IANA Media Types registry: application/openapi+json, and application/openapi+yaml.¶
This note is to be removed before publishing as an RFC.¶
Status information for this document may be found at https://datatracker.ietf.org/doc/draft-ietf-httpapi-rest-api-mediatypes/.¶
Discussion of this document takes place on the HTTPAPI Working Group mailing list (mailto:httpapi@ietf.org), which is archived at https://mailarchive.ietf.org/arch/browse/httpapi/. Subscribe at https://www.ietf.org/mailman/listinfo/httpapi/. Working Group information can be found at https://datatracker.ietf.org/wg/httpapi/about/.¶
Source for this draft and an issue tracker can be found at https://github.com/ietf-wg-httpapi/mediatypes/labels/rest-api.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 16 April 2025.¶
Copyright (c) 2024 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
OpenAPI Specification [OAS] version 3 and above is a consolidated standard for describing HTTP APIs using the JSON [JSON] and YAML [YAML] data format.¶
To increase interoperability when processing API descriptions
and leverage content negotiation mechanisms when exchanging
OpenAPI description representations
this specification registers the following media types:
application/openapi+json
and application/openapi+yaml
.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here. These words may also appear in this document in lower case as plain English words, absent their normative meanings.¶
This document uses the Augmented BNF defined in [RFC5234] and updated by [RFC7405].¶
The terms "content", "content negotiation", "resource", and "user agent" in this document are to be interpreted as in [HTTP].¶
This section describes the information required to register the above media types according to [MEDIATYPE].¶
The OpenAPI Specification Media Types convey semantics for OpenAPI Document (OAD) resources as defined in [OAS] for version 3.0 and above.¶
Those resources can be represented in [JSON] or [YAML].
Since there are multiple OpenAPI Specification versions,
those media types support the version
parameter.¶
The following example conveys the desire of a client to receive an OpenAPI Document resource based on the stated preferences:¶
Accept: application/openapi+yaml;version=3.1, application/openapi+yaml;version=3.0;q=0.5, application/openapi+json;q=0.3¶
The following information serves as the registration form for the application/openapi+json
media type.¶
application¶
openapi+json¶
None¶
version; unrecognized parameters should be ignored¶
Same as "application/json"¶
See Section 4 of this document, "application/json" and [OAS]¶
HTTP¶
Additional information:¶
The following information serves as the registration form for the application/openapi+yaml
media type.¶
application¶
openapi+yaml¶
N/A¶
version; unrecognized parameters should be ignored¶
Same as "+yaml" Structured Syntax Suffix¶
See Section 4 of this document, "+yaml" Structured Syntax Suffix and [OAS]¶
HTTP¶
Additional information:¶
Interoperability requirements for media type registrations are discussed in Section 4.6 of [MEDIATYPE]. and in the Interoperability Considerations of the "+yaml" Structured Syntax Suffix.¶
Security requirements for media type registrations are discussed in Section 4.6 of [MEDIATYPE]. and in the Security Considerations of the "+yaml" Structured Syntax Suffix.¶
OpenAPI documents are processed by a wide variety of tooling for numerous different purposes, such as client code generation, documentation generation, server side routing, and API testing. OpenAPI document authors must consider the risks of the scenarios where the OpenAPI document may be used.¶
An OpenAPI document describes the security schemes used to protect the resources it defines. The security schemes available offer varying degrees of protection. Factors such as the sensitivity of the data and the potential impact of a security breach should guide the selection of security schemes for the API resources. Some security schemes, such as basic auth and OAuth Implicit flow, are supported for compatibility with existing APIs. However, their inclusion in OpenAPI does not constitute an endorsement of their use, particularly for highly sensitive data or operations.¶
OpenAPI documents 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. References in an OpenAPI document, or across OpenAPI documents may cause a cycle. Tooling must detect and handle cycles to prevent resource exhaustion.¶
Certain properties allow the use of Markdown which can contain HTML including script. It is the responsibility of tooling to appropriately sanitize the Markdown.¶
OpenAPI documents use [jsonschema] therefore share the security consideration of JSON Schema.¶
This specification defines the following new Internet media types [MEDIATYPE].¶
IANA is asked to update the "Media Types" registry at https://www.iana.org/assignments/media-types with the registration information provided in the sections below.¶
Media Type | Registration information section |
---|---|
application/openapi+yaml | Section 2.1.2 of this document |
application/openapi+json | Section 2.1.1 of this document |
Thanks to Erik Wilde and David Biesack for being the initial contributors of this specification, and to Darrel Miller and Rich Salz for their support during the adoption phase.¶
In addition to the people above, this document owes a lot to the extensive discussion inside and outside the HTTPAPI workgroup. The following contributors have helped improve this specification by opening pull requests, reporting bugs, asking smart questions, drafting or reviewing text, and evaluating open issues:¶
Austin Wright, Ben Hutton and Jason Desrosiers.¶
This section is to be removed before publishing as an RFC.¶
After all these years, we still lack a proper media type for REST related document types. This has some security implications too (eg. wrt on identifying parsers or treat downloads)¶