Skip to content

2.0.0

Compare
Choose a tag to compare
@kocsismate kocsismate released this 04 Mar 16:05
· 91 commits to master since this release
2.0.0
f4bb891

Changes since beta1:

CHANGED:

  • Apply the Woohoo Labs. Coding Standard

Full change set:

ADDED:

  • JSON:API 1.1 related features:
    • Support for Profiles
    • Support for type links in errors
  • Document::errorCount() to easily count errors in the document
  • Support for defining a default value when using the ResourceObject::attribute() method

CHANGED:

  • Improve type-safety by eliminating null return values (BREAKING CHANGE):
    • JsonApiResponse::document() throws an exception instead of returning null if the response doesn't contain a document.
    • Document::primaryResources() throws an exception if the document is a single-resource or error document
    • Document::primaryResource() throws an exception if the document is a collection or error document or the primary resource is missing
    • Document::resource() throws an exception instead of returning null if the requested resource is missing
    • Document::error() throws an exception instead of returning null if the document does not contain the requested error
    • Relationship::resources() throws an exception instead of returning an empty array if the relationship is a to-one
    • Relationship::resource() throws an exception instead of returning null if the relationship is a to-many or empty
    • Relationship::resourceBy() throws an exception instead of returning null if the requested resource is missing
    • ResourceObject::relationship() throws an exception instead of returning null if the requested relationship is missing
  • Move errors, links, and resources to their own namespace (BREAKING CHANGE):
    • WoohooLabs\Yang\JsonApi\Schema\Error to WoohooLabs\Yang\JsonApi\Schema\Error\Error
    • WoohooLabs\Yang\JsonApi\Schema\ErrorSource to WoohooLabs\Yang\JsonApi\Schema\Error\ErrorSource
    • WoohooLabs\Yang\JsonApi\Schema\Link to WoohooLabs\Yang\JsonApi\Schema\Link\Link
    • WoohooLabs\Yang\JsonApi\Schema\ResourceObjects to WoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObjects
    • WoohooLabs\Yang\JsonApi\Schema\ResourceObject to WoohooLabs\Yang\JsonApi\Schema\Resource\ResourceObject
  • Return separate classes instead of a general Links for the different types of links (BREAKING CHANGE):
    • DocumentLinks when using Document::links()
    • ResourceLinks when using ResourceObject::links()
    • RelationshipLinks when using Relationship::links()
    • ErrorLinks when using Error::links()
  • JsonSerializer::serialize() will throw a RequestException instead of LogicException if the body is of invalid type (BREAKING CHANGE)
  • Rename JsonApi to JsonApiObject (BREAKING CHANGE)
  • Apply the Woohoo Labs. Coding Standard

REMOVED:

  • The generic Link class (BREAKING CHANGE)

FIXED:

  • Issues with 0 when converting to array