Problem/Motivation
It's difficult to determine the Entity for a Menu Item, or the Menu Item for an entity.
Steps to reproduce
1. Install Drupal and JSON:API Menu Items module
2. Create Node with Menu link
3. Visit `/jsonapi/menu_items/{{menu_name}}` or `/jsonapi/node/{{type}}/{{uuid}}` and try to find link between items.
Proposed resolution
1. Use the JSON:API Hypermedia to make a link between the resources.
2. Create computed relationships between the resources.
Link types:
- menu_item: Node/Entity -> Menu Link Content
- related: Menu Link Content/JSON:API Menu Item -> Node/Entity
- menu_subtree: Node/Entity -> JSON:API Menu Items filtered by menu_item as parent
- menu_siblings: Node/Entity -> JSON:API Menu items filtered by menu_item parent as parent
Remaining tasks
1. Proof of concept approaches
2. Make a decision on correct way to move forward
3. Write code, tests and documentation
User interface changes
N/A
API changes
Unknown
Data model changes
N/A
Release notes snippet
Original report by kentr
I have a menu which contains links to nodes.
I want to get the JSON:API URLS for the nodes that the menu contains.
I don't see a path in the data to connect the dots.
Example
Here's the JSON for the menu item.
Edit: Removed.
That's a page
content type.
The direct URL for the resource is https://example.com/jsonapi/node/page/70f51f4b1-a7d4-4f7d-9530-489a5e6db...
How can I determine the direct URL for the node from the menu item response?