swapi-graphql icon indicating copy to clipboard operation
swapi-graphql copied to clipboard

The API doesn't work (almost): most of the returned property values are `null`

Open nad182 opened this issue 1 year ago • 2 comments

There must be something wrong with schemas or the way the individual records are fetched.

  1. Go to https://swapi-graphql.netlify.app/
  2. Try any query, requesting different fields. Example:
query MyQuery {
  allPlanets {
    edges {
      cursor
      node {
        climates
        created
        diameter
        edited
        name
      }
    }
  }
}
  1. Observe that most of the fields return as null
{
  "data": {
    "allPlanets": {
      "edges": [
        {
          "cursor": "YXJyYXljb25uZWN0aW9uOjA=",
          "node": {
            "climates": null,
            "created": null,
            "diameter": null,
            "edited": null,
            "name": "Tatooine"
          }
        },
        {
          "cursor": "YXJyYXljb25uZWN0aW9uOjE=",
          "node": {
            "climates": null,
            "created": null,
            "diameter": null,
            "edited": null,
            "name": "Alderaan"
          }
        },
        {
          "cursor": "YXJyYXljb25uZWN0aW9uOjI=",
          "node": {
            "climates": null,
            "created": null,
            "diameter": null,
            "edited": null,
            "name": "Yavin IV"
          }
        },
...
...
    ]
  }
}

nad182 avatar Jan 27 '25 21:01 nad182

I am having the same issues. I use swapi-graphql for an introductory workshop to GraphQL – back in October everything used to be fine but today all participants complained that about null values.

codethief avatar Apr 25 '25 08:04 codethief

The current implementation doesn't fetch all the necessary item-level data, which leads to incomplete cache results. This PR addresses the issue by retrieving full details for each resource entry: https://github.com/graphql/swapi-graphql/pull/243

Oleksandr37 avatar May 12 '25 19:05 Oleksandr37