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

Failed to generate types for GraphQL schema #117

Open
digitalsimboja opened this issue Oct 4, 2022 · 2 comments
Open

Failed to generate types for GraphQL schema #117

digitalsimboja opened this issue Oct 4, 2022 · 2 comments

Comments

@digitalsimboja
Copy link

digitalsimboja commented Oct 4, 2022

After cloning the repo and updating package.json, running graph codegen --output-dir src/types/ throws an error:

GraphQL schema can't have List's with Nullable members.
Error in 'mints' field of type '[Mint]'.
Suggestion: add an '!' to the member type of the List, change from '[Mint]' to '[Mint!]'

Changing Transaction entities fields from:

mints: [Mint]!
burns: [Burn]!
swaps: [Swap]!

to :

mints: [Mint!]
burns: [Burn!]
swaps: [Swap!]

resolves the issue but complains about possible nullable objects in where the entities fields are used/imported at core.ts and helpers.ts

@0xMillz
Copy link

0xMillz commented May 23, 2023

[Mint]! means that the List itself can't be null, [Mint!] means that the List can be Nullable, but none of its members can, and [Mint!]! means that neither the List's members nor the List itself are Nullable.

This should fix it:

mints: [Mint!]!
burns: [Burn!]!
swaps: [Swap!]!

@b5prolh
Copy link

b5prolh commented Sep 16, 2023

[Mint]! means that the List itself can't be null, [Mint!] means that the List can be Nullable, but none of its members can, and [Mint!]! means that neither the List's members nor the List itself are Nullable.

This should fix it:

mints: [Mint!]!
burns: [Burn!]!
swaps: [Swap!]!

mints: [Mint!]!
burns: [Burn!]!
swaps: [Swap!]!

core.ts and helpers.ts will error
image

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

No branches or pull requests

3 participants