Closed ginnj-gilmore closed 6 years ago
@kocsismate That's strange... Travis says a specific test fails relating to the changes I made, but PHPUnit on my local doesn't through any errors. Do you want me to update the WoohooLabs\Yang\Tests\JsonApi\Schema\ResourceObjectTest::toArray()
and WoohooLabs\Yang\Tests\JsonApi\Schema\RelationshipTest::toArray()
tests?
I'll take care of the tests, thank you :) And I'll get back to you when I release the new versions with your fix.
I managed to fix the problem, but it was a bit more tricky than I thought. :) Furthermore, I have just cherry-picked our commits to the 1.2 branch. So I'd like to ask you to test it. If all is good, then I'll release 1.2.1 and 1.3.1.
Please see issue #7 for full information.
JSONAPI spec states to-one relationships with no associated resource should return
{"data": null}
but Yang does not properly account for this when convertingRelationship
to an array. This pull request fixes Yang returning an empty to-many relationship (['data' => []]
) instead of an empty to-one relationship (['data' => null]
).