Skip to content

Commit 51663da

Browse files
author
Tyler Kellen
committed
Merge pull request #434 from tkellen/fkey-note
convert non-normative note into constraint
2 parents b1a34e2 + d404b7d commit 51663da

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

format/index.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,18 +136,18 @@ the client and represents a new resource to be created on the server.
136136

137137
In addition, a resource object **MAY** contain any of these top-level members:
138138

139-
* `"links"`: information about a resource's relationships (described
140-
below).
139+
* `"links"`: a "links object", providing information about a resource's
140+
relationships (described below).
141141
* `"meta"`: non-standard meta-information about a resource that can not be
142142
represented as an attribute or relationship.
143143

144144
Any other top-level member in a resource object represents an "attribute".
145145
An attribute may contain any valid JSON value.
146146

147-
> Note: Although has-one foreign keys are often stored as columns in a
148-
database alongside other fields, foreign keys **MUST NOT** be included in a
149-
resource's attributes. All relations **MUST** be represented under a
150-
resource's links object, as described below.
147+
Although has-one foreign keys (e.g. `author_id`) are often stored internally
148+
alongside other information to be represented in a resource object, these keys
149+
*SHOULD NOT* appear as attributes. If relations are provided, they **MUST**
150+
be represented under the "links object", as described below.
151151

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

@@ -156,7 +156,15 @@ Here's how an article (i.e. a resource of type "articles") might appear in a doc
156156
{
157157
"type": "articles",
158158
"id": "1",
159-
"title": "Rails is Omakase"
159+
"title": "Rails is Omakase",
160+
"links": {
161+
"author": {
162+
"self": "/articles/1/links/author",
163+
"related": "/articles/1/author",
164+
"type": "people",
165+
"id": "9"
166+
}
167+
}
160168
}
161169
// ...
162170
```
@@ -186,7 +194,7 @@ consistently throughout an implementation.
186194
Each resource object **MUST** contain an `id` member, whose value **MUST**
187195
be a string.
188196

189-
#### Links
197+
#### Links <a href="#document-structure-links" id="document-structure-links" class="headerlink"></a>
190198

191199
The value of the `"links"` key is a JSON object (a "links object") that
192200
represents related resources, keyed by the name of each association.

0 commit comments

Comments
 (0)
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