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

Query with default values does not work #155

Closed
ZirgVoice opened this issue Oct 22, 2024 · 2 comments · Fixed by #156
Closed

Query with default values does not work #155

ZirgVoice opened this issue Oct 22, 2024 · 2 comments · Fixed by #156
Assignees
Labels

Comments

@ZirgVoice
Copy link

ZirgVoice commented Oct 22, 2024

A recent fix addressed self-analysis with default values. It seems that queries are no longer working. I'm receiving the following error:

{
  "errors": [
    {
      "message": "Argument \"restart\" got invalid value 0.\nExpected type \"Boolean\", found 0.",
      "path": []
    }
  ]
}

The error occurs when I don't pass anything into the field that has a default value. However, when I provide data for this field, everything works fine.
Query example:
With an error

query Query($runRaceSessionId: ID!, $onlyPaidSims: Boolean!) {
  runRaceSession(id: $runRaceSessionId, onlyPaidSims: $onlyPaidSims)
}
{
  "runRaceSessionId": "01JAT8TRSF3F7AP97A9GCX1E1S",
  "onlyPaidSims": false
}

Without error

query Query($runRaceSessionId: ID!, $onlyPaidSims: Boolean!, $restart: Boolean!) {
  runRaceSession(id: $runRaceSessionId, onlyPaidSims: $onlyPaidSims, restart: $restart)
}
{
  "runRaceSessionId": "01JAT8TRSF3F7AP97A9GCX1E1S",
  "onlyPaidSims": false,
  "restart": false
}
@ZirgVoice ZirgVoice changed the title Query with standard values does not work Query with default values does not work Oct 22, 2024
@NeedleInAJayStack
Copy link
Member

NeedleInAJayStack commented Oct 24, 2024

I believe this PR fixes your issue, can you give it a whirl and let me know? #156

I've also created a Graphiti PR that adds default value tests so hopefully we can catch situations like this a bit sooner: GraphQLSwift/Graphiti#145

@ZirgVoice
Copy link
Author

I believe this PR fixes your issue, can you give it a whirl and let me know? #156

I've also created a Graphiti PR that adds default value tests so hopefully we can catch situations like this a bit sooner: GraphQLSwift/Graphiti#145

Yes. This fixes issue. Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants