-
Notifications
You must be signed in to change notification settings - Fork 89
Prepare documentation additions for the 3.2 release #137
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
de68530
Add some notes and upgrade pages for the 3.2 release
lornajane 4d0efaf
Apply suggestions from code review
lornajane bd3c10c
Update specification/parameters.md
lornajane 316b49d
Add discriminator and some other pull request feedback
lornajane 6112d7d
Update upgrading/v3.0-to-v3.1.md
lornajane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
--- | ||
layout: default | ||
nav_order: 8 | ||
nav_order: 9 | ||
title: Overlays | ||
has_children: true | ||
has_toc: false | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
--- | ||
layout: default | ||
title: Using References | ||
nav_order: 5 | ||
nav_order: 7 | ||
has_children: true | ||
has_toc: false | ||
--- | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
--- | ||
layout: default | ||
title: HTTP Methods | ||
parent: The OpenAPI Specification Explained | ||
nav_order: 10 | ||
--- | ||
|
||
# HTTP Methods | ||
|
||
OpenAPI supports describing operations using HTTP methods. This page covers the standard HTTP methods available in all OpenAPI versions, and the enhanced method support introduced in OpenAPI 3.2. | ||
|
||
## Standard HTTP Methods (All Versions) | ||
|
||
OpenAPI has always supported standard HTTP methods as operation keys in path items: | ||
|
||
```yaml | ||
paths: | ||
/users: | ||
get: # Retrieve users | ||
summary: List users | ||
responses: | ||
'200': | ||
description: User list | ||
post: # Create user | ||
summary: Create a new user | ||
responses: | ||
'201': | ||
description: User created | ||
put: # Replace user collection | ||
summary: Replace all users | ||
delete: # Delete users | ||
summary: Delete all users | ||
options: # Get allowed methods | ||
summary: Get allowed methods for users endpoint | ||
head: # Get headers only | ||
summary: Get user list headers | ||
patch: # Update users | ||
summary: Update users | ||
trace: # Diagnostic trace | ||
summary: Trace users endpoint | ||
``` | ||
Each method corresponds to a specific HTTP verb and follows REST conventions for the expected behavior. | ||
## Enhanced HTTP Method Support in OpenAPI 3.2 | ||
### QUERY Method Support | ||
{: .d-inline-block } | ||
OpenAPI 3.2+ | ||
{: .label .label-green } | ||
OpenAPI 3.2 adds native support for the [QUERY HTTP method](https://www.ietf.org/archive/id/draft-ietf-httpbis-safe-method-w-body-11.html), designed for complex queries that don't fit in URL query strings. | ||
### QUERY Method Example | ||
```yaml | ||
# OpenAPI 3.2 | ||
paths: | ||
/products: | ||
query: | ||
summary: Advanced product search | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
filter: | ||
type: object | ||
sort: | ||
type: array | ||
items: | ||
type: string | ||
responses: | ||
'200': | ||
description: Search results | ||
``` | ||
### Additional Operations for Custom Methods | ||
{: .d-inline-block } | ||
OpenAPI 3.2+ | ||
{: .label .label-green } | ||
Use `additionalOperations` for HTTP methods not covered by standard OpenAPI operations: | ||
|
||
### Additional Operations Example | ||
|
||
Add the method names in upper case, any supported HTTP method name can be used. | ||
|
||
```yaml | ||
# OpenAPI 3.2 | ||
paths: | ||
/documents/{id}: | ||
additionalOperations: | ||
LINK: | ||
summary: Link related documents | ||
parameters: | ||
- name: id | ||
in: path | ||
required: true | ||
schema: { type: string } | ||
requestBody: | ||
required: true | ||
content: | ||
application/json: | ||
schema: | ||
type: object | ||
properties: | ||
targetDocument: | ||
type: string | ||
relationship: | ||
type: string | ||
responses: | ||
'204': | ||
description: Link created successfully | ||
``` | ||
|
||
This approach makes it easier to adopt new methods as the HTTP landscape evolves. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
--- | ||
layout: default | ||
title: Sequential Media Types | ||
parent: The OpenAPI Specification Explained | ||
nav_order: 11 | ||
--- | ||
|
||
# Sequential Media Types | ||
{: .d-inline-block } | ||
OpenAPI 3.2+ | ||
{: .label .label-green } | ||
|
||
OpenAPI 3.2 introduces support for sequential and streaming media types, enabling description of data streams where individual items arrive over time. | ||
|
||
## New Schema Field: itemSchema | ||
|
||
The key addition is the `itemSchema` field, which describes the structure of a repeated item in a response: | ||
|
||
```yaml | ||
# OpenAPI 3.2 | ||
responses: | ||
'200': | ||
description: Stream of updates | ||
content: | ||
text/event-stream: | ||
itemSchema: | ||
type: object | ||
properties: | ||
id: { type: string } | ||
data: { type: object } | ||
``` | ||
|
||
## Supported Sequential Media Types | ||
|
||
OpenAPI 3.2 adds support for several streaming formats: | ||
|
||
- **Server-Sent Events**: `text/event-stream` | ||
- **JSON Lines**: `application/jsonl` | ||
- **JSON Sequences**: `application/json-seq` | ||
- **Multipart Mixed**: `multipart/mixed` | ||
|
||
## Enhanced Multipart Support | ||
|
||
OpenAPI 3.2 introduces new encoding fields for multipart content: | ||
|
||
### itemEncoding | ||
|
||
Applies encoding to each item in a sequence: | ||
|
||
```yaml | ||
# OpenAPI 3.2 | ||
content: | ||
multipart/form-data: | ||
itemEncoding: | ||
file: | ||
contentType: application/octet-stream | ||
``` | ||
|
||
### prefixEncoding | ||
|
||
Specifies encoding for items by position: | ||
|
||
```yaml | ||
# OpenAPI 3.2 | ||
content: | ||
multipart/mixed: | ||
prefixEncoding: | ||
- contentType: application/json | ||
- contentType: text/html | ||
``` | ||
|
||
Sequential media type support in OpenAPI 3.2 enables documentation of streaming and real-time APIs using the `itemSchema` field to describe individual items in data streams. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,7 @@ The OAS structure is long and complex so this section just describes the minimal | |
The root object in any OpenAPI Description is the [OpenAPI Object](https://spec.openapis.org/oas/v3.1.0#openapi-object), and only two of its fields are mandatory: `openapi` and `info`. Additionally, at least one of `paths`, `components` and `webhooks` is required. | ||
|
||
* `openapi` (**string**): This indicates the version of the OAS this OAD is using, e.g. "3.1.0". Using this field tools can check that the description correctly adheres to the specification. | ||
* `$self` (**string**, OpenAPI 3.2+): Provides the canonical URI for the document itself, used as the base URI for resolving relative references. This field is optional. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another optional clarification but this one is more tenuous. "used as the base URI for resolving relative references, and for humans understanding uniquely defined API descriptions". |
||
* `info` ([Info Object](https://spec.openapis.org/oas/v3.1.0#info-object)): This provides general information about the API (like its description, author and contact information) but the only mandatory fields are `title` and `version`. | ||
* `title` (**string**): A human-readable name for the API, like "GitHub REST API", useful to keep API collections organized. | ||
* `version` (**string**): Indicates the version **of the API description** (not to be confused with the OAS version above). Tools can use this field to generate code that ensures that clients and servers are interacting through the same version of the API, for example. | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.