[MGNLREST-356] Issue with depth definition parameter, when targetting a root node Created: 31/Mar/22  Updated: 23/Oct/23  Resolved: 04/Apr/22

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

Type: Bug Priority: Neutral
Reporter: Javier Benito Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
duplicate
duplicates MGNLREST-290 When targetting root and depth=0, onl... Open
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)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Epic Link: Headless Phase 2
Team: DeveloperX

 Description   

Steps to reproduce

Having the following Delivery endpoint definition (restEndpoints/delivery/pages_v1.yaml):
 

workspace: website
limit: 25
depth: 0
includeSystemProperties: true
nodeTypes:
  - mgnl:page
childNodeTypes:
  - mgnl:area
  - mgnl:component 

 

Given that we have, for example these pages structure:
 

--- travel
--- test
------- travel1
------- travel2
------- travel3
....
------- travel1000 

 

When we do this request:

http://localhost:8080/magnoliaAuthor/.rest/delivery/pages/v1?limit=10&offset=0

It seems to be a corner case while applying depth definition parameter to a filtering decorator. In this case, we are targetting the root node.

If we make the request while we have depth: 0 declared in the definition, we would get:
 

{"total":180400,"offset":0,"limit":10,"results":[{"@name":"variant-2","@path":"/test/travel9/contact/variants/variant-2"......}]} 

 

However, if we make the request having depth: 1 declared in the definition, we get the same result:
 

{"total":180400,"offset":0,"limit":10,"results":[{"@name":"variant-2","@path":"/test/travel9/contact/variants/variant-2"......}]} 

Expected results

In the first case, we should not get anything.

Actual results

We are getting results even with depth: 0

Development notes

Now depth parameter is being used in this way (in two places):
 

new DepthFilteringPredicate(node.getDepth(), node.getDepth() + depth) 

 

Maybe we should use it in a different way, depending if node.getDepth() tells that is a root node or not.


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