我喜欢 JSON-LD、Hydra 的优势,并且刚刚了解了 NgRx/data。
我尝试在没有自定义的情况下使用它,这显然不起作用。今天我花了几个小时在文档上,这给我留下了更多问题。
重要的是,我不想牺牲任何关于收藏的信息。所以我不能只使用自定义效果。
关于如何解决这个问题的任何想法?
收藏回复:
{
"@context": "/contexts/Article",
"@id": "/articles",
"@type": "hydra:Collection",
"hydra:member": [
{
"@id": "/articles/91",
"@type": "http://schema.org/Article",
"headline": "Neque illum sed adipisci dolorem rem.",
"slug": "reiciendis-nesciunt-labore-voluptas",
"author": {
"@id": "/people/91",
"@type": "http://schema.org/Person",
"id": 91,
"name": "Edd Nienow"
},
"publisher": null,
"aggregateRating": null,
"articleCreator": {
"@id": "/people/91",
"@type": "http://schema.org/Person",
"name": "Edd Nienow"
},
"articleType": "tutorial",
"creativeWorkStatus": "draft",
"articleVersions": [
{
"content": "Facere illo praesentium accusantium suscipit voluptatem laborum nihil sed. Aperiam doloremque mollitia nisi voluptatem facilis. Voluptatem sed aut et incidunt id et error modi.",
"articleBody": "Omnis et dolores enim praesentium. Temporibus nisi mollitia maiores voluptas nobis impedit.",
"brief": "Est quae minima ut ab eaque ut. Neque qui nemo quaerat consequatur.",
"wordCount": 779,
"image": null,
"createdAt": "1980-09-30T01:43:18+00:00"
}
],
"articleCategories": [],
"articleTerms": [],
"publishedAt": "2003-11-11T05:23:26+00:00",
"createdAt": "1971-10-23T07:53:28+00:00"
},
],
"hydra:totalItems": 100,
"hydra:view": {
"@id": "/articles?page=4",
"@type": "hydra:PartialCollectionView",
"hydra:first": "/articles?page=1",
"hydra:last": "/articles?page=4",
"hydra:previous": "/articles?page=3"
}
单一响应:
{
"@context": "/contexts/Article",
"@id": "/articles/91",
"@type": "http://schema.org/Article",
"headline": "Neque illum sed adipisci dolorem rem.",
"slug": "reiciendis-nesciunt-labore-voluptas",
"author": {
"@id": "/people/91",
"@type": "http://schema.org/Person",
"name": "Edd Nienow"
},
"publisher": null,
"aggregateRating": null,
"articleCreator": {
"@id": "/people/91",
"@type": "http://schema.org/Person",
"name": "Edd Nienow"
},
"articleType": "tutorial",
"creativeWorkStatus": "draft",
"articleVersions": [
{
"content": "Facere illo praesentium accusantium suscipit voluptatem laborum nihil sed. Aperiam doloremque mollitia nisi voluptatem facilis. Voluptatem sed aut et incidunt id et error modi.",
"articleBody": "Omnis et dolores enim praesentium. Temporibus nisi mollitia maiores voluptas nobis impedit.",
"brief": "Est quae minima ut ab eaque ut. Neque qui nemo quaerat consequatur.",
"wordCount": 779,
"image": null,
"createdAt": "1980-09-30T01:43:18+00:00"
}
],
"articleCategories": [],
"articleTerms": [],
"publishedAt": "2003-11-11T05:23:26+00:00",
"createdAt": "1971-10-23T07:53:28+00:00"
}