-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: data.meta ignored in relationships #89
Conversation
static::assertInstanceOf(Meta::class, $dataMeta); | ||
|
||
$image = $dataMeta->imageDerivatives->links->header->href; | ||
$this->assertEquals('https://example.com/image/header/about-us.jpeg', $image); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is so we can check we're getting specific information back, and not accidentally returning the other Meta object.
Don't need the weird getDataMeta()
23b57b5
to
8b486ac
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, you are absolutely right! I've also added the meta to plural relations in Item::getRelationships
and updated the test.
Released in 1.3.3! |
Thanks for the quick turn-around! |
Detailed description
A JSON:API resource linkage in a relationship object may also include a
meta
member, butjson-api-client
doesn't check for this, which is a bug.Specifically, I'm integrating with a Drupal 9.1.0 JSON:API in which I've enabled the Drupal
consumer_image_styles
module in order to add image style information to an image field in a content entity. The relevant part in therelationships
API response looks like this:Note that
meta
is a property ofdata
.The place in the code which should check for this is in the ItemParser's parseRelationshipData().
Instead, the
return
should be changed to:Context
This helps me integrate with a Drupal JSON:API so that I can get various resized images.
My environment