The error pointer do not match the alias used in the serializer.
serializer :
attribute :reply do
@object.content
end
response when there is an active record error :
{"errors":[{"title":"Invalid content","detail":"Nouveau commentaire est trop court (au moins 16 caractères)","source":{}}],"jsonapi":{"version":"1.0"}}
Ideally source should contain a pointer to reply.
I am not sure If it is possible to correctly alias the error with the declaration done in a bloc.
The errors are set by the deserializer, which are independent from the serializers. The deserializable module maintains a reverse mapping for renamed keys, which is used to generate the JSON pointer.
The error pointer do not match the alias used in the serializer.
serializer :
response when there is an active record error : {"errors":[{"title":"Invalid content","detail":"Nouveau commentaire est trop court (au moins 16 caractères)","source":{}}],"jsonapi":{"version":"1.0"}}
Ideally source should contain a pointer to reply. I am not sure If it is possible to correctly alias the error with the declaration done in a bloc.