Skip to content

Commit e9b8f63

Browse files
authored
Deprecate relaxed variants of media types (#1966)
* Deprecate the relaxed variants of JSON:API media type extensions, now that both NSwag and Kiota can handle media types containing double quotes * Revert removal of relaxed media type in tests to maintain code coverage
1 parent dc50f7f commit e9b8f63

File tree

219 files changed

+3051
-3114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

219 files changed

+3051
-3114
lines changed

docs/ext/openapi/index.md

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# JSON:API Extension for OpenAPI
22

3-
This extension facilitates using OpenAPI client generators targeting JSON:API documents.
3+
This extension facilitates the use of OpenAPI client generators targeting JSON:API documents.
44

55
In JSON:API, a resource object contains the `type` member, which defines the structure of nested [attributes](https://jsonapi.org/format/#document-resource-object-attributes) and [relationships](https://jsonapi.org/format/#document-resource-object-relationships) objects.
66
While OpenAPI supports such constraints using `allOf` inheritance with a discriminator property for the `data` member,
@@ -11,30 +11,10 @@ This extension addresses that limitation by defining additional discriminator pr
1111
## URI
1212

1313
This extension has the URI `https://www.jsonapi.net/ext/openapi`.
14-
Because code generators often choke on the double quotes in `Accept` and `Content-Type` HTTP header values, a relaxed form is also permitted: `openapi`.
1514

16-
For example, the following `Content-Type` header:
17-
18-
```http
19-
Content-Type: application/vnd.api+json; ext="https://www.jsonapi.net/ext/openapi"
20-
```
21-
22-
is equivalent to:
23-
24-
```http
25-
Content-Type: application/vnd.api+json; ext=openapi
26-
```
27-
28-
To avoid the need for double quotes when multiple extensions are used, the following relaxed form can be used:
29-
30-
```http
31-
Content-Type: application/vnd.api+json; ext=openapi; ext=atomic
32-
```
33-
34-
> [!NOTE]
35-
> The [base specification](https://jsonapi.org/format/#media-type-parameter-rules) *forbids* the use of multiple `ext` parameters
36-
> and *requires* that each extension name must be a URI.
37-
> This extension relaxes both constraints for practical reasons, to workaround bugs in client generators that produce broken code otherwise.
15+
> [!CAUTION]
16+
> Early preview versions of this specification also permitted using `openapi` instead of the URI to work around bugs in client generators.
17+
> This is no longer supported and is not part of the final version.
3818
3919
## Namespace
4020

@@ -55,7 +35,7 @@ in [attributes](https://jsonapi.org/format/#document-resource-object-attributes)
5535

5636
* `openapi:discriminator` - A string that MUST be identical to the `type` member in the containing [resource object](https://jsonapi.org/format/#document-resource-objects).
5737

58-
Here's how an article (i.e. a resource of type "articles") might appear in a document:
38+
Here's how an article (a resource of type "articles") might appear in a document:
5939

6040
```json
6141
{
@@ -81,7 +61,7 @@ Here's how an article (i.e. a resource of type "articles") might appear in a doc
8161
In addition to the members allowed by the [Atomic Operations extension](https://jsonapi.org/ext/atomic/),
8262
the following member MAY be included in elements of an `atomic:operations` array:
8363

84-
* `openapi:discriminator` - A free-format string to facilitate generation of client code.
64+
* `openapi:discriminator` - A free-format string to facilitate the generation of client code.
8565

8666
For example:
8767

0 commit comments

Comments
 (0)