Add a toggle to make relation fields required, just like you can with scalar fields, when creating a node.
Very good point. This is fairly important!
Any news on this front?
Hi @sedubois! This feature is now in beta.
Feel free to ping us in Slack to get access to this new feature.
This is now available to everyone. Note that to-many relational fields are always required. If a node is not connected to any nodes in such a relation, it is the empty list [].
You can set a relation to required both in the UI and the schema file.
If you need more information, please consult the forum.
Thanks great news!
I tried to use this, but I don't see a way to make a relation required through the UI.
I also couldn't make it required through the schema, getting Errors: course: The relation fieldcoursecannot be made required, because there are already instances of the enclosing type that violate this constraint.
However, I only have three instances which all three have a proper value for this field.
I think documentation would be helpful for this. @marktani any pointers?
This looks to be an issue with migrating an existing optional relation to a required relation. Here's a bug tracker: https://github.com/graphcool/api-bugs/issues/90.
You need to hover the relation field to enable the selection between required/optional:

Thanks @marktani. I don't see this required/optional toggle, maybe related to the bug you linked?
Regardless of where I hover with my mouse on this wizard, I don't see this toggle appearing.

No, this is a separate bug - could you please create a new issue here?
Most helpful comment
Hi @sedubois! This feature is now in beta.
Feel free to ping us in Slack to get access to this new feature.