[Feature Request] Side-Posting in automatic REST API
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Ferma
- Stack tecnologico
- typescript
- Ambito
- api
Direzione di ricerca
Start from the automatic REST API's POST handling path (the code that serves the generated REST endpoints) and its existing test suite, since the payload names no files. The example JSON request is the acceptance case: a POST with data plus included should create the primary resource and the lid-linked related resource atomically. Trace how the request body is parsed and relationships resolved to decide where lid resolution and the included array belong, then add a test covering the sample payload. Done means that single request creates both records, with no partial write on failure.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
Currently, ZenStack's automatic REST API handles single-resource creation effectively. However, when building complex frontends (especially those using JSON:API standards), there is often a need to create a primary entity along with several related "child" entities in a single atomic HTTP request.
Without support for Local IDs (lid) and the included section for writable operations, developers must:
- Issue multiple sequential requests.
- Manage temporary client-side IDs.
- Handle partial failures (where the parent is created but children fail), which complicates transaction management on the frontend.
Describe the solution you'd like
I would like the ZenStack REST API to support "side-posting" by recognizing the lid (Local ID) and included attributes during a POST request. This would allow a single request to create a resource and its related resources simultaneously by linking them via a temporary local identifier.
Key Requirements:
- LID Support: Support
lidas a temporary identifier within therelationshipsandincludedblocks to link resources that don't have a server-generated ID yet. - Side-posting in
included: The API should parse theincludedarray in aPOSTrequest and treat those objects as resources to be created alongside the primary data. - Atomic Operations (Next Step): Ideally, this should pave the way for full support of the JSON:API Atomic Operations extension, allowing multiple independent operations in one transaction.
Example Payload:
{
"data": {
"type": "articles",
"attributes": { "title": "New Article" },
"relationships": {
"author": { "data": { "type": "people", "lid": "temp-author-1" } }
}
},
"included": [
{
"type": "people",
"lid": "temp-author-1",
"attributes": { "name": "Jane Doe" }
}
]
}
- Lingua principale
- TypeScript
- Stelle
- 2.9k
- Fork
- 157
- Merge medio
- 11h 42m
- PR unite (30g)
- 20
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di zenstackhq/zenstack
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
zenstackhq/zenstack#2873 ·
I maintainer di solito rispondono entro 1 giorno
-
runtime
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
zenstackhq/zenstack#2868 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
zenstackhq/zenstack#2694 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
zenstackhq/zenstack#2659 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
zenstackhq/zenstack#2542 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di zenstackhq/zenstack
Issue simili
-
bug priority:low ready-for-dev
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
Automattic/data-liberation-agent#685 ·
I maintainer di solito rispondono entro 1 giorno
-
Business
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
txn2/mcp-data-platform#2063 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 77/100
Crosstalk-Solutions/project-nomad#1427 ·
I maintainer di solito rispondono entro 2 giorni