Is it expected that something like following in s...
# apollo-kotlin
j
Is it expected that something like following in schema
Copy code
someList(id: ID!): [SomeType]
would translate to
Copy code
public val someList: List<SomeType?>?
I understood that overall list could be nullable (and I guess something that `@notnull`could be used for) but didn't think for some reason that list element type would be nullable as well
d
Yeah you'd need the
!
at the end of the type name to get what you expect
Copy code
someList(id: ID!): [SomeType!]
I'm not really sure if there's a good usecase for having the double nullability ever tbh, we've generally managed to get our server devs to only use
[Foo!]
and
[Foo!]!
Edit: I guess if you know you expect exactly N elements in a list it might make sense to return something like
[foo, null, foo, null]
... Error propagation will also differ as you'd be able to coerce an error for a single element into a
null
entry in the list
1
j
Thanks, makes sense
m
the crux of my existence....
😂 2
a
Double null is crucial for federation when you have entities with fields that are not null from other subgraphs. If the field errors out, it bubbles up to the list. If the list has ! For each item, then it goes to the entire list, losing your list of other valid items .
m
@agrosner that was before semantic nullability 😄
😅 1