-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
JSON-API AssertionError with JSONSerializer #4608
Comments
Hey, if you use the JSONAPI serializer the |
But i'm using the JSONSerializer by customizing the application serializer -
Am I missing something? |
I think your error payload should be something like: {
"errors": [
{
"source": { "pointer": "/data/attributes/email" },
"detail": "can't be blank"
},
{
"source": { "pointer": "/data/attributes/password" },
"detail": "can't be blank"
},
{
"source": { "pointer": "/data/attributes/first-name" },
"detail": "can't be blank"
},
{
"source": { "pointer": "/data/attributes/last-name" },
"detail": "can't be blank"
},
{
"source": { "pointer": "/data/attributes/title" },
"detail": "can't be blank, should be Mr or Ms"
}
]
} |
only if I''m using the JSONAPISerializer right? I'm using the JSONSerializer, not JSONAPISerializer |
So ember-data internally uses JSON-API. All errors which are pushed into ember-data need to be in the JSON-API format. At the moment you need to convert your errors into the JSON-API format within your Also, you are using the #4409 aims for a smoother error normalization handling, but until then you can use the way demonstrated in the twiddle. |
Sorry! I totally missed that. |
I've switched my serializer by adding the application serializer file -> app/serializers/application.js
and I'm using the RESTAdapter, customized at app/adapters/application.js
But when my server fails with validation errors with a 422, I get an assertion error that the errors should be in the JSON API format
My error payload is
The text was updated successfully, but these errors were encountered: