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

Adds validation rule @lookup should have nullable return type #55

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

PascalSenn
Copy link
Contributor

No description provided.

To properly handle cases where the requested entity does not exist, such fields should have a nullable return type.
This allows the field to return `null` when an entity matching the provided criteria is not found, following the standard GraphQL practices for representing missing data.

In a distributed system, it is likely that some entities are not be found on other subgraphs, even when those subgraphs contribute fields to the type.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
In a distributed system, it is likely that some entities are not be found on other subgraphs, even when those subgraphs contribute fields to the type.
In a distributed system, it is likely that some entities will not be found on other subgraphs, even when those subgraphs contribute fields to the type.


In this example, `userById` returns a nullable `User` type, aligning with the recommendation.

This counter-example demonstrates a invalid usage:
Copy link

@glen-84 glen-84 Oct 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This counter-example demonstrates a invalid usage:
This counter-example demonstrates an invalid usage:

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

Successfully merging this pull request may close these issues.

2 participants