Problem/Motivation
The fields array in resource plugin contains a weight property that is returning string value.
'weight' => $menu_link->link->getWeight(),
Steps to reproduce
View output for example jsonapi/menu_items/account and observe the weight property is a string like "10"
Proposed resolution
Cast weight property as integer:
'weight' => (int) $menu_link->link->getWeight(),
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 3322768-3.patch | 546 bytes | kuntal_d |
Issue fork jsonapi_menu_items-3322768
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
apmsooner commentedComment #3
kuntal_d commentedDid the changes as mentioned. Please review.
Comment #4
apmsooner commentedComment #5
larowlanLet's update the fixtures in /tests/fixtures here too
Thanks
Comment #8
xaviemirmon@larowlan I've creating an MR with the weights on the fixtures converted to an int.
Comment #9
kuntal_d commentedComment #11
larowlanThanks all - fixed
Comment #12
vipin.mittal18@larowlan when we can expect JSON Menu Items D10 pre/stable release?
Comment #13
larowlanSee #3288143: Automated Drupal 10 compatibility fixes, we're blocked on #3325083: Fatal error: Declaration of Drupal\jsonapi\Normalizer\JsonapiHypermediaImpostor\JsonapiHypermediaLinkCollectionNormalizer::normalize($link_collection, $format = null, array $context = []) must be compatible with parent