absinthe-graphql/absinthe_relay

Connection and edge types non_null?

davidye opened this issue · 2 comments

Is it possible to make connection and edge types generated from:

connection node_type: :pet

Be wrapped with Non-Null?

This would be useful because relay-compiler now generates flow types automatically so using connections can be type checked without having to:

const nodes = (
  connection &&
  connection.edges &&
  connection.edges.map((edge: any) => edge.node) // edge.node is possibly null
) || []

Thanks!

Just got bitten by this as well. If it's possible to make connections non null-able, it's not too clear how to do so from the documentation. @davidye did you manage to solve in the end? I'd like to see your solution if you found one.

For clarification. It would be great to have the connection object to be at least non null (as it can never be null). And have an option for edges and nodes to be non-nullable, for the latter there is already a PR I believe.