The good practice for relations in GraphQL is using the connection model with edge and node elements. The recommendation is also for both edge and node to be nullable. This is how e.g. graphene-sqlalchemy, that I use will map the SQL relations.
My question is: why? As far as my APIs that serve relational data from SQL database go I can't see any situation in which an edge or a node would be null
. Thus, if I use statically-typed language on the frontend (like Typescript or Elm) I find myself writing a boilerplate that handles situations which will never occur.
How should I understand these null
s in terms of abstract data model? “There is nothing connected” for me would translate as a connection with no edges. Why do I need a null
edge? The null
node bothers me even more “There is a connection, but there is nothing on the other end”? Please explain to me the rationale here.