Uploaded image for project: '[Read Only] - Hippo Site Toolkit 2'
  1. [Read Only] - Hippo Site Toolkit 2
  2. HSTTWO-4280

[SPA++] Always put HippoBean objects as direct children of the content section

    XMLWordPrintable

Details

    • Improvement
    • Status: Closed
    • Normal
    • Resolution: Fixed
    • None
    • 5.3.0
    • None
    • None

    Description

      When a document bean has a reference to another document bean, the referenced beans is always serialized as nested property object of the first bean by Jackson by default.
      So, for example, if there's a reference chain like A -> B -> C documents, the content section in the json api output looks like the following:

      {
        // SNIP
        "content": {
          "u001": {
            // content of A
            "refOfB": {
              // content of B
              "refOfC": {
                // content of C
              }
            }
          }
        }
      }

      See the following screenshot and example json output as-is:

      international_atomic_time.html.json

      I think it would much nicer and more intuitive if it should always look like this instead:

      {
        // SNIP
        "content": {
          "u001": {
            // content of A
            "refOfB": {
              "$ref": "/content/u002"
            }
          },
          "u002": {
            // content of B
            "refOfC": {
              "$ref": "/content/u003"
            }
          },
          "u003": {
            // content of C
          }
        }
      }
      

      Not sure how it would be difficult to change the behavior with Jackson though yet...

      Attachments

        1. homepage.json
          6 kB
          Robbert Kauffman
        2. international_atomic_time.html.json
          48 kB
          Woonsan Ko
        3. objectId_circular_refs.png
          272 kB
          Woonsan Ko

        Activity

          People

            Unassigned Unassigned
            wko Woonsan Ko (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: