Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Feature Request] Side-Posting in automatic REST API

Aperta
#2,373 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

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:

  1. Issue multiple sequential requests.
  2. Manage temporary client-side IDs.
  3. 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 lid as a temporary identifier within the relationships and included blocks to link resources that don't have a server-generated ID yet.
  • Side-posting in included: The API should parse the included array in a POST request 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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di zenstackhq/zenstack

Tutte le issue di zenstackhq/zenstack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.