api-platform / api-platform/core

JSON:API v1.1 support [JSON:API]

未關閉
#8,022 0 則留言 1 個 reaction 已指派 0 人 在 GitHub 檢視
JSON:API
主要語言
PHP
星號
2.6k
分支
980
平均合併
2 天 2 小時
30 天內合併 PR
51

描述

JSON:API v1.1 is now in RC3 (and has been since 2 Oct 2020).

On https://jsonapi.org/format/1.1/ they state: "Version 1.1 is a release candidate. As such, the content on this page is unlikely to change. However, some changes may still occur if implementation experience proves that they are necessary before this version is finalized."

Just wondering if there has been any work done or plans to implement the changes in this version?

In particular, the addition of 'lid' instead of just 'id' Identification (https://jsonapi.org/format/1.1/#document-resource-identifier-objects) to locally identify Resource Identifier Objects (https://jsonapi.org/format/1.1/#document-resource-identifier-objects) within a document is very interesting. Correct me if I'm wrong but wouldn't this allow the creation of the main (parent) Resource Object along with any related Resource Object/s by use of 'lid's?

If i'm correct in my thinking, a POST containing the following Compound Document could save multiple POST requests for related entities.

**E.G**
```json
{
"data": {
"type": "User",
"attributes": {
"name": "Test User 1"
},
"relationships": {
"group": {
"data": {
"type": "Group",
"id": "/groups/1"
}
},
"category": {
"data": {
"type": "Category",
"lid": "newCategory1"
}
},
"tags": {
"data": [
{
"type": "Tag",
"lid": "newTag1"
},
{
"type": "Tag",
"lid": "newTag2"
}
]
}
}
},
"included": [
{
"type": "Category",
"lid": "newCategory1",
"attributes": {
"lid": "newCategory1",
"name": "New Category 1"
},
"relationships": {
"sections": {
"data": [
{
"type": "Section",
"id": "/sections/1"
}
]
}
}
},
{
"type": "Tag",
"lid": "newTag1",
"attributes": {
"lid": "newTag1",
"name": "New Tag 1"
}
},
{
"type": "Tag",
"lid": "newTag2",
"attributes": {
"lid": "newTag2",
"name": "New Tag 2"
}
}
]
}
```

**This ideally would:**
- Create a new User entity
- Link the existing Group 1 entity to the new User entity
- Create a new Category entity (linking the existing Section 1 entity to the new Category entity) and link to the new User entity
- Create 2 new Tag entities and link to the new User entity

貢獻指南

開啟貢獻指南

評估

這個 Issue 還沒有評估資料。

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。