Skip to content

Releases: laravel-json-api/laravel

Laravel 10 on Valentine's Day

14 Feb 19:59
Compare
Choose a tag to compare

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's id field to the paginator's make() method. I.e. use CursorPagination::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 the Accept media type, so anything could be sent. This is incorrect as the JSON:API specification shows the Accept header as application/vnd.api+json for delete resource requests.

Add multi-paginator plus validation bugfix

09 Feb 20:52
Compare
Choose a tag to compare

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

25 Jan 21:25
Compare
Choose a tag to compare

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

23 Jan 18:10
Compare
Choose a tag to compare

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

15 Jan 17:49
Compare
Choose a tag to compare

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 and WhereNotNull 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

25 Jun 15:05
Compare
Choose a tag to compare

Upgrading

composer require laravel-json-api/laravel --no-update
composer up "laravel-json-api/*"

Changelog

Added

  • The JsonApiException class now has a context() 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 and 415 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 type application/json is rejected with a 406 Not Acceptable response. Previously this media type worked, which is incorrect as the JSON:API specification requires the media type application/vnd.api+json.
  • #197 Fix sending null for a to-one relationship update.

Spanish and Brazilian Portuguese translations

11 Apr 17:48
Compare
Choose a tag to compare

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

10 Apr 14:00
Compare
Choose a tag to compare

Upgrading

composer require laravel-json-api/laravel

Changelog

Added

  • #181 The JsonApiController now extends the base Laravel controller.

Fixed

  • #180 Add missing method to the Authorizer stub.

Fix sparse field sets in page URLs

04 Apr 13:26
Compare
Choose a tag to compare

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

01 Apr 19:53
Compare
Choose a tag to compare

Upgrading

composer require laravel-json-api/laravel --no-update
composer up laravel-json-api/*

Changelog

Fixed

  • #178 Allow a resource id that is "0".