Graphql Flatdata & multilanguage headers

I have…

  • Read the following guideline: Troubleshooting and Support | Squidex. I understand that my support request might get deleted if I do not follow the guideline.
  • Used code blocks with ``` to format my code examples like JSON or logs properly.

I’m submitting a…

  • Regression (a behavior that stopped working in a new release)
  • Bug report
  • Performance issue
  • [X ] Documentation issue or request

Current behavior

Currently our squidex has 3 languages (IT, EN, FR).
All required fields being called are localizable
Initial call to graphql using X-Languages: it,en,fr and X-Flatten and querying for example:
{
queryMenuItemContents(filter: “data/isRootItem/iv eq true”) {
flatData{
label
children{
flatData{
label
}
}
}
}
}

responds with flatData->label: “Istituzioni”.
However, if i use data or data_dynamic, i end up with this:
“data__dynamic”: {
“children”: {
“iv”: [
“ad8049ae-9d36-4a81-9510-4192a8f9a9cc”,
“cc879e4d-7c72-4809-ae66-7dcf1acb5a51”,
“93c60524-4b5a-40f0-a426-257a239c1cf3”,
“19ecdeb3-abfc-4cf7-998a-6004a120fa01”,
“57549604-f2ae-472c-a010-e081cfaeabf2”,
“04d45944-7ba9-41c1-9987-c1173423cc75”
]
}
]
or
“children”: [
{
“data”: {
“label”: {
“en”: “Institutions”,
“it”: “Istituzioni”,
“fr”: “Institutions”
}
},…
]

Expected behavior

I was expecting that calling with flatData it should still respond with
“flatData”: {
“label”: {
“en”: “Institutions”,
“it”: “Istituzioni”,
“fr”: “Institutions”
}
}

Minimal reproduction of the problem

Environment

App Name:

  • Self hosted with docker
  • Self hosted with IIS
  • Self hosted with other version
  • Cloud version

Version: 7.23

Browser:

  • Chrome (desktop)
  • Chrome (Android)
  • Chrome (iOS)
  • Firefox
  • Safari (desktop)
  • Safari (iOS)
  • IE
  • Edge

Others:

This is not how flatData works. So you want that only invariant fields are “flattened”?

I was looking at the documentation that you’ve supplied and i was under the impression that using the x-flatten: true with graphql in the header should produce
something like you had posted.

X-Flatten: true
{ 
    ...,
    "data": {
        "description": {
            "en": "FoodCo aims to revolutionize the way we eat. Their innovative products focus on sustainability.",
            "fi": "FoodCo pyrkii mullistamaan ruokailutottumuksiamme. Niiden innovatiiviset tuotteet keskittyvät kestävään kehitykseen.",
            "it": null,
            "sv": "FoodCo har som mål att revolutionera vårt sätt att äta. Deras innovativa produkter fokuserar på hållbarhet."
        },
        "founded": 2019
        }
    }
}

so i was expecting something like:

"flatData": {
  "label": {
    "en": "Institutions",
    "it": "Istituzioni",
    "fr": "Institutions"
  }
}

changing from flatData to data in the graphql call and also using X-Flatten i still get the iv

      "label": {
          "en": "Institutions",
          "it": "Istituzioni",
          "fr": "Institutions"
      },
      "contentSchema": {
          "iv": "sezione"
      },

GraphQL is statically typed, you cannot just change the type of a value from an object to a string based on headers or so.

ahh ok.
so i’ll have to post process everything. Thanks

Yes, it is technically not possible. We could introduce new fields, e.g. simplifiedData or so.