cloudcreativity / json-api

Framework agnostic JSON API serialisation and deserialisation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Validation Exception

featurecode opened this issue · comments

Instead of 422 responses with validation error messages. I always get this.

CloudCreativity\LaravelJsonApi\Exceptions\ValidationException: JSON API error in file /Library/WebServer/Documents/omega_mcs_api/vendor/cloudcreativity/laravel-json-api/src/Exceptions/ValidationException.php on line 49

Expecting this:

'''
{
"errors": [
{
"status": "422",
"title": "Unprocessable Entity",
"detail": "The content field is required.",
"source": {
"pointer": "/data"
}
}
]
}
'''

Have you followed the installation instructions for how to amend your app's Exception handler?

Section on exception handling in this chapter:
https://laravel-json-api.readthedocs.io/en/latest/installation/

Great, glad you got it solved!