@@ -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 each resource
197
+ 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,17 @@ 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 that uniquely identifies the resource
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
+ other resource objects and [ resource identifier objects] [ resource identifier
241
+ object] . The values of ` lid ` members ** MUST** be unique across resource types.
242
+
243
+ The values of the ` id ` , ` type ` , and ` lid ` members ** MUST** be strings.
233
244
234
245
Within a given API, each resource object's ` type ` and ` id ` pair ** MUST**
235
246
identify a single, unique resource. (The set of URIs controlled by a server,
@@ -400,7 +411,13 @@ response that includes the resource as the primary data.
400
411
A "resource identifier object" is an object that identifies an individual
401
412
resource.
402
413
403
- A "resource identifier object" ** MUST** contain ` type ` and ` id ` members.
414
+ A "resource identifier object" ** MUST** contain ` type ` and ` id ` members, except
415
+ when it represents a new resource to be created on the server. In this case, a
416
+ ` lid ` member ** MUST** be included and ` type ` ** MAY** be included. As discussed
417
+ above, the value of the ` lid ` member ** MUST** be identical for every
418
+ representation of the resource in the document.
419
+
420
+ The values of the ` id ` , ` type ` , and ` lid ` members ** MUST** be strings.
404
421
405
422
A "resource identifier object" ** MAY** also include a ` meta ` member, whose value is a [ meta] object that
406
423
contains non-standard meta-information.
@@ -510,6 +527,10 @@ each `type` and `id` pair.
510
527
composite key that uniquely references [ resource objects] in another part of
511
528
the document.
512
529
530
+ > Note: For resources that do not contain an ` id ` member but do contain a ` lid ` ,
531
+ the ` lid ` is sufficient to establish resource identity and thus linkage between
532
+ resource objects and resource identifier objects throughout the document.
533
+
513
534
> Note: This approach ensures that a single canonical [ resource object] [ resource objects ] is
514
535
returned with each response, even when the same resource is referenced
515
536
multiple times.
0 commit comments