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(),

CommentFileSizeAuthor
#3 3322768-3.patch546 byteskuntal_d
Command icon 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

apmsooner created an issue. See original summary.

apmsooner’s picture

Issue summary: View changes
kuntal_d’s picture

Status: Active » Needs review
StatusFileSize
new546 bytes

Did the changes as mentioned. Please review.

apmsooner’s picture

Status: Needs review » Reviewed & tested by the community
larowlan’s picture

Version: 1.2.3 » 1.2.x-dev
Status: Reviewed & tested by the community » Needs work

Let's update the fixtures in /tests/fixtures here too

Thanks

xaviemirmon made their first commit to this issue’s fork.

xaviemirmon’s picture

@larowlan I've creating an MR with the weights on the fixtures converted to an int.

kuntal_d’s picture

Status: Needs work » Needs review

  • larowlan committed 580e2ab on 1.2.x authored by xaviemirmon
    Issue #3322768 by xaviemirmon, kuntal_d: Weight property should be cast...
larowlan’s picture

Status: Needs review » Fixed

Thanks all - fixed

vipin.mittal18’s picture

@larowlan when we can expect JSON Menu Items D10 pre/stable release?

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.