JSONAPI-Resources / JSONAPI-Resources/jsonapi-resources
Nested attributes for relationships
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Ruby
- Sterne
- 2.3k
- Forks
- 546
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
If I were updating / creating a "post" and I also wanted to create / update tag id 3 in the example below, should that be possible (i.e. similar to nested attributes in active record).
Probably a bit of a bad example, but hopefully you get the idea ?
I am finding that each entry in "data" in the relationships must only contain id and type. Nowhere have I yet seen how to do this in json_api in general, not just in this gem so maybe it is not possible. In which case, I guess I would need to create / update the tag seperately, but then I may need to worry about rolling it back if the creation / update of the post did not succeed etc...
post '/posts',
{
'posts' => {
'attributes' => {
'title' => 'A great new Post'
},
'relationships' => {
'tags' => {
'data' => [
{type: 'tags', id: 3, attributes: {name: "New Tag Name"}},
{type: 'tags', id: 4}
]
}
}
}
}
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Keine Quelldatei, kein Test und kein Einstiegspunkt ist angegeben. Beginne damit, die bestehende Verarbeitung zum Erstellen und Aktualisieren von Beziehungen sowie die JSON:API-Regeln für Beziehungsdaten zu prüfen, und ermittle anschließend, ob verschachtelte Attribute unterstützt werden. Als abgeschlossen gilt die Aufgabe, wenn eine klare Entscheidung mit definiertem Anfrageverhalten sowie Erwartungen an Transaktion oder Rollback vorliegt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- rails, ruby
- Bereich
- api, backend-api-design
- Issue-Typ
- Feature
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 25/100