4.0.0-beta1
Pre-release
Pre-release
kocsismate
released this
19 Jan 11:01
·
112 commits
to master
since this release
ADDED:
- JSON:API 1.1 related features:
- Partial support for Profiles
- Support for
type
links in errors
- Resources can also use the
$object
property to access the object which is being transformed - Separate classes for the different types of links instead of the generic
Links
classDocumentLinks
ResourceLinks
RelationshipLinks
ErrorLinks
- New capabilities related to pagination:
- #70: Better support for query parameters in pagination links
PaginationFactory
class to decouple Pagination class instantiation from the requestJsonApi::getPaginationFactory()
method to make it easier to retrieve the Pagination FactoryFixedCursorBasedPagination
class which preserves the original behaviour of the changedCursorBasedPagination
FixedCursorBasedPaginationProviderTrait
for using it in connection withFixedCursorBasedPagination
FixedPageBasedPaginationLinkProviderTrait
for using it in connection withFixedPageBasedPagination
- New capabilities related to relationships:
ResponseInterface::hasToOneRelationship()
to determine if a specific To-One relationship existsResponseInterface::hasToManyRelationship()
to determine if a specific To-Many relationship exists
CHANGED:
- Updated
justinrainbow/json-schema
to v5.2 Documents
should use the$object
property instead of$domainObject
(BREAKING CHANGE)- Links are used strictly according to the spec (BREAKING CHANGE):
AbstractSuccessfulDocument::getLinks()
returns?DocumentLinks
instead of?Links
AbstractErrorDocument::getLinks()
returns?DocumentLinks
instead of?Links
ErrorDocument::getLinks()
returns?DocumentLinks
instead of?Links
ErrorDocument::setLinks()
expects a parameter of?DocumentLinks
type instead of?Links
AbstractResource::getLinks()
returns?ResourceLinks
instead ofLinks
AbstractRelationship::getLinks()
returns?RelationshipLinks
instead ofLinks
AbstractRelationship::setLinks()
expects a parameter of?RelationshipLinks
type instead ofLinks
Error::getLinks()
returnsErrorLinks
instead ofLinks
Error::setLinks()
expects a parameter ofErrorLinks
instead ofLinks
- Improvements related to
JsonApiExceptionInterface
(BREAKING CHANGE):JsonApiExceptionInterface
now extendsThrowable
JsonApiExceptionInterface::getErrorDocument()
must return anErrorDocumentInterface
instead of anAbstractErrorDocument
- Improvements related to pagination (BREAKING CHANGE):
- A
$defaultSize
constructor parameter was added toCursorBasedPagination
to define a default value for thepage[size]
query parameter - Properties and methods of
FixedPageBasedPagination
became non-nullable - Properties and methods of
OffsetBasedPagination
became non-nullable - Properties and methods of
PageBasedPagination
became non-nullable - Methods of
PaginationLinkProviderInterface
expect a second parameter with a$queryString
name
- A
- Setting the status code and
Content-Type
header of the JSON:API response is done by theResponder
by default instead ofSerializer
s (BREAKING CHANGE):- The
Responder
class sets the status code and theContent-Type
header of the response, while customSerializer
s can override them optionally SerializerInterface::serialize()
only accepts two arguments instead of 3 as the$responseCode
parameter was removedJsonSerializer
does not set theContent-Type
header and the status code of the response anymore
- The
- Improvements related to relationships (BREAKING CHANGE):
ResponseInterface::getToOneRelationship()
throws an exception instead of returning null if the relationship doesn't existResponseInterface::getToManyRelationship()
throws an exception instead of returning null if the relationship doesn't exist
- The
TransformerTrait::fromSqlToIso8601Time()
method expects a?DateTimeZone
as its second argument instead ofstring
(BREAKING CHANGE)
REMOVED:
- The generic
Links
class (BREAKING CHANGE) - Methods related to pagination class instantiation were removed from
RequestInterface
(BREAKING CHANGE):RequestInterface::getFixedPageBasedPagination()
RequestInterface::getPageBasedPagination()
RequestInterface::getOffsetBasedPagination()
RequestInterface::getCursorBasedPagination()
- Various deprecated classes (BREAKING CHANGE):
WoohooLabs\Yin\JsonApi\Document\AbstractCollectionDocument
: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractCollectionDocument
insteadWoohooLabs\Yin\JsonApi\Document\AbstractDocument
: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractDocument
insteadWoohooLabs\Yin\JsonApi\Document\AbstractErrorDocument
: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractErrorDocument
insteadWoohooLabs\Yin\JsonApi\Document\AbstractSimpleResourceDocument
: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSimpleResourceDocument
insteadWoohooLabs\Yin\JsonApi\Document\AbstractSingleResourceDocument
: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocument
insteadWoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulResourceDocument
: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSuccessfulResourceDocument
insteadWoohooLabs\Yin\JsonApi\Document\ErrorDocument
: useWoohooLabs\Yin\JsonApi\Schema\Document\ErrorDocument
insteadWoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer
: useWoohooLabs\Yin\JsonApi\Schema\Resource\AbstractResource
insteadWoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface
: useWoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterface
insteadWoohooLabs\Yin\JsonApi\Schema\Error
: useWoohooLabs\Yin\JsonApi\Schema\Error\Error
insteadWoohooLabs\Yin\JsonApi\Schema\ErrorSource
: useWoohooLabs\Yin\JsonApi\Schema\Error\ErrorSource
insteadWoohooLabs\Yin\JsonApi\Exception\JsonApiException
: useWoohooLabs\Yin\JsonApi\Exception\AbstractJsonApiException
insteadWoohooLabs\Yin\JsonApi\Request\Request
: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequest
insteadWoohooLabs\Yin\JsonApi\Request\RequestInterface
: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterface
insteadWoohooLabs\Yin\JsonApi\Schema\Link
: useWoohooLabs\Yin\JsonApi\Schema\Link\Link
insteadWoohooLabs\Yin\JsonApi\Schema\LinkObject
: useWoohooLabs\Yin\JsonApi\Schema\Link\LinkObject
instead
- Various deprecated methods (BREAKING CHANGE):
AbstractErrorDocument::getResponseCode()
(useAbstractErrorDocument::getStatusCode()
instead)RequestValidator::lintBody()
(useRequestValidator::validateJsonBody()
instead)ResponseValidator::lintBody()
(useResponseValidator::validateJsonBody()
instead)ResponseValidator::validateBody()
(ResponseValidator::validateJsonApiBody()
)
FIXED:
- Issues with 0 and non-numeric values when using built-in pagination objects (
PageBasedPagination
,FixedPageBasedPagination
,OffsetBasedPagination
) - Various issues found by static analysis
- Query parameters of pagination links were not encoded properly
- The
page
andfilter
query parameters must have an array value as per the spec - Instead of returning
null
, an exception is thrown when a non-existent relationship is fetched