api-platform / api-platform/core

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

Abierto
#8,022 0 comentarios 1 reacción 0 asignados Ver en GitHub
JSON:API
Lenguaje dominante
PHP
Estrellas
2.6k
Forks
980
Merge medio
2 d 2 h
PR fusionados (30 d)
51

Descripción

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

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.