Skip to content

Introduce Profiles to v1.1 #1268

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 30 commits into from
Sep 18, 2018
Merged
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
9c0b91b
Introduce Profiles to v1.1
dgeb Apr 12, 2018
3f4220f
profiles: tweak definitions a bit
ethanresnick Apr 17, 2018
7533232
profiles: add should about extensibility
ethanresnick Apr 17, 2018
8b51551
profiles: add note about how to serialize space-separated media type …
ethanresnick Apr 17, 2018
fe660ec
profiles: make it a MUST to list the applied profiles in Content-Type
ethanresnick Apr 17, 2018
510e783
profiles: clarify role of profile in `Accept` per prior convos
ethanresnick Apr 17, 2018
36f4c0a
profiles: clarify that `Accept` may be totally ignored
ethanresnick Apr 17, 2018
4085f31
profiles: add example of using Accept to request profile
ethanresnick Apr 17, 2018
e08d3ce
profiles: clarify that keywords must be valid member names
ethanresnick Apr 17, 2018
67ff7f1
profiles: clarify evolution requriments
ethanresnick Apr 17, 2018
51d0be6
profiles: add note about 415 handling from 1.0 servers
ethanresnick Apr 17, 2018
1827986
Add top-level links.profile
ethanresnick Apr 30, 2018
eb2e815
Fix typo and trailing whitespace
dgeb Jul 1, 2018
e0397c2
Use the term `profile` in example (instead of `ext`)
dgeb Jul 1, 2018
7221b18
Clarify that links can specify URIs, not just URLs
dgeb Jul 13, 2018
18b590e
Replace all usages of jsonapi/profiles with links/profile
dgeb Jul 13, 2018
661ddbc
Profiles: fix broken links
ethanresnick Jul 22, 2018
e1232a9
profiles: remove overloaded uses of term "alias"
ethanresnick Jul 22, 2018
1e448f8
profiles: editorial/terminology cleanup/tweaks
ethanresnick Jul 27, 2018
9be7013
profiles: define what a profile is
ethanresnick Jul 27, 2018
7757134
profiles: add must-ignore rule to example timestamps profile
ethanresnick Jul 27, 2018
055a41f
profiles: create separate authoring section
ethanresnick Jul 27, 2018
3599821
profiles: add new minimal extra authoring rules
ethanresnick Jul 27, 2018
7f9eb81
profiles: editorial tweaks
ethanresnick Aug 28, 2018
e151c57
profiles: define handling of unrecognized values
ethanresnick Aug 29, 2018
e666c90
proflies: document extensibility concerns/requirements
ethanresnick Aug 29, 2018
db1e970
profile: define implicit profile query param value
ethanresnick Sep 18, 2018
61ccdff
profiles: clarify shallow definition of elements
ethanresnick Sep 18, 2018
ebae1b5
profiles: small cleanup
ethanresnick Sep 18, 2018
f8770df
profiles: fix profile param value inference
ethanresnick Sep 18, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add top-level links.profile
  • Loading branch information
ethanresnick committed Apr 30, 2018
commit 1827986397445ba799f161d9949cc9df6e2bc56a
41 changes: 32 additions & 9 deletions _format/1.1/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ version: 1.1
## <a href="#introduction" id="introduction" class="headerlink"></a> Introduction

JSON API is a specification for how a client should request that resources be
fetched or modified, and how a server should respond to those requests.
fetched or modified, and how a server should respond to those requests. JSON API
can also be easily extended with [profiles].

JSON API is designed to minimize both the number of requests and the amount of
data transmitted between clients and servers. This efficiency is achieved
Expand Down Expand Up @@ -110,6 +111,8 @@ The top-level [links object][links] **MAY** contain the following members:
* `self`: the [link][links] that generated the current response document.
* `related`: a [related resource link] when the primary data represents a
resource relationship.
* `profile`: an array of [links][link], each giving the URI of a
[profile][profiles] in use in the document.
* [pagination] links for the primary data.

The document's "primary data" is a representation of the resource or collection
Expand Down Expand Up @@ -517,10 +520,10 @@ For example:
### <a href="#document-links" id="document-links" class="headerlink"></a> Links

Where specified, a `links` member can be used to represent links. The value
of each `links` member **MUST** be an object (a "links object").
of this member **MUST** be an object (a "links object").

Each member of a links object is a "link". A link **MUST** be represented as
either:
<a href="#document-links-link" id="document-links-link"></a>
Within this object, a link **MUST** be represented as either:

* a string containing the link's URL.
* <a id="document-links-link-object"></a>an object ("link object") which can
Expand All @@ -529,16 +532,20 @@ either:
* `meta`: a meta object containing non-standard meta-information about the
link.

The following `self` link is simply a URL:
Except for the `profile` key, each key present in a links object **MUST** have
a single link as its value. The `profile` key, if present, **MUST** hold an
array of links.

For example, the following `self` link is simply a URL:

```json
"links": {
"self": "http://example.com/posts"
}
```

The following `related` link includes a URL as well as meta-information
about a related resource collection:
By contrast, the following `related` link includes a URL as well as
meta-information about a related resource collection:

```json
"links": {
Expand All @@ -551,6 +558,14 @@ about a related resource collection:
}
```

Here, the `profile` key specifies an array of `profile` links:

```json
"links": {
"profile": [{ "href": "http://jsonapi.org/ext/example-ext" }]
}
```

> Note: Additional members may be specified for links objects and link
objects in the future. It is also possible that the allowed values of
additional members will be expanded (e.g. a `collection` link may support an
Expand Down Expand Up @@ -1852,7 +1867,7 @@ Profiles **SHOULD** reserve at least one object-valued member, and **SHOULD**
consider reserving an object-valued member anywhere they expect to potentially
add new features over time.

> Note: hen a profile changes its URI, a huge amount of interoperability is lost.
> Note: When a profile changes its URI, a huge amount of interoperability is lost.
> Users that reference the new URI will have their messages not understood by
> implementations still aware only of the old URI, and vice-versa.
> Accordingly, the advice above is aimed at allowing profifiles to grow
Expand All @@ -1872,7 +1887,7 @@ All profile keywords **MUST** meet this specification's requirements for [member

The `profile` media type parameter is used to describe the application of
one or more profiles to the JSON API media type. The value of the `profile`
parameter **MUST** equal a whitespace-separated list of profile URIs.
parameter **MUST** equal a space-separated (U+0020 SPACE, " ") list of profile URIs.

> Note: When serializing the `profile` media type parameter, the HTTP
> specification requires that its value be surrounded by quotation marks
Expand Down Expand Up @@ -1906,6 +1921,11 @@ Clients and servers **MUST** include the `profile` media type parameter in
conjunction with the JSON API media type in a `Content-Type` header to indicate
that they have applied one or more profiles to a JSON API document.

Likewise, clients and servers applying profiles to a JSON API document **MUST**
include a [top-level][top level] [`links` object][links] with a `profile` key,
and that `profile` key **MUST** include a [link] to the URI of each profile
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When no profiles are specified in the request document, but they are specified in the Content-Type request header or the profile URL query parameter, should a 400 error response be sent?

IOW: are JSON API documents in request bodies required to match the Content-Type and/or profile URL query argument?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On second thought, I don't think this makes sense, because it's already valid to just send

{
  "data": { … }
}

Because http://jsonapi.org/format/#document-top-level already says that only one of data, errors and meta is a MUST-have.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When no profiles are specified in the request document, but they are specified in the Content-Type request header or the profile URL query parameter, should a 400 error response be sent?

This is a good point. I think we want to say that, on requests, if the profiles listed in Content-Type don't match those listed in the document body, the server should return a 400.

On second thought, I don't think this makes sense, because it's already valid to just send

I don't think that prevents us from requiring a 400 in this case, because none of the requests that are valid today will contain profile in the Content-Type.

that has been applied.

When an older JSON API server that doesn't support the `profile` media type
parameter receives a document with one or more profiles, it will respond with a
`415 Unsupported Media Type` error.
Expand Down Expand Up @@ -2025,6 +2045,7 @@ An error object **MAY** have the following members:
* `meta`: a [meta object][meta] containing non-standard meta-information about the
error.

[top level]: #document-top-level
[resource objects]: #document-resource-objects
[attributes]: #document-resource-object-attributes
[relationships]: #document-resource-object-relationships
Expand All @@ -2036,6 +2057,8 @@ An error object **MAY** have the following members:
[compound document]: #document-compound-documents
[meta]: #document-meta
[links]: #document-links
[profiles]: #profiles
[error details]: #errors
[error objects]: #errror-objects
[member names]: #document-member-names
[pagination]: #fetching-pagination
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy