Skip to content
This repository was archived by the owner on Dec 27, 2022. It is now read-only.
This repository was archived by the owner on Dec 27, 2022. It is now read-only.

Unable to query relation within relation; returns ID only #127

@samOpenforce

Description

@samOpenforce

Using strapi 3.0.0-beta.20 with graphql.

In Strapi we have created a collection-type that has a relation, which in turn has a relation.

When we query, the first relation is shown completely but the next level only delivers the id of the relation

Has this to do with the maximum depth of the query? If so, can this depth be set in the gatsby-source-strapi config?

As an example

we have these collection types:

"job_post"
"job_page"

where each of the "job_post" has a single relation to a "job_page" and might also have a single relation to an "alternative_job_post". If we query this:

query MyQuery {
  allStrapiJobPosts {
    edges {
      node {
        id
        alternative_job_post {
          job_page
        }
      }
    }
  }
}

we receive the following results:

{
  "data": {
    "allStrapiJobPosts": {
      "edges": [
        {
          "node": {
            "id": "Job-posts_1",
            "alternative_job_post": null
          }
        },
        {
          "node": {
            "id": "Job-posts_2",
            "alternative_job_post": null
          }
        },
        {
          "node": {
            "id": "Job-posts_3",
            "alternative_job_post": null
          }
        },
        {
          "node": {
            "id": "Job-posts_4",
            "alternative_job_post": null
          }
        },
        {
          "node": {
            "id": "Job-posts_5",
            "alternative_job_post": {
              "job_page": 1
            }
          }
        }
      ]
    }
  }
}

as you can see the "Job-posts_5" has a relation to an alternative job_post set, but as a result for the "job_page" we just receive the id. The expectation is that we get the complete content of the "job_page" object and not just the id.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions