woohoolabs/yin
PSR-7–compatible PHP framework for building JSON:API servers. Provides documents, resources, hydrators, request/response validation, pagination, relationship handling, content negotiation, middleware support, and custom serialization/deserialization.
FIXED:
ADDED:
CHANGED:
FIXED:
ADDED:
CHANGED:
This release is the same as 4.0-beta2. The full change set is the following:
ADDED:
type links in errorsResources can also use the $object property to access the object which is being transformedLinks class
DocumentLinksResourceLinksRelationshipLinksErrorLinksPaginationFactory 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 changed CursorBasedPaginationFixedCursorBasedPaginationProviderTrait for using it in connection with FixedCursorBasedPaginationFixedPageBasedPaginationLinkProviderTrait for using it in connection with FixedPageBasedPaginationResponseInterface::hasToOneRelationship() to determine if a specific To-One relationship existsResponseInterface::hasToManyRelationship() to determine if a specific To-Many relationship existsCHANGED:
justinrainbow/json-schema to v5.2Documents should use the $object property instead of $domainObject (BREAKING CHANGE)AbstractSuccessfulDocument::getLinks() returns ?DocumentLinks instead of ?LinksAbstractErrorDocument::getLinks() returns ?DocumentLinks instead of ?LinksErrorDocument::getLinks() returns ?DocumentLinks instead of ?LinksErrorDocument::setLinks() expects a parameter of ?DocumentLinks type instead of ?LinksAbstractResource::getLinks() returns ?ResourceLinks instead of LinksAbstractRelationship::getLinks() returns ?RelationshipLinks instead of LinksAbstractRelationship::setLinks() expects a parameter of ?RelationshipLinks type instead of LinksError::getLinks() returns ErrorLinks instead of LinksError::setLinks() expects a parameter of ErrorLinks instead of LinksJsonApiExceptionInterface (BREAKING CHANGE):
JsonApiExceptionInterface now extends ThrowableJsonApiExceptionInterface::getErrorDocument() must return an ErrorDocumentInterface instead of an AbstractErrorDocument$defaultSize constructor parameter was added to CursorBasedPagination to define a default value for the page[size] query parameterFixedPageBasedPagination became non-nullableOffsetBasedPagination became non-nullablePageBasedPagination became non-nullablePaginationLinkProviderInterface expect a second parameter with a $queryString nameContent-Type header of the JSON:API response is done by the Responder by default instead of Serializers (BREAKING CHANGE):
Responder class sets the status code and the Content-Type header of the response, while custom Serializers can override them optionallySerializerInterface::serialize() only accepts two arguments instead of 3 as the $responseCode parameter was removedJsonSerializer does not set the Content-Type header and the status code of the response anymoreResponseInterface::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 existTransformerTrait::fromSqlToIso8601Time() method expects a ?DateTimeZone as its second argument instead of string (BREAKING CHANGE)REMOVED:
Links class (BREAKING CHANGE)RequestInterface (BREAKING CHANGE):
RequestInterface::getFixedPageBasedPagination()RequestInterface::getPageBasedPagination()RequestInterface::getOffsetBasedPagination()RequestInterface::getCursorBasedPagination()WoohooLabs\Yin\JsonApi\Document\AbstractCollectionDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractCollectionDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractErrorDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractErrorDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSimpleResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSimpleResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSingleResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSuccessfulResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\ErrorDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\ErrorDocument insteadWoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer: use WoohooLabs\Yin\JsonApi\Schema\Resource\AbstractResource insteadWoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface: use WoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterface insteadWoohooLabs\Yin\JsonApi\Schema\Error: use WoohooLabs\Yin\JsonApi\Schema\Error\Error insteadWoohooLabs\Yin\JsonApi\Schema\ErrorSource: use WoohooLabs\Yin\JsonApi\Schema\Error\ErrorSource insteadWoohooLabs\Yin\JsonApi\Exception\JsonApiException: use WoohooLabs\Yin\JsonApi\Exception\AbstractJsonApiException insteadWoohooLabs\Yin\JsonApi\Request\Request: use WoohooLabs\Yin\JsonApi\Request\JsonApiRequest insteadWoohooLabs\Yin\JsonApi\Request\RequestInterface: use WoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterface insteadWoohooLabs\Yin\JsonApi\Schema\Link: use WoohooLabs\Yin\JsonApi\Schema\Link\Link insteadWoohooLabs\Yin\JsonApi\Schema\LinkObject: use WoohooLabs\Yin\JsonApi\Schema\Link\LinkObject insteadAbstractErrorDocument::getResponseCode() (use AbstractErrorDocument::getStatusCode() instead)RequestValidator::lintBody() (use RequestValidator::validateJsonBody() instead)ResponseValidator::lintBody() (use ResponseValidator::validateJsonBody() instead)ResponseValidator::validateBody() (ResponseValidator::validateJsonApiBody())AbstractRelationship::omitWhenNotIncluded() method (BREAKING CHANGE): use AbstractRelationship::omitDataWhenNotIncluded()FIXED:
PageBasedPagination, FixedPageBasedPagination, OffsetBasedPagination)page and filter query parameters must have an array value as per the specDEPRECATED:
ToOneRelationship::omitWhenNotIncluded(): Use ToOneRelationship::omitDataWhenNotIncluded()ToManyRelationship::omitWhenNotIncluded(): Use ToManyRelationship::omitDataWhenNotIncluded()REMOVED:
AbstractRelationship::omitWhenNotIncluded() method (BREAKING CHANGE): use AbstractRelationship::omitDataWhenNotIncluded()FIXED:
ResourceTypeUnacceptable errorADDED:
type links in errorsResources can also use the $object property to access the object which is being transformedLinks class
DocumentLinksResourceLinksRelationshipLinksErrorLinksPaginationFactory 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 changed CursorBasedPaginationFixedCursorBasedPaginationProviderTrait for using it in connection with FixedCursorBasedPaginationFixedPageBasedPaginationLinkProviderTrait for using it in connection with FixedPageBasedPaginationResponseInterface::hasToOneRelationship() to determine if a specific To-One relationship existsResponseInterface::hasToManyRelationship() to determine if a specific To-Many relationship existsCHANGED:
justinrainbow/json-schema to v5.2Documents should use the $object property instead of $domainObject (BREAKING CHANGE)AbstractSuccessfulDocument::getLinks() returns ?DocumentLinks instead of ?LinksAbstractErrorDocument::getLinks() returns ?DocumentLinks instead of ?LinksErrorDocument::getLinks() returns ?DocumentLinks instead of ?LinksErrorDocument::setLinks() expects a parameter of ?DocumentLinks type instead of ?LinksAbstractResource::getLinks() returns ?ResourceLinks instead of LinksAbstractRelationship::getLinks() returns ?RelationshipLinks instead of LinksAbstractRelationship::setLinks() expects a parameter of ?RelationshipLinks type instead of LinksError::getLinks() returns ErrorLinks instead of LinksError::setLinks() expects a parameter of ErrorLinks instead of LinksJsonApiExceptionInterface (BREAKING CHANGE):
JsonApiExceptionInterface now extends ThrowableJsonApiExceptionInterface::getErrorDocument() must return an ErrorDocumentInterface instead of an AbstractErrorDocument$defaultSize constructor parameter was added to CursorBasedPagination to define a default value for the page[size] query parameterFixedPageBasedPagination became non-nullableOffsetBasedPagination became non-nullablePageBasedPagination became non-nullablePaginationLinkProviderInterface expect a second parameter with a $queryString nameContent-Type header of the JSON:API response is done by the Responder by default instead of Serializers (BREAKING CHANGE):
Responder class sets the status code and the Content-Type header of the response, while custom Serializers can override them optionallySerializerInterface::serialize() only accepts two arguments instead of 3 as the $responseCode parameter was removedJsonSerializer does not set the Content-Type header and the status code of the response anymoreResponseInterface::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 existTransformerTrait::fromSqlToIso8601Time() method expects a ?DateTimeZone as its second argument instead of string (BREAKING CHANGE)REMOVED:
Links class (BREAKING CHANGE)RequestInterface (BREAKING CHANGE):
RequestInterface::getFixedPageBasedPagination()RequestInterface::getPageBasedPagination()RequestInterface::getOffsetBasedPagination()RequestInterface::getCursorBasedPagination()WoohooLabs\Yin\JsonApi\Document\AbstractCollectionDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractCollectionDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractErrorDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractErrorDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSimpleResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSimpleResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSingleResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSuccessfulResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\ErrorDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\ErrorDocument insteadWoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer: use WoohooLabs\Yin\JsonApi\Schema\Resource\AbstractResource insteadWoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface: use WoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterface insteadWoohooLabs\Yin\JsonApi\Schema\Error: use WoohooLabs\Yin\JsonApi\Schema\Error\Error insteadWoohooLabs\Yin\JsonApi\Schema\ErrorSource: use WoohooLabs\Yin\JsonApi\Schema\Error\ErrorSource insteadWoohooLabs\Yin\JsonApi\Exception\JsonApiException: use WoohooLabs\Yin\JsonApi\Exception\AbstractJsonApiException insteadWoohooLabs\Yin\JsonApi\Request\Request: use WoohooLabs\Yin\JsonApi\Request\JsonApiRequest insteadWoohooLabs\Yin\JsonApi\Request\RequestInterface: use WoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterface insteadWoohooLabs\Yin\JsonApi\Schema\Link: use WoohooLabs\Yin\JsonApi\Schema\Link\Link insteadWoohooLabs\Yin\JsonApi\Schema\LinkObject: use WoohooLabs\Yin\JsonApi\Schema\Link\LinkObject insteadAbstractErrorDocument::getResponseCode() (use AbstractErrorDocument::getStatusCode() instead)RequestValidator::lintBody() (use RequestValidator::validateJsonBody() instead)ResponseValidator::lintBody() (use ResponseValidator::validateJsonBody() instead)ResponseValidator::validateBody() (ResponseValidator::validateJsonApiBody())FIXED:
PageBasedPagination, FixedPageBasedPagination, OffsetBasedPagination)page and filter query parameters must have an array value as per the specThis is a release with several deprecations in order to ensure forward compatibility with Yin 4.0.
DEPRECATED:
WoohooLabs\Yin\JsonApi\Document\AbstractCollectionDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractCollectionDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractErrorDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractErrorDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSimpleResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSimpleResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSingleResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSingleResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\AbstractSuccessfulResourceDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\AbstractSuccessfulResourceDocument insteadWoohooLabs\Yin\JsonApi\Document\ErrorDocument: use WoohooLabs\Yin\JsonApi\Schema\Document\ErrorDocument insteadWoohooLabs\Yin\JsonApi\Transformer\AbstractResourceTransformer: use WoohooLabs\Yin\JsonApi\Schema\Resource\AbstractResource insteadWoohooLabs\Yin\JsonApi\Transformer\ResourceTransformerInterface: use WoohooLabs\Yin\JsonApi\Schema\Resource\ResourceInterface insteadWoohooLabs\Yin\JsonApi\Schema\Error: use WoohooLabs\Yin\JsonApi\Schema\Error\Error insteadWoohooLabs\Yin\JsonApi\Schema\ErrorSource: use WoohooLabs\Yin\JsonApi\Schema\Error\ErrorSource insteadWoohooLabs\Yin\JsonApi\Exception\JsonApiException: use WoohooLabs\Yin\JsonApi\Exception\AbstractJsonApiException insteadWoohooLabs\Yin\JsonApi\Request\Request: use WoohooLabs\Yin\JsonApi\Request\JsonApiRequest insteadWoohooLabs\Yin\JsonApi\Request\RequestInterface: use WoohooLabs\Yin\JsonApi\Request\JsonApiRequestInterface insteadWoohooLabs\Yin\JsonApi\Schema\Link: use WoohooLabs\Yin\JsonApi\Schema\Link\Link insteadWoohooLabs\Yin\JsonApi\Schema\LinkObject: use WoohooLabs\Yin\JsonApi\Schema\Link\LinkObject insteadAbstractErrorDocument::getResponseCode(): use AbstractErrorDocument::getStatusCode() insteadRequestValidator::lintBody(): use RequestValidator::validateJsonBody() insteadResponseValidator::lintBody(): use ResponseValidator::validateJsonBody() insteadResponseValidator::validateBody(): use ResponseValidator::validateJsonApiBody() insteadFIXED:
fields, include and sort query parametersFIXED:
fields, include and sort query parametersFIXED:
CHANGED:
ExceptionFactoryInterface methods must return JsonApiExceptionInterface (BREAKING CHANGE)AbstractDocument::getJsonApi() and AbstractDocument::getLinks() return types must be declared (BREAKING CHANGE)ResourceTransformerInterface::getLinks() return type must be declared (BREAKING CHANGE)REMOVED:
TransformerTrait::toBool() and TransformerTrait::toInt() methodsFIXED:
CHANGED:
ExceptionFactoryInterface methods must return JsonApiExceptionInterface (BREAKING CHANGE)AbstractDocument::getJsonApi() and AbstractDocument::getLinks() return types must be declared (BREAKING CHANGE)ResourceTransformerInterface::getLinks() return type must be declared (BREAKING CHANGE)REMOVED:
TransformerTrait::toBool() and TransformerTrait::toInt() methodsFIXED:
ADDED:
$code constructor argument of Exceptions when instantiating JsonApiExceptionsCHANGED:
FIXED:
CHANGED:
ADDED:
TransformerTrait::toIso8601Date() and TransformerTrait::toIso8601DateTime()CHANGED:
ADDED:
Responder::okWithRelationship() and Responder::createdWithRelationship()CHANGED:
AbstractSuccessfulDocument from Serializer and Response (BREAKING CHANGE)JsonApi object to JsonApiObject in order to avoid ambiguities (BREAKING CHANGE)DefaultSerializer to JsonSerializer (BREAKING CHANGE)ExceptionFactoryInterface which didn't end with Exception (e.g. createRelationshipNotExists() to createRelationshipNotExistsException()) (BREAKING CHANGE)validateRequest() method (BREAKING CHANGE)HydratorTrait::getAcceptedType() was renamed to HydratorTrait::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:
ADDED:
CHANGED:
validateRequest() method (BREAKING CHANGE)FIXED:
ADDED:
CHANGED:
DefaultSerializer to JsonSerializer (BREAKING CHANGE)ExceptionFactoryInterface which didn't end with Exception (e.g. createRelationshipNotExists() to createRelationshipNotExistsException()) (BREAKING CHANGE)FIXED:
ADDED:
DefaultSerializerFIXED:
AbstractSimpleResourceDocument::getRelationshipContent() didn't return any valueADDED:
Responder::okWithRelationship() and Responder::createdWithRelationship()CHANGED:
AbstractSuccessfulDocument from Serializer and Response (BREAKING CHANGE)JsonApi object to JsonApiObject in order to avoid ambiguities (BREAKING CHANGE)REMOVED:
RelationshipResponder::okWithMeta() method (BREAKING CHANGE)JsonApi::respondWithRelationship() method (BREAKING CHANGE)FIXED:
ADDED:
FIXED:
TransformerTrait() datetime transformer methods identify the ISO-8601 format correctlyCHANGED:
FIXED:
data property from relationships informationADDED:
Collections not implementing ArrayAccess in AbstractCollectionDocumentsCHANGED:
$exceptionFactory and $serializer constructor parameters optional for the JsonApi classPagePagination became PageBasedPagination)FIXED:
FixedPageBasedPagination::getPage(), PageBasedPagination::getPage() and PageBasedPagination::getSize()
now return integer instead of stringCursorBasedPagination::getCursor() now returns integer instead of stringOffsetBasedPagination::getOffset() and OffsetBasedPagination::getLimit() now return integer instead of stringRequest class uses exception factory to throw exceptionADDED:
CHANGED:
RequestRequest::getResourceToOneRelationship() to Request::getToOneRelationship()Request::getResourceToManyRelationship() to Request::getToManyRelationship()Request constructor from __construct(ServerRequestInterface $request) to __construct(ServerRequestInterface $request, ExceptionFactoryInterface $exceptionFactory)REMOVED:
FIXED:
ResourceIdentifier::fromArray() returning null is not handled gracefullyMediaTypeUnacceptable and MediaTypeUnsupported exception messagesFIXED:
FIXED:
ADDED:
Request::getFilteringParam() methodCHANGED:
Request::getResourceAttribute() method when the attribute is not presentFIXED:
FIXED:
ADDED:
FIXED:
ADDED:
CHANGED:
FIXED:
FIXED:
FIXED:
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:
AbstractSimpleResourceDocument to define documents containing information about a single resource without
the need of a resource transformerClientGeneratedIdRequired exceptiongetResourceAttributes() method to RequestInterfacegetResourceToOneRelationship() and getResourceToManyRelationship() methods to RequestInterfaceCHANGED:
TransformerTrait transformations are now type hinted against DateTimeInterface to support DateTimeImmutableFIXED:
AbstractCreateHydrator::hydrate()ADDED:
CHANGED:
getDefaultRelationships() to getDefaultIncludedRelationships() in transformers to better reflect its meaningLinks::addLinks() to Links::setLinks() and Links::addLink() to Links::setLink()REMOVED:
Links::create* static methods to simplify creationRelativeLinks class as it became uselessFIXED:
Responder::getDocumentResourceResponse() was wrongly called staticallyADDED:
RelativeLinks classCHANGED:
ExceptionFactory can be used when validating client-generated ID-s for hydrationRequestInterface::getBodyData* methods to RequestInterface::getResource*FIXED:
TransformerTrait were intended to be non-staticADDED:
ApplicationError and ResourceNotFoundADDED:
ExceptionFactoryInterface which helps you to fully customize error messagesJsonApi::hydrate() helper method to make hydration easierCHANGED:
JsonApiException thus they can be catched easierJsonApi\Document namespace from JsonApi\TransfomerREMOVED:
FetchResponse)FIXED:
ADDED:
CHANGED:
AbstractCompoundDocument to AbstractSuccessfulDocumentResourceTransformerInterface instance instead of AbstractResourceTransformerFIXED:
ToOneRelationships and ToManyRelationships were messed upMediaTypeUnacceptable and MediaTypeUnsupported didn't return the media type nameADDED:
AbstractSingleResourceDocumentCHANGED:
REMOVED:
RelationshipRequest became useless, thus it was removedFIXED:
Request could take significant timeFIXED:
Request::with* methods returned an instance of PSR ServerRequestInterfaceContent-Type and the Accept headers is now compliant with the specADDED:
CHANGED:
CreateHydrator was renamed to AbstractCreateHydratorUpdateHydrator was renamed to AbstractUpdateHydratorAbstractHydrator can be used for update and create requests tooFIXED:
REMOVED:
TransformableInterface and SimpleTransformableInterface as they were unnecessaryFIXED:
LinksTrait and MetaTrait support retrieval of their propertiesADDED:
HydratorsJsonApi classLink::getHref() methodCHANGED:
RequestInterface extends PSR\Http\Message\ServerRequestInterfaceAbstractDocument became public instead of protectedADDED:
AbstractResourceTransformer to support transformationCHANGED:
Request from PSR-7 ServerRequestInterfaceCriteria to Request for future purposesOneToManyTraversableRelationship to ToManyRelationshipOneToOneRelationship to ToOneRelationshipREMOVED:
CompulsoryLinks and PaginatedLinksFIXED:
ADDED:
FIXED:
ADDED:
CHANGED:
REMOVED:
FIXED:
How can I help you explore Laravel packages today?