ADDED:
CHANGED:
REMOVED:
FIXED:
ADDED:
- #104: Support for validating the hydrated domain object
FIXED:
- #103: Missing data in response if using omitDataWhenNotIncluded
FIXED:
- #101: Parsed body always contains an empty array when using Symfony requests
ADDED:
- #98: Support for validating top-level members in requests
- #96: Support for providing a custom schema path to
ResponseValidator
FIXED:
- #100: Error in createResourceIdInvalidException
- #97: Incorrect encoding of (pagination) query parameters
ADDED:
- Support for PHP 8
- Support for PHPUnit 9
CHANGED:
- Instead of zendframework packages, laminas are required
FIXED:
- #93: Using validateJsonBody() before getResource() makes request body empty
ADDED:
- #90: Support for adding custom links to Resources, Relationships, and Errors
CHANGED:
- Updated JSON:API schema to the latest version
FIXED:
- #83: Fix generated pagination links when using offset-based pagination
- #84: Exception codes are always 0
This release is the same as 4.0-beta2. The full change set is the following:
ADDED:
- JSON:API 1.1 related features:
- Partial support for Profiles
- Support for
typelinks in errors
Resourcescan also use the$objectproperty to access the object which is being transformed- Separate classes for the different types of links instead of the generic
LinksclassDocumentLinksResourceLinksRelationshipLinksErrorLinks
- New capabilities related to pagination:
- #70: Better support for query parameters in pagination links
PaginationFactoryclass to decouple Pagination class instantiation from the requestJsonApi::getPaginationFactory()method to make it easier to retrieve the Pagination FactoryFixedCursorBasedPaginationclass which preserves the original behaviour of the changedCursorBasedPaginationFixedCursorBasedPaginationProviderTraitfor using it in connection withFixedCursorBasedPaginationFixedPageBasedPaginationLinkProviderTraitfor 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-schemato v5.2 Documentsshould use the$objectproperty instead of$domainObject(BREAKING CHANGE)- Links are used strictly according to the spec (BREAKING CHANGE):
AbstractSuccessfulDocument::getLinks()returns?DocumentLinksinstead of?LinksAbstractErrorDocument::getLinks()returns?DocumentLinksinstead of?LinksErrorDocument::getLinks()returns?DocumentLinksinstead of?LinksErrorDocument::setLinks()expects a parameter of?DocumentLinkstype instead of?LinksAbstractResource::getLinks()returns?ResourceLinksinstead ofLinksAbstractRelationship::getLinks()returns?RelationshipLinksinstead ofLinksAbstractRelationship::setLinks()expects a parameter of?RelationshipLinkstype instead ofLinksError::getLinks()returnsErrorLinksinstead ofLinksError::setLinks()expects a parameter ofErrorLinksinstead ofLinks
- Improvements related to
JsonApiExceptionInterface(BREAKING CHANGE):JsonApiExceptionInterfacenow extendsThrowableJsonApiExceptionInterface::getErrorDocument()must return anErrorDocumentInterfaceinstead of anAbstractErrorDocument
- Improvements related to pagination (BREAKING CHANGE):
- A
$defaultSizeconstructor parameter was added toCursorBasedPaginationto define a default value for thepage[size]query parameter - Properties and methods of
FixedPageBasedPaginationbecame non-nullable - Properties and methods of
OffsetBasedPaginationbecame non-nullable - Properties and methods of
PageBasedPaginationbecame non-nullable - Methods of
PaginationLinkProviderInterfaceexpect a second parameter with a$queryStringname
- A
- Setting the status code and
Content-Typeheader of the JSON:API response is done by theResponderby default instead ofSerializers (BREAKING CHANGE):- The
Responderclass sets the status code and theContent-Typeheader of the response, while customSerializers can override them optionally SerializerInterface::serialize()only accepts two arguments instead of 3 as the$responseCodeparameter was removedJsonSerializerdoes not set theContent-Typeheader 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?DateTimeZoneas its second argument instead ofstring(BREAKING CHANGE)
REMOVED:
- The generic
Linksclass (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\AbstractCollectionDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractErrorDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractErrorDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSimpleResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSimpleResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSingleResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSuccessfulResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\ErrorDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\ErrorDocumentinsteadWoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer: useWoohooLabs\Yin\JsonApi\Schema\Resource\AbstractResourceinsteadWoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface: useWoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterfaceinsteadWoohooLabs\Yin\JsonApi\Schema\Error: useWoohooLabs\Yin\JsonApi\Schema\Error\ErrorinsteadWoohooLabs\Yin\JsonApi\Schema\ErrorSource: useWoohooLabs\Yin\JsonApi\Schema\Error\ErrorSourceinsteadWoohooLabs\Yin\JsonApi\Exception\JsonApiException: useWoohooLabs\Yin\JsonApi\Exception\AbstractJsonApiExceptioninsteadWoohooLabs\Yin\JsonApi\Request\Request: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequestinsteadWoohooLabs\Yin\JsonApi\Request\RequestInterface: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterfaceinsteadWoohooLabs\Yin\JsonApi\Schema\Link: useWoohooLabs\Yin\JsonApi\Schema\Link\LinkinsteadWoohooLabs\Yin\JsonApi\Schema\LinkObject: useWoohooLabs\Yin\JsonApi\Schema\Link\LinkObjectinstead
- Various deprecated methods (BREAKING CHANGE):
AbstractErrorDocument::getResponseCode()(useAbstractErrorDocument::getStatusCode()instead)RequestValidator::lintBody()(useRequestValidator::validateJsonBody()instead)ResponseValidator::lintBody()(useResponseValidator::validateJsonBody()instead)ResponseValidator::validateBody()(ResponseValidator::validateJsonApiBody())
- The deprecated
AbstractRelationship::omitWhenNotIncluded()method (BREAKING CHANGE): useAbstractRelationship::omitDataWhenNotIncluded()
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
pageandfilterquery 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
REMOVED:
- The deprecated
AbstractRelationship::omitWhenNotIncluded()method (BREAKING CHANGE): useAbstractRelationship::omitDataWhenNotIncluded()
FIXED:
- Regression with uninitialized Resource properties
- Regression with the source pointer of the
ResourceTypeUnacceptableerror
ADDED:
- JSON:API 1.1 related features:
- Partial support for Profiles
- Support for
typelinks in errors
Resourcescan also use the$objectproperty to access the object which is being transformed- Separate classes for the different types of links instead of the generic
LinksclassDocumentLinksResourceLinksRelationshipLinksErrorLinks
- New capabilities related to pagination:
- #70: Better support for query parameters in pagination links
PaginationFactoryclass to decouple Pagination class instantiation from the requestJsonApi::getPaginationFactory()method to make it easier to retrieve the Pagination FactoryFixedCursorBasedPaginationclass which preserves the original behaviour of the changedCursorBasedPaginationFixedCursorBasedPaginationProviderTraitfor using it in connection withFixedCursorBasedPaginationFixedPageBasedPaginationLinkProviderTraitfor 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-schemato v5.2 Documentsshould use the$objectproperty instead of$domainObject(BREAKING CHANGE)- Links are used strictly according to the spec (BREAKING CHANGE):
AbstractSuccessfulDocument::getLinks()returns?DocumentLinksinstead of?LinksAbstractErrorDocument::getLinks()returns?DocumentLinksinstead of?LinksErrorDocument::getLinks()returns?DocumentLinksinstead of?LinksErrorDocument::setLinks()expects a parameter of?DocumentLinkstype instead of?LinksAbstractResource::getLinks()returns?ResourceLinksinstead ofLinksAbstractRelationship::getLinks()returns?RelationshipLinksinstead ofLinksAbstractRelationship::setLinks()expects a parameter of?RelationshipLinkstype instead ofLinksError::getLinks()returnsErrorLinksinstead ofLinksError::setLinks()expects a parameter ofErrorLinksinstead ofLinks
- Improvements related to
JsonApiExceptionInterface(BREAKING CHANGE):JsonApiExceptionInterfacenow extendsThrowableJsonApiExceptionInterface::getErrorDocument()must return anErrorDocumentInterfaceinstead of anAbstractErrorDocument
- Improvements related to pagination (BREAKING CHANGE):
- A
$defaultSizeconstructor parameter was added toCursorBasedPaginationto define a default value for thepage[size]query parameter - Properties and methods of
FixedPageBasedPaginationbecame non-nullable - Properties and methods of
OffsetBasedPaginationbecame non-nullable - Properties and methods of
PageBasedPaginationbecame non-nullable - Methods of
PaginationLinkProviderInterfaceexpect a second parameter with a$queryStringname
- A
- Setting the status code and
Content-Typeheader of the JSON:API response is done by theResponderby default instead ofSerializers (BREAKING CHANGE):- The
Responderclass sets the status code and theContent-Typeheader of the response, while customSerializers can override them optionally SerializerInterface::serialize()only accepts two arguments instead of 3 as the$responseCodeparameter was removedJsonSerializerdoes not set theContent-Typeheader 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?DateTimeZoneas its second argument instead ofstring(BREAKING CHANGE)
REMOVED:
- The generic
Linksclass (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\AbstractCollectionDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractErrorDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractErrorDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSimpleResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSimpleResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSingleResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSuccessfulResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\ErrorDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\ErrorDocumentinsteadWoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer: useWoohooLabs\Yin\JsonApi\Schema\Resource\AbstractResourceinsteadWoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface: useWoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterfaceinsteadWoohooLabs\Yin\JsonApi\Schema\Error: useWoohooLabs\Yin\JsonApi\Schema\Error\ErrorinsteadWoohooLabs\Yin\JsonApi\Schema\ErrorSource: useWoohooLabs\Yin\JsonApi\Schema\Error\ErrorSourceinsteadWoohooLabs\Yin\JsonApi\Exception\JsonApiException: useWoohooLabs\Yin\JsonApi\Exception\AbstractJsonApiExceptioninsteadWoohooLabs\Yin\JsonApi\Request\Request: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequestinsteadWoohooLabs\Yin\JsonApi\Request\RequestInterface: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterfaceinsteadWoohooLabs\Yin\JsonApi\Schema\Link: useWoohooLabs\Yin\JsonApi\Schema\Link\LinkinsteadWoohooLabs\Yin\JsonApi\Schema\LinkObject: useWoohooLabs\Yin\JsonApi\Schema\Link\LinkObjectinstead
- 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
pageandfilterquery 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
DEPRECATED:
ToOneRelationship::omitWhenNotIncluded(): UseToOneRelationship::omitDataWhenNotIncluded()ToManyRelationship::omitWhenNotIncluded(): UseToManyRelationship::omitDataWhenNotIncluded()
This is a release with several deprecations in order to ensure forward compatibility with Yin 4.0.
DEPRECATED:
- Classes related to Documents:
WoohooLabs\Yin\JsonApi\Document\AbstractCollectionDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractCollectionDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractErrorDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractErrorDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSimpleResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSimpleResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSingleResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulResourceDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\AbstractSuccessfulResourceDocumentinsteadWoohooLabs\Yin\JsonApi\Document\ErrorDocument: useWoohooLabs\Yin\JsonApi\Schema\Document\ErrorDocumentinstead
- Classes related to Resources:
WoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer: useWoohooLabs\Yin\JsonApi\Schema\Resource\AbstractResourceinsteadWoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface: useWoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterfaceinstead
- Classes related to Errors and Exceptions:
WoohooLabs\Yin\JsonApi\Schema\Error: useWoohooLabs\Yin\JsonApi\Schema\Error\ErrorinsteadWoohooLabs\Yin\JsonApi\Schema\ErrorSource: useWoohooLabs\Yin\JsonApi\Schema\Error\ErrorSourceinsteadWoohooLabs\Yin\JsonApi\Exception\JsonApiException: useWoohooLabs\Yin\JsonApi\Exception\AbstractJsonApiExceptioninstead
- Classes related to the Request:
WoohooLabs\Yin\JsonApi\Request\Request: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequestinsteadWoohooLabs\Yin\JsonApi\Request\RequestInterface: useWoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterfaceinstead
- Classes related to Links:
WoohooLabs\Yin\JsonApi\Schema\Link: useWoohooLabs\Yin\JsonApi\Schema\Link\LinkinsteadWoohooLabs\Yin\JsonApi\Schema\LinkObject: useWoohooLabs\Yin\JsonApi\Schema\Link\LinkObjectinstead
- The following methods:
AbstractErrorDocument::getResponseCode(): useAbstractErrorDocument::getStatusCode()insteadRequestValidator::lintBody(): useRequestValidator::validateJsonBody()insteadResponseValidator::lintBody(): useResponseValidator::validateJsonBody()insteadResponseValidator::validateBody(): useResponseValidator::validateJsonApiBody()instead
FIXED:
- #69: Fatal error when providing invalid types in
fields,includeandsortquery parameters
CHANGED:
- Return the
includedarray even when it is empty if theincludeparameter is supplied - PHPUnit 7.0 is minimally required to run tests
FIXED:
CHANGED:
- Increased minimum PHP version requirement to 7.1
ExceptionFactoryInterfacemethods must returnJsonApiExceptionInterface(BREAKING CHANGE)AbstractDocument::getJsonApi()andAbstractDocument::getLinks()return types must be declared (BREAKING CHANGE)ResourceTransformerInterface::getLinks()return type must be declared (BREAKING CHANGE)
REMOVED:
TransformerTrait::toBool()andTransformerTrait::toInt()methods
FIXED:
- Some minor type declaration-related issues
CHANGED:
- Increased minimum PHP version requirement to 7.1
ExceptionFactoryInterfacemethods must returnJsonApiExceptionInterface(BREAKING CHANGE)AbstractDocument::getJsonApi()andAbstractDocument::getLinks()return types must be declared (BREAKING CHANGE)ResourceTransformerInterface::getLinks()return type must be declared (BREAKING CHANGE)
REMOVED:
TransformerTrait::toBool()andTransformerTrait::toInt()methods
FIXED:
- Some minor type declaration-related issues
FIXED:
- #69: Fatal error when providing invalid types in
fields,includeandsortquery parameters
FIXED:
- #68: Fatal error when resource ID is not string
ADDED:
- Possibility to define the
$codeconstructor argument ofExceptions when instantiatingJsonApiExceptions
CHANGED:
- Updated JSON:API schema to the latest version
FIXED:
- #64: Body sent via POST is not retrievable
CHANGED:
- Updated JSON:API schema to the latest version
ADDED:
- Possibility to configure the displayed time zone when using
TransformerTrait::toIso8601Date()andTransformerTrait::toIso8601DateTime()
CHANGED:
- Updated JSON:API schema to the latest version
ADDED:
Responder::okWithRelationship()andResponder::createdWithRelationship()- #58: Allow to set options to the json_encode method
- Support for custom deserializers
- #57: Support for validating the request during hydration
CHANGED:
- Increased minimum PHP version requirement to 7.0
- Documents, Transformers, Hydrators, Serializers and Exceptions must be type hinted strictly (BREAKING CHANGE)
- #51: Decouple
AbstractSuccessfulDocumentfromSerializerandResponse(BREAKING CHANGE) - Renamed
JsonApiobject toJsonApiObjectin order to avoid ambiguities (BREAKING CHANGE) - Renamed
DefaultSerializertoJsonSerializer(BREAKING CHANGE) - Renamed some methods of
ExceptionFactoryInterfacewhich didn't end withException(e.g.createRelationshipNotExists()tocreateRelationshipNotExistsException()) (BREAKING CHANGE) - Hydrators must implement the
validateRequest()method (BREAKING CHANGE) HydratorTrait::getAcceptedType()was renamed toHydratorTrait::getAcceptedTypes()and it should always return an array even if the hydrator can only accept one resource type (BREAKING CHANGE)
REMOVED:
RelationshipResponder::okWithMeta()method (BREAKING CHANGE)JsonApi::respondWithRelationship()method (BREAKING CHANGE)
FIXED:
- #59: Resource schema validating
- Minor problems with request/response validators
- Minor bug fixes
ADDED:
- #57: Support for validating the request during hydration
CHANGED:
- Hydrators must implement the
validateRequest()method (BREAKING CHANGE)
ADDED:
- Support for custom deserializers
CHANGED:
- Renamed
DefaultSerializertoJsonSerializer(BREAKING CHANGE) - Renamed some methods of
ExceptionFactoryInterfacewhich didn't end withException(e.g.createRelationshipNotExists()tocreateRelationshipNotExistsException()) (BREAKING CHANGE)
FIXED:
- #59: Resource schema validating
- Minor problems with request/response validators
ADDED:
Responder::okWithRelationship()andResponder::createdWithRelationship()- #58: Allow to set options to the json_encode method
CHANGED:
- Increased minimum PHP version requirement to 7.0
- Documents, Transformers, Hydrators, Serializers and Exceptions must be type hinted strictly (BREAKING CHANGE)
- #51: Decouple
AbstractSuccessfulDocumentfromSerializerandResponse(BREAKING CHANGE) - Renamed
JsonApiobject toJsonApiObjectin order to avoid ambiguities (BREAKING CHANGE)
REMOVED:
RelationshipResponder::okWithMeta()method (BREAKING CHANGE)JsonApi::respondWithRelationship()method (BREAKING CHANGE)
FIXED:
- Minor bug fixes
FIXED:
- #60: Fixed datetime format method from sql without second argument
ADDED:
- Possibility to configure the
DefaultSerializer
FIXED:
AbstractSimpleResourceDocument::getRelationshipContent()didn't return any value
FIXED:
- Fixed status code of multiple error responses
ADDED:
- Better support for "about" links
FIXED:
- Error status codes are now represented as string as per the spec
TransformerTrait()datetime transformer methods identify the ISO-8601 format correctly
CHANGED:
- #51: Remove sorting of included resources
FIXED:
- #50: Omitting
dataproperty fromrelationshipsinformation
ADDED:
- #19: Support for custom serializers
- Support for using
Collections not implementingArrayAccessinAbstractCollectionDocuments - Docker Compose file to run tests more easily
CHANGED:
- Increased minimum PHP version requirement to PHP 5.6
- Made
$exceptionFactoryand$serializerconstructor parameters optional for theJsonApiclass - Updated JSON:API schema to the latest version
- Renamed pagination provider traits to pagination link provider traits
- Renamed pagination objects to include "Based" (e.g.:
PagePaginationbecamePageBasedPagination) - Improved documentation: added missing sections and fixed a lot of stylistic errors
- Improved test coverage
FIXED:
FixedPageBasedPagination::getPage(),PageBasedPagination::getPage()andPageBasedPagination::getSize()now returnintegerinstead ofstringCursorBasedPagination::getCursor()now returnsintegerinstead ofstringOffsetBasedPagination::getOffset()andOffsetBasedPagination::getLimit()now returnintegerinstead ofstring- #44: Fixed request validation
- #45:
Requestclass uses exception factory to throw exception - #48: PageBasedPaginationProviderTrait getPrevLink and getNextLink generate wrong links
ADDED:
CHANGED:
- Default values can now be defined to several methods of
Request - Slightly optimized request body serialization
- Renamed
Request::getResourceToOneRelationship()toRequest::getToOneRelationship() - Renamed
Request::getResourceToManyRelationship()toRequest::getToManyRelationship() - Changed the signature of the
Requestconstructor from__construct(ServerRequestInterface $request)to__construct(ServerRequestInterface $request, ExceptionFactoryInterface $exceptionFactory)
REMOVED:
- Support for extensions
FIXED:
- #30:
ResourceIdentifier::fromArray()returning null is not handled gracefully MediaTypeUnacceptableandMediaTypeUnsupportedexception messages
FIXED:
- #28: Hydrate attribute with null
FIXED:
- #25: OffsetPagination bug, offset and limit mixup
CHANGED:
- Updated justinrainbow/json-schema to v2.0.0
FIXED:
- #23: Fixed jsonApi object
ADDED:
- Support for PHPUnit 5.0
Request::getFilteringParam()method
CHANGED:
- Updated JSON API schema
- A default value can be provided to
Request::getResourceAttribute()method when the attribute is not present - #20: Expressing empty relationships in the response
FIXED:
- #22: Data member isn't present when fetching a relationship
FIXED:
- #18: Sorting always happens on primary key in resource
ADDED:
- Integrations section to the read me file
FIXED:
- Application errors now have status code 500 instead of 400
- #17: Avoid double stream reading
ADDED:
- Missing sections to the read me file
CHANGED:
- #8: Pass attribute name to the attribute transformer
- #11: Pass relationship name to the relationship transformer
- #10: Pass attribute name to the attribute hydrator closure
- #13: Pass relationship name to the relationship hydrator
- #14: Expect callables instead of closures for hydrators/transformers
- #7: More intuitive example URL-s
FIXED:
- #6: Fixed examples in order not to throw fatal error
- #16: ResourceIdentifier does not consider "data" key
FIXED:
- #5: Attributes and relationships objects are now omitted when empty instead of being serialized as empty arrays
This version incorporates some new methods to easily retrieve the content of the request body and some important bug fixes. It doesn't contain any breaking changes so updating to v10.0 is highly recommended.
ADDED:
AbstractSimpleResourceDocumentto define documents containing information about a single resource without the need of a resource transformerClientGeneratedIdRequiredexceptiongetResourceAttributes()method toRequestInterfacegetResourceToOneRelationship()andgetResourceToManyRelationship()methods toRequestInterface
CHANGED:
TransformerTraittransformations are now type hinted againstDateTimeInterfaceto supportDateTimeImmutable
FIXED:
- Parameter order in
AbstractCreateHydrator::hydrate() - #3: Fixed multi-level relationships
- Issue when include query param is an empty string
ADDED:
- Possibility to pass additional meta information for documents when fetching the response
- #2: Possibility to only load relationship data when the relationship itself is included
CHANGED:
- Renamed
getDefaultRelationships()togetDefaultIncludedRelationships()in transformers to better reflect its meaning - The "data" key of relationships won't be present in the response when it is empty
- Renamed
Links::addLinks()toLinks::setLinks()andLinks::addLink()toLinks::setLink()
REMOVED:
- Most of the
Links::create*static methods to simplify creation RelativeLinksclass as it became useless
FIXED:
Responder::getDocumentResourceResponse()was wrongly called statically- PHP version constraint in composer.json
ADDED:
- Attributes of the resource in the request body can be retrieved easier
- Even better support for relative links via the
RelativeLinksclass
CHANGED:
- ID of the hydrated resource also gets validated when it is missing
- The provided
ExceptionFactorycan be used when validating client-generated ID-s for hydration - Renamed
RequestInterface::getBodyData*methods toRequestInterface::getResource*
FIXED:
- Methods of
TransformerTraitwere intended to be non-static
ADDED:
ApplicationErrorandResourceNotFound- Mentioning optional Composer dependencies in the readme
ADDED:
- A separate responder class
ExceptionFactoryInterfacewhich helps you to fully customize error messagesJsonApi::hydrate()helper method to make hydration easier- Integrated content negotiation and request/response validation from Woohoo Labs. Yin-Middleware
- Even more extensive documentation
CHANGED:
- JSON API exceptions extend
JsonApiExceptionthus they can be catched easier - Documents are moved to
JsonApi\Documentnamespace fromJsonApi\Transfomer - Refactored transformation to fix inclusion of multiple identical resource objects
- When the data member is missing from the top source, the appropriate exception is thrown
REMOVED:
- Different types of responses (e.g.:
FetchResponse)
FIXED:
- Compound documents now can't include more than one resource object for each type and id pair
- Request body was always null
- Single resource documents didn't contain the data top-level member unless resource ID was 1
ADDED:
- More convenient handling of inappropriate relationship types during hydration
- Much more unit tests (320+ tests, 92% coverage)
- Better and more documentation
CHANGED:
- Simplified relative links
- Included resources are now sorted by type and id
- Renamed
AbstractCompoundDocumenttoAbstractSuccessfulDocument - Documents now require a
ResourceTransformerInterfaceinstance instead ofAbstractResourceTransformer
FIXED:
- Meta data didn't appear in error objects
- Empty version information appeared in jsonApi object
- Constructors of
ToOneRelationshipsandToManyRelationshipswere messed up - Getters in
MediaTypeUnacceptableandMediaTypeUnsupporteddidn't return the media type name - Pagination objects are now correctly instantiated from query parameters
- Validation of query parameters didn't work
- Getting the list of included relationships didn't work as expected
- Status code of error responses was always "500" when the document contained multiple errors
- Content-Type header media types of responses are now correctly assembled when using extensions
- Fatal error when the hydrated resource type didn't match the acceptable type
- Various issues of pagination providers
ADDED:
- Support for much easier generation of pagination links
- Shortcut to get the resource ID in
AbstractSingleResourceDocument - Support for relative URI-s
CHANGED:
- Improved transformation performance
- Included resources are now sorted by type instead of ID
REMOVED:
RelationshipRequestbecame useless, thus it was removed
FIXED:
- Instantiation of
Requestcould take significant time - Sparse fieldsets and inclusion of relationships are now fully compliant with the spec
- Links with null value can be included in the response
FIXED:
- Some exceptions had errorous namespaces
Request::with*methods returned an instance of PSRServerRequestInterface- Validation of the
Content-Typeand theAcceptheaders is now compliant with the spec
ADDED:
- Support for proper content negotiation
- Support for validation of query parameters
- Support for retrieving the requested extensions
- Full replacement and removal of relationships can be prohibited
- Exception can be raised when an unrecognized sorting parameter is received
CHANGED:
CreateHydratorwas renamed toAbstractCreateHydratorUpdateHydratorwas renamed toAbstractUpdateHydratorAbstractHydratorcan be used for update and create requests too- Improved and more extensive documentation
FIXED:
- Meta responses follow the specification
REMOVED:
TransformableInterfaceandSimpleTransformableInterfaceas they were unnecessary
FIXED:
- Fixed issue with possible request body parsing
- The included key is not sent if it is empty
- Do not mutate the original responses
LinksTraitandMetaTraitsupport retrieval of their properties- The response body is cleared before assembling the response
- Errors now don't contain null fields
- Errors can contain links and a source
- Automatically determine the status code of an error document if it is not explicitly set
ADDED:
- Support for creation and update of resources via
Hydrators JsonApiclass- Response classes
Link::getHref()method
CHANGED:
RequestInterfaceextendsPSR\Http\Message\ServerRequestInterface- Several methods of
AbstractDocumentbecame public instead of protected - Substantially refactored and improved examples
ADDED:
- Support for proper and automatic fetching of relationships
- Convenience methods for
AbstractResourceTransformerto support transformation - Convenience methods for links and relationships
- Examples about relationships
CHANGED:
- Decoupled
Requestfrom PSR-7ServerRequestInterface - Simplified document creation and transformation
- Renamed
CriteriatoRequestfor future purposes - Renamed
OneToManyTraversableRelationshiptoToManyRelationship - Renamed
OneToOneRelationshiptoToOneRelationship
REMOVED:
CompulsoryLinksandPaginatedLinks
FIXED:
- Transformation of resource relationships
- Transformation of meta element at the top level
- Transformation of null resources
ADDED:
- Examples
FIXED:
- Processing of sparse fieldsets
- Processing of included relationships
- Transformation of JsonApi and meta objects
- Initial release