给出以下内容:
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和Compound Documents可以一起使用。规范明确列出了稀疏字段集,这是唯一允许的情况,其中所包含的资源可能不会被同一文档中的其他资源链接:]
包括在内,否则将被包括在内。**复合文件**
复合文档需要“完全链接”,这意味着每个包含的资源必须由同一文档中的至少一个资源标识符对象标识。这些资源标识符对象可以是主要数据,也可以表示主要资源或所包含资源中包含的资源链接。
完全链接要求的唯一例外是,通过稀疏字段集排除了原本将包含链接数据的关系字段。
直接回答您的问题:备用字段集应仅影响资源之间的链接(例如,不包括资源之间的关系字段),而不应导致资源被not