稀疏字段是否应该阻止显示复合文档?
Should sparse fields prevent compound documents from showing?
鉴于以下情况:
GET http://www.example.com/post/1?include=author
{
"type": "post",
"id": "1",
"attributes": {
"title": "It's a title.",
"description": "It's a description."
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/people?filter[article]=1"
},
"data":{
"type":"people", "id":"9"
}
}
},
"included":[
{
"type":"people",
"id": "9",
"attributes": {
"first-name": "Dan",
"last-name": "Gebhardt",
"twitter": "dgeb"
},
"links": {
"self": "http://example.com/people/9"
}
}
],
"links": {
"self": "http://example.com/articles/1"
}
}
如果我要附加 fields[post]=title
,(即 GET http://www.example.com/post/1?include=author&fields[post]=title
),这是否会阻止显示 included
(复合文档)?
GET http://www.example.com/post/1?include=author&fields[post]=title
{
"type": "post",
"id": "1",
"attributes": {
"title": "It's a title.",
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/people?filter[article]=1"
},
"data":{
"type":"people", "id":"9"
}
}
}
}
或者复合文档是否仍应呈现?
Sparse Fieldsets and Compound Documents可以一起使用。该规范明确列出了稀疏字段集作为唯一允许的情况,其中包含的资源可能不会被同一文档中的另一个其他资源链接:
** Compound Documents**
Compound documents require “full linkage”, meaning that every included resource MUST be identified by at least one resource identifier object in the same document. These resource identifier objects could either be primary data or represent resource linkage contained within primary or included resources.
The only exception to the full linkage requirement is when relationship fields that would otherwise contain linkage data are excluded via sparse fieldsets.
直接回答你的问题:备用字段集应该只影响资源之间的链接(例如不包括它们之间的关系字段)但不应该导致资源不 包括否则会。
鉴于以下情况:
GET http://www.example.com/post/1?include=author
{
"type": "post",
"id": "1",
"attributes": {
"title": "It's a title.",
"description": "It's a description."
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/people?filter[article]=1"
},
"data":{
"type":"people", "id":"9"
}
}
},
"included":[
{
"type":"people",
"id": "9",
"attributes": {
"first-name": "Dan",
"last-name": "Gebhardt",
"twitter": "dgeb"
},
"links": {
"self": "http://example.com/people/9"
}
}
],
"links": {
"self": "http://example.com/articles/1"
}
}
如果我要附加 fields[post]=title
,(即 GET http://www.example.com/post/1?include=author&fields[post]=title
),这是否会阻止显示 included
(复合文档)?
GET http://www.example.com/post/1?include=author&fields[post]=title
{
"type": "post",
"id": "1",
"attributes": {
"title": "It's a title.",
},
"relationships": {
"author": {
"links": {
"self": "http://example.com/articles/1/relationships/author",
"related": "http://example.com/people?filter[article]=1"
},
"data":{
"type":"people", "id":"9"
}
}
}
}
或者复合文档是否仍应呈现?
Sparse Fieldsets and Compound Documents可以一起使用。该规范明确列出了稀疏字段集作为唯一允许的情况,其中包含的资源可能不会被同一文档中的另一个其他资源链接:
** Compound Documents**
Compound documents require “full linkage”, meaning that every included resource MUST be identified by at least one resource identifier object in the same document. These resource identifier objects could either be primary data or represent resource linkage contained within primary or included resources.
The only exception to the full linkage requirement is when relationship fields that would otherwise contain linkage data are excluded via sparse fieldsets.
直接回答你的问题:备用字段集应该只影响资源之间的链接(例如不包括它们之间的关系字段)但不应该导致资源不 包括否则会。