Releases: laravel-json-api/laravel
Releases · laravel-json-api/laravel
Laravel 10 on Valentine's Day
Upgrading
composer require laravel-json-api/laravel --no-update
composer require laravel-json-api/testing --dev --no-update
composer up "laravel-json-api/*" cloudcreativity/json-api-testing
Changelog
Changed
- Upgraded to Laravel 10 and set minimum PHP version to
8.1
. - BREAKING If using the
laravel-json-api/cursor-pagination
package, you now need to passed the schema'sid
field to the paginator'smake()
method. I.e. useCursorPagination::make($this->id())
Fixed
- BREAKING #190 The JSON:API media type now needs to be sent in the
Accept
header for a "delete" resource request. Previously there was no checking of theAccept
media type, so anything could be sent. This is incorrect as the JSON:API specification shows theAccept
header asapplication/vnd.api+json
for delete resource requests.
Add multi-paginator plus validation bugfix
Upgrading
composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"
Changelog
Added
- New
MultiPaginator
that allows a schema to offer multiple different pagination strategies.
Fixed
- The JSON:API rule validators for the follow query parameter fields all errored if a non-array value was provided. This is now fixed:
fields
page
filter
Fix fields query parameter validation
Upgrading
composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"
Changelog
Fixed
- #225 Fix validation of empty field list for a resource type in the
fields
query parameter, e.g./api/v1/employees?fields[employees]=
.
Fix stale state on Eloquent models after write operation
Upgrading
composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"
Changelog
Fixed
- #223 Ensure Eloquent models always have fresh data after write operation. This is to prevent cached relationships from having "stale" data after the write operation. This can occur if a related model's attributes change during the write operation, but the related model was cached before the write operation occurred.
Conditional eager loading and where null filters
Upgrading
composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"
Changelog
Added
- Relations can now be conditionally set to be eager-loadable via the
canEagerLoad()
method. - New
WhereNull
andWhereNotNull
filters.
Fixed
- #204 Fix exception parser causing error when request does not have a matching route (e.g. in a
404 Not Found
scenario). - Fixed PHP 8.2 deprecation messages in the
laravel-json-api/validation
dependency.
Exception improvements and bug fixes
Upgrading
composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"
Changelog
Added
- The
JsonApiException
class now has acontext()
method. Laravel's exception handler uses this to add log context when the exception is logged. This means logging of JSON:API exceptions will now include the HTTP status code and the JSON:API errors. - Moved the default
406 Not Acceptable
and415 Unsupported Media Type
messages to the following two new exception classes:Exceptions\HttpNotAcceptableException
Exceptions\HttpUnsupportedMediaTypeException
Fixed
- #184 Ensure that an
Accept
header with the media typeapplication/json
is rejected with a406 Not Acceptable
response. Previously this media type worked, which is incorrect as the JSON:API specification requires the media typeapplication/vnd.api+json
. - #197 Fix sending
null
for a to-one relationship update.
Spanish and Brazilian Portuguese translations
Upgrading
composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"
Changelog
Added
- Added Spanish and Brazilian Portuguese translations for specification and validation error messages.
Controller improvement and fix broken stub
Fix sparse field sets in page URLs
Upgrading
composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"
Changelog
Fixed
- #175 Fix page URLs missing sparse field sets.
Allow zero as a resource id
Upgrading
composer require laravel-json-api/laravel --no-update
composer up laravel-json-api/*
Changelog
Fixed
- #178 Allow a resource id that is
"0"
.