@@ -191,8 +191,10 @@ A resource object **MUST** contain at least the following top-level members:
191
191
* ` id `
192
192
* ` type `
193
193
194
- Exception: The ` id ` member is not required when the resource object originates at
195
- the client and represents a new resource to be created on the server.
194
+ Exception: The ` id ` member is not required when the resource object originates
195
+ at the client and represents a new resource to be created on the server. In that
196
+ case, a client ** MAY** include a ` lid ` member to uniquely identify the resource
197
+ by ` type ` _ locally_ within the document.
196
198
197
199
In addition, a resource object ** MAY** contain any of these top-level members:
198
200
@@ -228,8 +230,16 @@ Here's how an article (i.e. a resource of type "articles") might appear in a doc
228
230
229
231
#### <a href =" #document-resource-object-identification " id =" document-resource-object-identification " class =" headerlink " ></a > Identification
230
232
231
- Every [ resource object] [ resource objects ] ** MUST** contain an ` id ` member and a ` type ` member.
232
- The values of the ` id ` and ` type ` members ** MUST** be strings.
233
+ As noted above, every [ resource object] [ resource objects ] ** MUST** contain a
234
+ ` type ` member. Every resource object ** MUST** also contain an ` id ` member,
235
+ except when the resource object originates at the client and represents a new
236
+ resource to be created on the server. If ` id ` is omitted due to this exception,
237
+ a ` lid ` member ** MAY** be included to uniquely identify the resource by ` type `
238
+ _ locally_ within the document. The value of the ` lid ` member ** MUST** be
239
+ identical for every representation of the resource in the document, including
240
+ [ resource identifier objects] [ resource identifier object ] .
241
+
242
+ The values of the ` id ` , ` type ` , and ` lid ` members ** MUST** be strings.
233
243
234
244
Within a given API, each resource object's ` type ` and ` id ` pair ** MUST**
235
245
identify a single, unique resource. (The set of URIs controlled by a server,
@@ -400,7 +410,12 @@ response that includes the resource as the primary data.
400
410
A "resource identifier object" is an object that identifies an individual
401
411
resource.
402
412
403
- A "resource identifier object" ** MUST** contain ` type ` and ` id ` members.
413
+ A "resource identifier object" ** MUST** contain a ` type ` member. It ** MUST**
414
+ also contain an ` id ` member, except when it represents a new resource to be
415
+ created on the server. In this case, a ` lid ` member ** MUST** be included that
416
+ identifies the new resource.
417
+
418
+ The values of the ` id ` , ` type ` , and ` lid ` members ** MUST** be strings.
404
419
405
420
A "resource identifier object" ** MAY** also include a ` meta ` member, whose value is a [ meta] object that
406
421
contains non-standard meta-information.
@@ -510,6 +525,10 @@ each `type` and `id` pair.
510
525
composite key that uniquely references [ resource objects] in another part of
511
526
the document.
512
527
528
+ > Note: For resources that do not contain an ` id ` member but do contain a ` lid ` ,
529
+ the ` lid ` is sufficient to establish resource identity and thus linkage between
530
+ resource objects and resource identifier objects throughout the document.
531
+
513
532
> Note: This approach ensures that a single canonical [ resource object] [ resource objects ] is
514
533
returned with each response, even when the same resource is referenced
515
534
multiple times.
0 commit comments