API v2 descendants API should return depth relative to content requested

XMLWordPrintable

      Issue Summary

      Currently the V2 descendants API does not return depth of each descendant in the response, making it hard to figure out which content to trigger recursive calls on.

      Steps to Reproduce

      Call /wiki/api/v2/<content-type>/{id}/descendants

      Expected Results

      Each descendant response contains depth of the descendant relative to the content on which API is called.

      {
        "results": [
          {
            "id": "<string>",
            "status": "current",
            "title": "<string>",
            "parentId": "<string>",
            "childPosition": <number>,
            "type": "<string>",
            "depth": <number>
          }
        ],
        "_links": {
          "next": "<string>",
          "base": "<string>"
        }
      } 

      Actual Results

      Response does not contain depth for each descendant:

      {
        "results": [
          {
            "id": "<string>",
            "status": "current",
            "title": "<string>",
            "parentId": "<string>",
            "childPosition": <number>,
            "type": "<string>"
          }
        ],
        "_links": {
          "next": "<string>",
          "base": "<string>"
        }
      } 

      Workaround

      Interpret the depth by evaluating relationship between parentId and id across the different descendant, starting with the top level content. This can be done by constructing the content tree and traversing it.

            Assignee:
            Neha Kalekar
            Reporter:
            Neha Kalekar
            Votes:
            12 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: