Skip to content

Commit 1a5a328

Browse files
committed
[Refactor] Throw JsonApiException on failure to decode JSON
See #89
1 parent 45cfc9c commit 1a5a328

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ All notable changes to this project will be documented in this file. This projec
2222

2323
- Minimum Laravel version is now `8.30`. This change was required to use the `$stopOnFirstFailure` property on Laravel's
2424
`FormRequest` class.
25+
- Removed the `LaravelJsonApi\Spec\UnexpectedDocumentException` which was thrown if there was a failure when decoding
26+
request JSON content before parsing it for compliance with the JSON:API specification. A `JsonApiException` will now
27+
be thrown instead.
2528

2629
## [1.0.0-beta.4] - 2021-06-02
2730

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"laravel-json-api/eloquent": "^1.0.0-beta.5",
3030
"laravel-json-api/encoder-neomerx": "^1.0.0-beta.1",
3131
"laravel-json-api/exceptions": "^1.0.0-beta.4",
32-
"laravel-json-api/spec": "^1.0.0-beta.1",
32+
"laravel-json-api/spec": "^1.0.0-beta.2",
3333
"laravel-json-api/validation": "^1.0.0-beta.2",
3434
"laravel/framework": "^8.30"
3535
},

src/Http/Requests/ResourceRequest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use LaravelJsonApi\Core\Support\Str;
3232
use LaravelJsonApi\Spec\RelationBuilder;
3333
use LaravelJsonApi\Spec\ResourceBuilder;
34-
use LaravelJsonApi\Spec\UnexpectedDocumentException;
3534
use LogicException;
3635
use Symfony\Component\HttpKernel\Exception\HttpException;
3736
use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
@@ -487,7 +486,7 @@ private function relationshipRules(): array
487486
* Validate the JSON API document for a resource request.
488487
*
489488
* @return void
490-
* @throws HttpExceptionInterface
489+
* @throws JsonApiException
491490
*/
492491
private function validateResourceDocument(): void
493492
{
@@ -510,7 +509,6 @@ private function validateResourceDocument(): void
510509
* Validate the JSON API document for a modify relationship request.
511510
*
512511
* @return void
513-
* @throws UnexpectedDocumentException
514512
* @throws JsonApiException
515513
*/
516514
private function validateRelationshipDocument(): void

0 commit comments

Comments
 (0)