I'd like to hear some feedback and discuss how the JSON should be formatted. I'd like to follow the JSON API spec.
There's a few things I'm not to sure about it.
Documents that represent singular resources are wrapped inside an array and keyed by the plural form of the resource type.
I don't particulary like this. Singular resources (IMO) should be keyed by the singular form of the resource type and not wrapped inside an array. The spec recommends this:
{
"posts": [{
"id": 1
// an individual post document
}]
}
I, personally, prefer this:
{
"post": {
"id": 1
// an individual post document
}
}
I'm thinking of allowing the way responses are handled configurable, so you can easily write your own adapter.
I'd like to hear some feedback and discuss how the JSON should be formatted. I'd like to follow the JSON API spec.
There's a few things I'm not to sure about it.
I don't particulary like this. Singular resources (IMO) should be keyed by the singular form of the resource type and not wrapped inside an array. The spec recommends this:
{ "posts": [{ "id": 1 // an individual post document }] }I, personally, prefer this:
{ "post": { "id": 1 // an individual post document } }I'm thinking of allowing the way responses are handled configurable, so you can easily write your own adapter.