[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: |
|
||||||||
| 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: | |||||||||
| Description |
Steps to reproduceHaving 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 resultsIn the first case, we should not get anything. Actual resultsWe are getting results even with depth: 0 Development notesNow 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. |