enonic / lib-guillotine

Apache License 2.0
3 stars 0 forks source link

Implement xAsJson #159

Closed alansemenov closed 3 years ago

alansemenov commented 3 years ago

This properties structure of x-data:

"x": {
    "com-enonic-app-hmdb": {
      "SoMe": {
        "imdb": "12",
        "twitter": "123",
        "instagram": "1234"
      }
    }
  }

Will be rendered like this by guillotine

"x": [
  {
     "name": "com-enonic-app-hmdb:SoMe",
     "data": "{imdb=12, twitter=123, instagram=1234}"
   }
]

x.data looks like an array-to-string conversion which is very difficult to parse.

Deprecate current fields and implement the new one called xDataAsJson and xData which will have similar structure to macroAsJson etc.:

"xData": {
  com_enonic_app_hmdb_Some {
         imdb,
         twitter,
         instagram
    }
}
sigdestad commented 3 years ago

I would prefer to break this functionality, and release version 6 instead. It is likely that it has not been used much, given its current state and no complaints.

As such, lets keep x. and xAsJson

alansemenov commented 3 years ago

We don't have xAsJson now, that's what we were going to add with this task (and keep old x deprecated).

sigdestad commented 3 years ago

Ah, then we can indeed start by doing that, and create another task to perform the fully typed implementation.

So, conclusion:

we deprecate x. we implement xAsJson Output should look similar to the node JSON. i.e:

"x": {
    "com-enonic-app-hmdb": {
      "SoMe": {
        "imdb": "12",
        "twitter": "123",
        "instagram": "1234"
      }
    }
  }
anatol-sialitski commented 3 years ago

@sigdestad Should we support x as type as alternative asJson to fetch specific fields?

sigdestad commented 3 years ago

@anatol-sialitski Not sure if I understand the question? Plan is to keep x as it is, and then release 6.0 where x. becomes a fully typed version.

sigdestad commented 3 years ago

So this release will be 5.1