Skip to content

Attributes of relationships #415 #431

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

Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Attributes of relationships #415 #431: terminology
  • Loading branch information
hhware committed Apr 7, 2015
commit 73154139da1d36d91f4db96b9693974ecbdaf166
10 changes: 5 additions & 5 deletions extensions/jsonpatch/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ operations allowed in this top level array.
### Request URLs and Patch Paths <a href="#patch-urls" id="patch-urls" class="headerlink"></a>

The request URL and each Patch operation's `"path"` are complementary and
**MUST** combine to target a particular resource, collection, attribute, or
**MUST** combine to target a particular resource, collection, resource attribute, or
relationship.

If a server supports the Patch extension, it **MUST** allow Patch operations at
Expand Down Expand Up @@ -65,9 +65,9 @@ Accept: application/vnd.api+json; ext=jsonpatch
]
```

### Updating Attributes <a href="#patch-updating-attributes" id="patch-updating-attributes" class="headerlink"></a>
### Updating Resource Attributes <a href="#patch-updating-attributes" id="patch-updating-attributes" class="headerlink"></a>

To update an attribute, perform a `"replace"` operation with the attribute's
To update a resource attribute, perform a `"replace"` operation with the attribute's
name specified by the `"path"`.

For instance, the following request should update just the `src` property of the
Expand Down Expand Up @@ -227,8 +227,8 @@ Accept: application/vnd.api+json; ext=jsonpatch
#### 204 No Content <a href="#patch-responses-204" id="patch-responses-204" class="headerlink"></a>

A server **MUST** return a `204 No Content` status code in response to a
successful Patch operation in which the client's current attributes remain up to
date.
successful Patch operation in which the client's current resource attributes
remain up to date.

#### 200 OK <a href="#patch-responses-200" id="patch-responses-200" class="headerlink"></a>

Expand Down
44 changes: 24 additions & 20 deletions format/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ In addition, a resource object **MAY** contain any of these top-level members:
* `"links"`: a "links object", providing information about a resource's
relationships (described below).
* `"meta"`: non-standard meta-information about a resource that can not be
represented as an attribute or relationship.
represented as a [resource attribute] or relationship.

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

Expand All @@ -182,26 +182,26 @@ Here's how an article (i.e. a resource of type "articles") might appear in a doc
// ...
```

#### Attributes <a href="#document-structure-resource-object-attributes" id="document-structure-resource-object-attributes"></a>
#### Resource Attributes <a href="#document-structure-resource-object-attributes" id="document-structure-resource-object-attributes"></a>

A resource object **MAY** contain additional top-level members. These members
represent "[attributes]" and may contain any valid JSON value.
represent "[resource attributes]" and may contain any valid JSON value.

Although has-one foreign keys (e.g. `author_id`) are often stored internally
alongside other information to be represented in a resource object, these keys
**SHOULD NOT** appear as attributes. If relations are provided, they **MUST**
be represented under the "links object".
**SHOULD NOT** appear as [resource attributes]. If relations are provided,
they **MUST** be represented under the "links object".

#### Complex Attributes <a href="#document-structure-resource-object-complex-attributes" id="document-structure-resource-object-complex-attributes"></a>
#### Complex Resource Attributes <a href="#document-structure-resource-object-complex-attributes" id="document-structure-resource-object-complex-attributes"></a>

"[Complex attributes]" are [attributes] whose value is an object or array with
any level of nesting. An object that constitutes or is contained in a complex
attribute **MUST** reserve the `id`, `type`, `links`, and `meta` members for future
"[Complex resource attributes]" are [resource attributes] whose value is an object or array with
any level of nesting. An object that constitutes or is contained in a [complex resource attribute]
**MUST** reserve the `id`, `type`, `links`, and `meta` members for future
use.

#### Fields <a href="#document-structure-resource-object-fields" id="document-structure-resource-object-fields" class="headerlink"></a>

A resource object's [attributes] and relationships are collectively called its
[Resource attributes] and relationships are collectively called resource's
"[fields]". <a href="#document-structure-resource-object-fields" id="document-structure-resource-object-fields"></a>

#### Resource Identification <a href="#document-structure-resource-identification" id="document-structure-resource-identification" class="headerlink"></a>
Expand All @@ -218,7 +218,7 @@ resource.

Each resource object **MUST** contain a `type` member, whose value **MUST**
be a string. The `type` is used to describe resource objects that share
common attributes and relationships.
common [resource attributes] and relationships.

> Note: This spec is agnostic about inflection rules, so the value of `type`
can be either plural or singular. However, the same value should be used
Expand Down Expand Up @@ -354,7 +354,7 @@ to fetch the resource objects, and linkage information.

The `comments` relationship is simpler: it just provides a related resource URL
to fetch the comments. The URL can therefore be specified directly as the
attribute value.
[resource attribute] value.

### Compound Documents <a href="#document-structure-compound-documents" id="document-structure-compound-documents" class="headerlink"></a>

Expand Down Expand Up @@ -1098,7 +1098,7 @@ details **MAY** also be returned, as discussed below.

### Updating Resources <a href="#crud-updating" id="crud-updating" class="headerlink"></a>

A resource's attributes and relationships can be updated by sending a `PATCH`
[Resource attributes] and relationships can be updated by sending a `PATCH`
request to the URL that represents the resource.

The URL for a resource can be obtained in the `self` link of the resource
Expand Down Expand Up @@ -1126,8 +1126,8 @@ Accept: application/vnd.api+json

#### Updating a Resource's Attributes <a href="#crud-updating-resource-attributes" id="crud-updating-resource-attributes" class="headerlink"></a>

Any or all of a resource's attributes **MAY** be included in the resource
object included in a `PATCH` request.
Any or all of [resource attributes] of a resource **MAY** be included
in the resource object included in a `PATCH` request.

If a request does not include all of the fields for a resource, the server
**MUST** interpret the missing fields as if they were included together with
Expand Down Expand Up @@ -1157,7 +1157,7 @@ If a relationship is provided in the `links` section of a resource object in a
`PATCH` request, its value **MUST** be a link object with a `linkage` member.
The relationship's value will be replaced with the value specified in this member.

For instance, the following `PATCH` request will update the `title` attribute
For instance, the following `PATCH` request will update the `title` [resource attribute]
and `author` relationship of an article:

```text
Expand Down Expand Up @@ -1218,7 +1218,7 @@ does not want to allow deletion of records the client has not seen.
##### 204 No Content <a href="#crud-updating-responses-204" id="crud-updating-responses-204" class="headerlink"></a>

A server **MUST** return a `204 No Content` status code if an update is
successful and the client's current attributes remain up to date.
successful and the client's current [resource attributes] remain up to date.

##### 200 OK <a href="#crud-updating-responses-200" id="crud-updating-responses-200" class="headerlink"></a>

Expand Down Expand Up @@ -1471,7 +1471,7 @@ server, and we are defining its semantics for JSON API.
##### 204 No Content <a href="#crud-updating-relationship-responses-204" id="crud-updating-relationship-responses-204" class="headerlink"></a>

A server **MUST** return a `204 No Content` status code if an update is
successful and the client's current attributes remain up to date.
successful and the client's current [resource attributes] remain up to date.

> Note: This is the appropriate response to a `POST` request sent to a
*to-many relationship URL* when that relationship already exists. It is also
Expand Down Expand Up @@ -1541,6 +1541,10 @@ An error object **MAY** have the following members:

Additional members **MAY** be specified within error objects.

[attributes]: #document-structure-resource-object-attributes
[complex attributes]: #document-structure-resource-object-complex-attributes
[resource attribute]: #document-structure-resource-object-attributes
[resource attributes]: #document-structure-resource-object-attributes
[relationship attribute]: #document-structure-resource-relationships
[relationship attributes]: #document-structure-resource-relationships
[complex resource attribute]: #document-structure-resource-object-complex-attributes
[complex resource attributes]: #document-structure-resource-object-complex-attributes
[fields]: #document-structure-resource-object-fields
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