Answer the question
In order to leave comments, you need to log in
What is the benefit of separating relationships and attributes in the JSON API specification (jsonapi.org)?
Hey! We are thinking about how to make SPA interaction with the backend, we are looking towards jsonapi.org - but already our hands are reaching out to tighten it up for ourselves. Let me remind you that according to the specification, the object ("resource object") should look like this:
{
"type": "article",
"id": "1",
"attributes": {
"title": "Rails is Omakase"
},
"relationships": {
"author": {
"data": { "type": "user", "id": "9" }
// здесь еще может быть опциональный ключ "links"
}
}
}
{
"type": "article",
"id": "1",
"attributes": {
"title": "Rails is Omakase",
"author": "9"
}
}
article
belongs_to author
and what author
it is user
. Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question