Releases: swisnl/json-api-client
1.0.1
1.0.0
The first stable release! 🎉 This release includes some bugfixes and changes in order to align with the specification.
Changed
- Reworded
ValidationExceptionmessages to align them with the wordings used in the specification. DocumentParserthrows aValidationExceptionwhen it encounters duplicate resources #64.TypeMapperInterfaceandTypeMapperare now registered as the same singleton #65.
Fixed
ItemHydratorunsets a relation when null (singular) or empty array (plural) instead of hydrating a relation with idnull#67.
1.0.0-beta.3
Fixed
- Fixed parsing of empty singular relationships #63.
1.0.0-beta.2
This release includes a small breaking change because we switched from PHP-HTTP to PSR-18, its successor. Almost all PHP-HTTP clients now implement PSR-18, so this should not be a big problem. This also means for example that PSR exceptions are thrown instead of PHP-HTTP exceptions. If you are relying on some PHP-HTTP classes yourself, make sure to review your code and change those to their PSR equivalent. If you are using this package within a Laravel application, it is important to note that we also changed the way how you can bind your own HTTP client. Please see the documentation and compare all code changes for more details!
Added
- Added support for Laravel 6 #61.
Changed
- Switched from PHP-HTTP to PSR-18, its successor #60.
- The
\Swis\JsonApi\Client\Clientnow uses php-http/discovery itself instead of the service provider. This should make usage without Laravel easier #60. - Removed the
$baseUriparameter from\Swis\JsonApi\Client\Client::__construct(), use\Swis\JsonApi\Client\Client::setBaseUri()instead #60.
Removed
- Removed
\Swis\JsonApi\Client\Providers\ServiceProvider::getHttpClient()and\Swis\JsonApi\Client\Providers\ServiceProvider::getMessageFactory()as the client now discovers these classes itself. Custom HTTP clients must now be registered within your own service provider using a custom container binding #60.
Fixed
1.0.0-beta
Changed
- Drop art4/json-api-client dependency and validate the JSON ourselves #58.
\Swis\JsonApi\Client\Exceptions\ValidationExceptionis thrown instead of\Art4\JsonApiClient\Exception\ValidationException#58.- Added
hasAttributetoItemInterface. - All exceptions thrown by this package now implement
\Swis\JsonApi\Client\Exceptions\Exception.
Fixed
- Empty (
null) links are correctly parsed. - Empty (
null) singular relationships are correctly parsed.
0.20.0
0.19.0
This is a big release to improve the overall code quality and align some inconsistencies. Please note it includes several breaking changes so read through all changes carefully when upgrading!
Added
- Added
DocumentFactory#52. - Added facades for
DocumentFactory,DocumentParser,ItemHydrator,ResponseParserandTypeMapper. - Added
DocumentParserInterfaceandResponseParserInterfaceinterfaces and implementations #54.
Changed
- The
TypeMappernow checks if the class exists in the setter instead of the getter. - The
ItemHydratornow also hydrates the id if provided #53. - Added
hasType,hasAttributes,hasRelationshipsandgetRelationstoItemInterface#53. - Removed
canBeIncludedandgetIncludedfromItemInterfaceas theDocumentFactoryis now responsible for gathering the included items #53. - Renamed
getRelationshiptogetRelation,hasRelationshiptohasRelationandremoveRelationshiptounsetRelationinItem#53. - Renamed/aligned some parameters in several relation methods in
Item#53. - Renamed namespace
Swis\JsonApi\Client\TraitstoSwis\JsonApi\Client\Concerns#53. - Renamed namespace
Swis\JsonApi\Client\JsonApitoSwis\JsonApi\Client\Parsers#54. - Renamed
ServiceProvider::registerParser(singular) toServiceProvider::registerParsers(plural) #54.
Removed
0.18.0
This release includes changes to some interfaces. This is a breaking change if you use these interfaces in your own code.
Added
- The id of an item can be set/get using magic accessors just like the attributes #51.
Changed
- Added (optional) type hints to several interfaces.
N.B. This is a breaking change if you implement some of the interfaces yourself. Please look at the interfaces and make the appropriate changes in your implementation. - Renamed
deleteByIdmethod to simplydeleteand removed the 'old' implementation inRepositoryInterface.
N.B. This is a breaking change and all calls todeleteByIdshould simply be changed todeleteas the signature is unchanged. The old behaviour ofdeleteis not supported any more.
0.17.0
0.16.0
Added
- Added
DocumentInterface::getResponse()so every document instance can have its corresponding response. This allows access to the underlying response to check headers or status codes etc #48. - Added
ParserInterface::deserializeResponse($reponse)to deserialize a\Psr\Http\Message\ResponseInterface.
Changed
ClientInterfacemust now return a\Psr\Http\Message\ResponseInterfacefor requests instead of our own (removed)ResponseInterface#48.
N.B. This is a breaking change if you use theClientdirectly, theDocumentClientisn't affected.- Changed namespace of error classes:
\Swis\JsonApi\Client\Errors\Error -> \Swis\JsonApi\Client\Error
\Swis\JsonApi\Client\Errors\ErrorCollection -> \Swis\JsonApi\Client\ErrorCollection
\Swis\JsonApi\Client\Errors\ErrorSource -> \Swis\JsonApi\Client\ErrorSource
Removed
- Removed
ResponseInterfaceandResponseclasses #48.