Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

issue: Cannot return null for non-nullable field Item.effect. #646

Open
2 of 4 tasks
notaphplover opened this issue Jan 30, 2025 · 0 comments
Open
2 of 4 tasks

issue: Cannot return null for non-nullable field Item.effect. #646

notaphplover opened this issue Jan 30, 2025 · 0 comments
Labels
issue Possible Data Error or Server Bug server Server/API Related

Comments

@notaphplover
Copy link

notaphplover commented Jan 30, 2025

Where are you having the issue

  • GraphQL
  • JSON API

Is the issue affecting one of the two elements below ?

  • Translations
  • Definitions Files (Open API, GraphQL Schema, etc)

Description

When calling the API, a server error is thrown when Item.effect is null.

Just send the following query:

{
  set(id: "dp3") @locale(lang: "en") {
    id,
    name,
    cards {
      abilities { effect, name, type },
      attacks { cost, damage, effect },
      category,
      effect,
      energyType,
      evolveFrom,
      hp,
      id,
      image,
      item { effect, name },
      legal { expanded, standard },
      level,
      name,
      rarity,
      regulationMark,
      resistances { type, value },
      retreat,
      stage,
      suffix,
      trainerType,
      types,
      variants { firstEdition, holo, normal, reverse, wPromo },
      weaknesses { type, value }
    }
  }
}

Expected behavior

API serves a set.

Current behavior

API fails with the folowing payload:

{
  "errors": [
    {
      "message": "Cannot return null for non-nullable field Item.effect.",
      "locations": [
        {
          "line": 20,
          "column": 14
        }
      ],
      "path": [
        "set",
        "cards",
        82,
        "item",
        "effect"
      ]
    }
  ]
}

Context

https://www.apollographql.com/blog/using-nullability-in-graphql#what-happens-if-you-try-to-return-null-for-a-non-null-field

@notaphplover notaphplover added issue Possible Data Error or Server Bug server Server/API Related labels Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue Possible Data Error or Server Bug server Server/API Related
Projects
Status: Todo
Development

No branches or pull requests

1 participant