Skip to content

Commit

Permalink
[Feature] Improve/fix handling of links on relationship documents
Browse files Browse the repository at this point in the history
See #111
See #105
  • Loading branch information
lindyhopchris committed Jan 3, 2022
1 parent 32fe61e commit 7df6633
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,18 @@ All notable changes to this project will be documented in this file. This projec
- [#127](https://github.com/laravel-json-api/laravel/issues/127) The `JsonApiResource` class now has a
protected `serializeRelation` method that can be used to override the default serialization of relationships if
needed.
- [#111](https://github.com/laravel-json-api/laravel/issues/111) Relationship documents returned by relationship `self`
routes will now include any non-standard links set on the resource relationship in the top-level `links` member.

### Fixed

- [#130](https://github.com/laravel-json-api/laravel/issues/130) The `JsonApiResource` now correctly handles conditional
fields when iterating over relationships to find a specific relation.
- [#105](https://github.com/laravel-json-api/laravel/issues/105) The JSON:API document returned by a relationship `self`
route now handles a relationship not existing if it is hidden. Previously an exception was thrown when attempting to
merge relationship links into the document.
- [#111](https://github.com/laravel-json-api/laravel/issues/111) Relationship documents now handle a relationship that
does not have one or both of the `self` and `related` relationship links.

## [1.0.1] - 2021-12-08

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"ext-json": "*",
"laravel-json-api/core": "^1.1",
"laravel-json-api/eloquent": "^1.0.1",
"laravel-json-api/encoder-neomerx": "^1.0.0",
"laravel-json-api/encoder-neomerx": "^1.1",
"laravel-json-api/exceptions": "^1.0.0",
"laravel-json-api/spec": "^1.0.0",
"laravel-json-api/validation": "^1.0.0",
Expand Down
4 changes: 2 additions & 2 deletions tests/dummy/tests/Api/V1/Posts/ReadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public function test(): void
->withoutExceptionHandling()
->jsonApi()
->expects('posts')
->get(url('/api/v1/posts', $expected['id']));
->get($self = url('/api/v1/posts', $expected['id']));

$response->assertFetchedOneExact($expected);
$response->assertFetchedOneExact($expected)->assertLinks(compact('self'));
}

public function testIncludeAuthorAndTags(): void
Expand Down

0 comments on commit 7df6633

Please sign in to comment.