diff --git a/CHANGELOG.md b/CHANGELOG.md index 6dc290f..9366057 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/composer.json b/composer.json index 8fd1187..72b6921 100644 --- a/composer.json +++ b/composer.json @@ -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", diff --git a/tests/dummy/tests/Api/V1/Posts/ReadTest.php b/tests/dummy/tests/Api/V1/Posts/ReadTest.php index 0f2138d..acba4e7 100644 --- a/tests/dummy/tests/Api/V1/Posts/ReadTest.php +++ b/tests/dummy/tests/Api/V1/Posts/ReadTest.php @@ -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