10000 [Bugfix] Convert resource values to JSON values before validating · dev-engvox/laravel-json-api@c142b29 · GitHub
[go: up one dir, main page]

Skip to content

Commit c142b29

Browse files
committed
[Bugfix] Convert resource values to JSON values before validating
Closes cloudcreativity#576
1 parent 2e16c44 commit c142b29

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ All notable changes to this project will be documented in this file. This projec
1010
- [#586](https://github.com/cloudcreativity/laravel-json-api/pull/586) Added French translations for validation and
1111
specification compliance messages.
1212

13+
### Fixed
14+
- [#576](https://github.com/cloudcreativity/laravel-json-api/issues/576) Correctly pass existing resource values to
15+
JSON values, before merging client values for validation.
16+
1317
## [3.2.0] - 2020-11-26
1418

1519
### Added

src/Validation/AbstractValidators.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
use CloudCreativity\LaravelJsonApi\Rules\DisallowedParameter;
3232
use Illuminate\Support\Collection;
3333
use Illuminate\Support\Str;
34+
use function json_decode;
35+
use function json_encode;
3436

3537
/**
3638
* Class AbstractValidators
@@ -435,6 +437,9 @@ protected function dataForUpdate($record, array $document): array
435437
$record,
436438
$resource['relationships'] ?? []
437439
);
440+
441+
/** @see https://github.com/cloudcreativity/laravel-json-api/issues/576 */
442+
$resource = json_decode(json_encode($resource), true);
438443
}
439444

440445
return $resource;

0 commit comments

Comments
 (0)
0