Stylianos Gakis
03/15/2023, 9:31 AM[x!]
, the backend can return:
• a null list
• an empty list
• a list with items in it.
In any way, on the clients you need to be defensive for both the null list case. And the empty list case
The type can be [x!]!
. This way the backend can return
• an empty list
• a list with items with it.
What we would optimally wish for, is to be able to represent either:
• A null list
• A NonEmpty list
But there currently isn’t a way to represent this in GQL language right?
What we’re opting to go with, is [x!]
and simply put the burden on the backend not to accidentally return a non-null list which is in fact empty. And just to be sure about it, also would need to be defensive about it in the clients in case the backend accidentally does so. That’s our best bet here I assume right?mbonnin
03/15/2023, 9:34 AMStylianos Gakis
03/15/2023, 9:35 AMmbonnin
03/15/2023, 9:36 AMStylianos Gakis
03/15/2023, 9:37 AMmbonnin
03/15/2023, 9:37 AMStylianos Gakis
03/15/2023, 9:38 AMYou can always use a custom scalar albeit there’s no generics in GraphQL so you have to make a new one for each item typeYeah definitely not worth the effort then imo for my use case
mbonnin
03/15/2023, 9:39 AMnull
is a valid response then @nonnull
will make the whole request failStylianos Gakis
03/15/2023, 9:41 AMbod
03/15/2023, 9:41 AMStylianos Gakis
03/15/2023, 9:44 AMbod
03/15/2023, 9:45 AMStylianos Gakis
03/15/2023, 9:46 AM