Dear,
we are finding ourselves to understand how it is possible to remove null data in list in the result.
For instance, given the schema of a user, where the user is inside a list of users.data
@strawberry.type
class User:
id: int
name: str
We are searching the user in the subfields exploiting the dataloaders and not resolving the entire users in the user resolver.
def resolve_user(info: strawberry.Info, filters) -> str: <-- this is just propagating the ids to the sub type
return filters.ids <-- [1,2,3,9999]
def resolve_name(root: "User", info: strawberry.Info) -> str:
return dataloader.load(root.id).name
I want the users [1,2,3,9999].
What happen is while resolving the name of user 9999 the user is not found and we have nothing to assign to the relative name throwing an error because name can not be null. The error is propagated upper and we nullify the entire user.
Our result is [user 1, user 2, user 3, null].
Is there a way in strawberry to remove the null in the returned list? How is it possible to act in a post process like that?
Thanks
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too