faecie / json-api-error-response
The Bundle provides en error response as it described in JsonApi specification
Installs: 263
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 1
Open Issues: 1
Type:symfony-bundle
Requires
- friendsofsymfony/rest-bundle: ^2.3
- jms/serializer: ^1.13
- symfony/config: ^4.1
Requires (Dev)
- phpunit/phpunit: ^7.4
README
This bundle provides a way return JSON:API compatible error responses from REST endponts
Perfectly works along with FOS REST bundle configured to json response. OIn this case you will alway get response in a JSONAPI compatible format. https://jsonapi.org/format/#errors
Installation
$ composer require faecie/json-api-error-response ^0.1
Configuration
You can configure the response of your exception in different ways:
- Implement interface
DescriptiveExceptionInterface
on your exception with only one method returning the array of Error objects - Configure each exception class in the bandle configuration
- Tag you service as
json_api.exception_describer
and implementExceptionDescriberInterface
on it with only one method allowing you to control how to serialize your exceptions