What format should response errors be in with Ember Data?


#1

What format should response errors be in when using JSONSerializer or RESTSerializer with Ember Data 2.2.0-beta.2.


#2

Ember expects error in this format:

{
    "errors": [
     {
        "detail": "The attribute `is-admin` is required",
        "source": {
             "pointer": "data/attributes/is-admin"
         }
     }
    ]
}  

No idea why, if someone knows I would like to know. I found this out at this stackoverflow answer


#3

Is that for JSONAPISerializer, JSONSerializer, and RESTSerializer? I think that might be just for JSONAPISerializer.


#4

Oh yeah, sorry - its for JSONAPI. I was skimming through JSONAPI topics, and I read your post wrong.


#5

Discovered it by poking around in the test https://github.com/emberjs/data/blob/1d5dfa142523a4aefdde182262923a42ccb56286/tests/integration/serializers/json-serializer-test.js#L732-L743


#6

Thanks for all the help guys! I played around with it and wrote a blog post on it, not only for JSONAPI but if you are using the RESTSerializer or JSONSerializer as well in case you are interested :slightly_smiling: