Reputation: 10319
What is the difference between the following type definitions in GraphQL?
[Item]
[Item!]
[Item]!
[Item!]!
In which cases can the list be empty?
Upvotes: 2
Views: 203
Reputation: 10319
[Item]
means that both the list itself as well as its items can be null.[Item!]
means that the list cannot contain null items, but the list itself can be null.[Item]!
means that the list can contain null items, but the list itself cannot be null.[Item!]!
means that both the list itself as well as its items cannot be null.In all four cases, the list can be empty.
Upvotes: 6