[MGNLREST-190] Reference resolvers should work more than 1 level deep Created: 25/Jun/18  Updated: 10/Feb/20  Resolved: 18/Nov/19

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: None
Fix Version/s: 2.1.4

Type: Story Priority: Major
Reporter: Christopher Zimmermann Assignee: Jaroslav Simak
Resolution: Done Votes: 6
Labels: None
Remaining Estimate: 0d
Time Spent: 6h 38m
Original Estimate: Not Specified

Issue Links:
Cloners
Relates
causality
is causing MGNLREST-215 DOC: Configuring depth and repetition... Closed
dependency
relation
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Release notes required:
Yes
Date of First Response:
Epic Link: SPA Editor
Sprint: SPA Editor 9, SPA Editor 10
Story Points: 8

 Description   

User Story:

As a developer I can configure a Delivery endpoint to provide more then one level of reference resolving so that clients of the endpoint can get all of the information they require in one request.

Notes:

Currently the reference resolver can only resolve one level deep which is useful but often does not meet a clients of the endpoints requirements.

For the SPA Editor epic, this is important if a page references a content item which then references an asset. A common case.

For example to get the full information for a tour (from the travel demo) I need

  • the information of the tour node.
  • the information of the tourTypes.
  • the asset referenced  by the tourTypes (to get its icon.)

 



 Comments   
Comment by Will Scheidegger [ 05/Jul/18 ]

The AssetReferenceResolverDefinition only resolves 1 asset. The DAM is an excellent use case for multi-level references. Let's say I have a tour which has a bunch of PDFs or images through one single reference to a dam folder... with the current delivery endpoint not possible if I'm not mistaken.

Comment by Sang Ngo Huu [ 25/Oct/19 ]

jsimak please see my branch: https://git.magnolia-cms.com/projects/VNPD/repos/rest/pull-requests?create&sourceBranch=refs/heads/feature/MGNLREST-107-resolve-references-as-links

Comment by Christopher Zimmermann [ 28/Oct/19 ]

will's comment above is interesting. It is not the key intent of this ticket though, which is about references of references.

If we can solve Will's use case as well that would be great. Otherwise we should create a followup ticket for Will's usecase.

Comment by Christopher Zimmermann [ 06/Nov/19 ]

There was a question in last review - what should the endpoint return when a cycle is detected? I've done some research and have an answer.

Keep a property to limit the depth of the response. Rename it to "referenceDepth" Let's make it optional with a default value of 1.

for example:

referenceDepth: 3

Add a new property which determines what to do when a cycle is detected, not sure the best name:

referenceRepeat: [true/false]

Optional, with a default value of true.

If true - then it outputs the resolved content as normal.

If false - then it only outputs the unresolved UUID reference as string.

 

Reasoning:

Priority of frontend developer is to have their frontend work properly. They expect the reference resolving system, if used, to work and give them their content.

We have default depth of 1, so there wont be any oversized responses here (by default).

If they set a deeper depth and get too large of a response - then they can either shrink the depth or use the referenceRepeat=false.

When referenceRepeat=false - we just return the UUID since any frontend code would then treat it exactly as if the system had not resovled the reference for it.

 

 

 

 

Generated at Mon Feb 12 06:57:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.