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
{{ message }}
Repository navigation
GreenDonut.DataLoaderBase#LoadAsync should have Task<TValue?> as return type instead of Task<TValue> #2911
To Reproduce
Call the method for example on in instance of a batch data loader whose LoadBatchAsync method always returns an empty dictionary. The return value (after executing the task) is null.
It may return null depending on your implementation. Meaning, if you implement a DataLoader that does not return null then it won't. So, we leave the definition of TValue up to the implementor.
Then maybe it's an issue with the AttendeeByIdDataLoader from the GraphQL workshop? When you call LoadAsync on an instance of it as in AttendeeQueries#GetAttendeeByIdAsync with a valid but non-existent identifier, then null is being returned from LoadAsync and the query responds with an InternalServerError with the code EXEC_NON_NULL_VIOLATION, although all types check. Can't this issue be caught by the type system? Or is the real problem in the implementation of AttendeeByIdDataLoader#LoadBatchAsync which should have one value, either an Attendee instance or null, in the dictionary for each given identifier (which would force the type Attendee?)? Thanks for your great work!
Actually, this is then handled correctly by the execution engine. The execution engine is preventing an item to be null where the type system states that it is non nullable.
Activity
michaelstaib commentedon Jan 21, 2021
It may return null depending on your implementation. Meaning, if you implement a DataLoader that does not return null then it won't. So, we leave the definition of
TValueup to the implementor.simonwacker commentedon Jan 21, 2021
Then maybe it's an issue with the
AttendeeByIdDataLoaderfrom the GraphQL workshop? When you callLoadAsyncon an instance of it as inAttendeeQueries#GetAttendeeByIdAsyncwith a valid but non-existent identifier, thennullis being returned fromLoadAsyncand the query responds with anInternalServerErrorwith the codeEXEC_NON_NULL_VIOLATION, although all types check. Can't this issue be caught by the type system? Or is the real problem in the implementation ofAttendeeByIdDataLoader#LoadBatchAsyncwhich should have one value, either anAttendeeinstance ornull, in the dictionary for each given identifier (which would force the typeAttendee?)? Thanks for your great work!michaelstaib commentedon Jan 21, 2021
Actually, this is then handled correctly by the execution engine. The execution engine is preventing an item to be null where the type system states that it is non nullable.