-
Notifications
You must be signed in to change notification settings - Fork 3
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
New scenario: null keys #75
Conversation
type BookContainer { | ||
book: Book | ||
} | ||
type Book @key(fields: "upc") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you implement a resolver for it? I know it's useless, but if a gateway calls it for some reason, a missing resolver will cause an error and affect the result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done 👍
book = books.find((book) => book.upc === reference.upc); | ||
} | ||
if (book != null) { | ||
// Return this null on purpose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
on what purpose? What's the purpose?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we explain here why it returns null
for a Book with upc === 'b3'?
The query starts from Query.bookContainers
. The id
needs to be resolved from upc
, in order to resolve Book.author. Because Book with upc === 'b3' is not resolved, the author is null.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scenario is;
a
has Book
entities with upc
s b1
, b2
and b3
But b
has Book
entities with only b1
and b2
.
And Hive GW was sending { __typename: "Book", id: null }
to c
subgraph while it should not send it already as id
is non-null
.
No description provided.