v2-subgraph icon indicating copy to clipboard operation
v2-subgraph copied to clipboard

Failed to generate types for GraphQL schema

Open digitalsimboja opened this issue 3 years ago • 2 comments

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

digitalsimboja avatar Oct 04 '22 07:10 digitalsimboja

[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!]!

0xMillz avatar May 23 '23 03:05 0xMillz

[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

b5prolh avatar Sep 16 '23 12:09 b5prolh