You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following example schema mentioned below, if we query product and then within it we query brands. Subsequently, we can query brands again and so on. We're also making custom models to prevent fetching child objects that might not be used.
What did you expect?
What is the correct way to handle such circular references, preferably without having to make changes in the schema.
Even if such recursive calls were allowed, how do we return the previously fetched object without having query the db again every time such a request is made.
Minimal graphql.schema and models to reproduce
type Brand {
id: ID!
name: String!
products: [Product[
}
type Product{
id: ID!
name: String!
Brands: Brand
}
versions
go run github.com/99designs/gqlgen version v0.14.0-dev
This discussion was converted from issue #2073 on March 25, 2022 12:05.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
What happened?
In the following example schema mentioned below, if we query product and then within it we query brands. Subsequently, we can query brands again and so on. We're also making custom models to prevent fetching child objects that might not be used.
What did you expect?
What is the correct way to handle such circular references, preferably without having to make changes in the schema.
Even if such recursive calls were allowed, how do we return the previously fetched object without having query the db again every time such a request is made.
Minimal graphql.schema and models to reproduce
type Brand {
id: ID!
name: String!
products: [Product[
}
type Product{
id: ID!
name: String!
Brands: Brand
}
versions
go run github.com/99designs/gqlgen version
v0.14.0-devgo version
1.17.8 darwin/arm64Beta Was this translation helpful? Give feedback.
All reactions