Skip to content

Releases: swisnl/json-api-client

0.15.0

21 Feb 12:58

Choose a tag to compare

This release includes changes to some interfaces #47. This is a breaking change if you use these interfaces in your own code.

Added

  • Added take method to Repository to allow fetching resources without id.
  • Added links and meta to ItemInterface.
  • Added Jsonapi class.
  • Added links and meta to OneRelationInterface and ManyRelationInterface.
  • Added Link and Links classes.
  • Added links to Error.

Changed

  • Error::getMeta() now returns a Meta instance instead of an ErrorMeta instance. The Meta class does not have the has and get methods, but uses magic overloading methods (e.g. __get and __set) just like Item.
    N.B. This is a breaking change if you use meta on errors.
  • DocumentInterface::getLinks() now returns a Links instance instead of a plain array. If no links are present, it returns null. All implementations have been updated to reflect these changes.
    N.B. This is a minor breaking change if you use links on documents.
  • DocumentInterface::getMeta() now returns a Meta instance instead of a plain array. If no meta is present, it returns null. All implementations have been updated to reflect these changes.
    N.B. This is a minor breaking change if you use meta on documents.
  • DocumentInterface::getJsonapi() now returns a Jsonapi instance instead of a plain array. If no jsonapi is present, it returns null. All implementations have been updated to reflect these changes.
  • Parameters for ItemInterface::setRelation() have changed to include optional Links and Meta objects.
  • JsonApi\ErrorsParser, JsonApi\Hydrator and JsonApi\Parser have an extra dependency in their constructor.
    N.B. Make sure to add this dependency if you've overwritten ServiceProvider::registerParser or construct the JsonApi\Parser yourself.

Removed

  • Removed ErrorMeta class in favor of generic Meta class.

Fixed

0.14.0

23 Jan 15:45

Choose a tag to compare

This release includes changes to some interfaces #45. This is a breaking change if you use these interfaces in your own code.

Added

  • Added OneRelationInterface and ManyRelationInterface to differentiate between singular and plural relations.
  • Added documentation about ItemDocumentBuilder, ItemHydrator and Repository classes.

Changed

  • Moved setType and getType from RelationInterface to a separate interface; TypedRelationInterface.
  • Added type hints to ItemInterface::setRelation.
  • Added return type hint to Item::hasAttribute.

Removed

  • Removed RelationInterface in favor of OneRelationInterface and ManyRelationInterface.
  • Removed setId and getId from HasOneRelation and MorphToRelation. These operations should be performed on the included item.
  • Removed setType and getType from morph relations. Use regular relations if you want to set the type.

0.13.0

14 Jan 15:38

Choose a tag to compare

Fixed

  • Omit item from included when it has no attributes or relationships (only type and id)
    N.B. This is a breaking change if you implement the ItemInterface yourself instead of using the supplied Item.
  • Make sure included is always a plain array so it is serialized as array

0.12.1

11 Jan 16:21

Choose a tag to compare

Fixed

  • Fix hydrating of HasOne relations by id using ItemHydrator #44

0.12.0

11 Jan 12:30

Choose a tag to compare

Added

Changed

  • Add headers to request methods in DocumentClientInterface. #34
    N.B. This is a breaking change if you implement the interface yourself or extend the DocumentClient.
  • Repository doesn't throw exceptions anymore. #41
    N.B. This is a breaking change if you catch DocumentNotFoundException or DocumentTypeException. If you would like the old behaviour, you can simply extend the Repository and implement it yourself.
  • A HasOne or MorphTo relation do not set a [relationship]_id field on the parent when associating a related item. #42

Removed

  • Removed obsolete ItemDocumentSerializer in favor of JsonSerializable.
    N.B. This is a breaking change if you use this class directly, construct the DocumentClient yourself or have overwritten \Swis\JsonApi\Client\Providers\ServiceProvider::registerClients. The ItemDocument can now be serialized using json_encode.
  • Removed obsolete DocumentNotFoundException and DocumentTypeException. #41
    N.B. This is a breaking change if you catch these exceptions.

Fixed

  • Do not fail on, but skip relationships without data #38
  • Dissociating a related item now produces valid JSON #42

0.11.0

21 Dec 11:26

Choose a tag to compare

Changed

  • Implement JsonSerializable in Document #32
  • Add toArray to DocumentInterface and Document so CollectionDocument and ItemDocument now share the same toArray method #32
    N.B. This will be breaking if you implement the DocumentInterface yourself.

0.10.3

26 Oct 09:28

Choose a tag to compare

Fixed

  • Omit 'type' attribute when filling attributes for a morph relationship #28

0.10.2

24 Oct 10:58

Choose a tag to compare

Fixed

  • Allow '0' as id in ItemDocumentBuilder #27

0.10.1

25 Sep 13:17

Choose a tag to compare

Fixed

  • Add the id when the item has one and not only when it is not new

0.10.0

10 Sep 07:29

Choose a tag to compare

Added

  • Added Laravel 5.7 support #26