Uploaded image for project: 'Magnolia REST Framework'
  1. Magnolia REST Framework
  2. MGNLREST-356

Issue with depth definition parameter, when targetting a root node

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Neutral Neutral
    • None
    • 2.2.11
    • None
    • None

      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.

        Acceptance criteria

              Unassigned Unassigned
              jbenito Javier Benito
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD