Getting different output from same field definition in different custom types

Hi, I am using graphql to access my Prismic Data from a gatsby application. I have to different custom types, both having a title field being defined by the following json

"title" : {
    "type" : "StructuredText",
    "config" : {
        "single" : "heading1",
        "label" : "Titel"
    }
}

If I query them with GraphQL by

query SpeakersEnQuery {
  allPrismicSpeakers(filter: {
    lang: {eq: "en-gb"}
  }) {
    edges {
      node {
        data {
          title {
            text
          }
        }
      }
    }
  }
  allPrismicInformation(filter: {
    lang: {eq: "en-gb"}
  }) {
    edges {
      node {
        data {
          title {
            text
          }
        }
      }
    }
  }
}

I expect to get the same result. But in allPrismicInformation, the title is a object, containing text (so title.text works, in allPrismicSpeakers, title is an array containing only one object, which itself contains the text. So I need to include title[0].text.

{
  "data": {
    "allPrismicSpeakers": {
      "edges": [
        {
          "node": {
            "data": {
              "title": [
                {
                  "text": "Lorem"
                }
              ]
            }
          }
        }
      ]
    },
    "allPrismicInformation": {
      "edges": [
        {
          "node": {
            "data": {
              "title": {
                "text": "ipsum"
              }
            }
          }
        }
      ]
    }
  },
  "extensions": {}
}

Does anyone have an idea why this is happening? I noticed this quite often but always thought I might have made a mistake. But this here is quite obvious. I also have a similar problem with links where in on Custom type I get the reference to the linked document and can access it directly and in another custom type using the exact same json definition for the link, I only get the uid of the linked document and need to query it for myself. I think I just overlook something.

Thanks

Hello Daniel,

Welcome to the Prismic Forum, and thanks for reaching out us. I'd be happy to troubleshoot this, but I'll need to check your repository. Could you please share the url of your repository with me? You can send me private message if you don't prefer to share it here.

Thanks,
Priyanka

Solution found by the user:

Ok, I found the solution. The prismic-typepaths files were not created correctly for some Datatypes (including imprint for example) and for others they were (like homepage). That made the difference...

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.