subql
subql copied to clipboard
Circular Relationship failing graphql `codegen`
Prerequisites
- [x] Are you running the latest version(s)?
- [x] Did you check the debugging guide?
- [x] Did you check the FAQs and Discussions?
- [x] Are you reporting to the correct repository?
- [x] Did you search for an existing issue or pull request?
Description
type Token @entity {
whitelistPools: [Pool!]!
}
type Pool @entity {
token0: Token!
}
This would pass subql codegen
, however, it would fail during runtime
with err: "whitelist_pools_id" and "id" are of incompatible types: jsonb and text.
When add derivedFrom
type Token @entity {
whitelistPools: [Pool!]! @derivedFrom(field: "id")
}
type Pool @entity {
token0: Token!
}
This would then fail subql codegen
with error:
Please check entity Token with field whitelistPools has correct relation with entity Pool
These details can help to reproduce the environment the issue is occurring
Steps to Reproduce
run yarn && yarn codegen
https://github.com/bz888/example-subql-graphqlbug/blob/main/schema.graphql