[MGNLREST-290] When targetting root and depth=0, only return root nodes Created: 20/Nov/20 Updated: 12/Apr/22 |
|
| Status: | Open |
| Project: | Magnolia REST Framework |
| Component/s: | None |
| Affects Version/s: | 2.2.4 |
| Fix Version/s: | None |
| Type: | Improvement | Priority: | Neutral |
| Reporter: | Jonathan Ayala | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| 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)
|
||||||||||||
| Epic Link: | Support | ||||||||||||
| Description |
UpdateThis is by design, but the design is admitteadly not what one expects. You can acheive the expected using the @nodes directive. so for the following examples, use: http://localhost:8080/magnoliaAuthor/.rest/customEndpoint/@nodes When you supply no parameters, then the endpoint uses the "Query Nodes" method -this returns all nodes that are specified in the config, not just the children of the current path. Users often expect that it will use the "Read Node" method. See the documentation for more details: https://docs.magnolia-cms.com/product-docs/6.2/Developing/API/Delivery-API.html#_methods KEEPING THIS TICKET As something to consider in a future version of the endpoint. Steps to reproduce
See good analysis in linked ticket: https://jira.magnolia-cms.com/browse/MGNLREST-356
Expected resultsSince depth is 0, we should only retrieve /travel and /sportstation pages Actual resultsWe get 10 pages regardless the depth in they are located: WorkaroundUse @nodes parameter - see: https://docs.magnolia-cms.com/product-docs/6.2/Developing/API/Delivery-API.html#_methods Development notesThe returned pages are the result of the execution of the following query in info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpoint.queryNodes(String, String, Long, Long) method:
SELECT t.* FROM [nt:base] AS t WHERE t.[jcr:primaryType] = 'mgnl:page'
When indicating a path, info.magnolia.rest.delivery.jcr.v2.JcrDeliveryEndpoint.readNode(String) is executed instead which applies the depth value to the children of the given node as expected. |