Skip to content
This repository has been archived by the owner on Sep 2, 2022. It is now read-only.

Make Relation Fields Required #41

Closed
thomaswright opened this issue Nov 29, 2016 · 8 comments
Closed

Make Relation Fields Required #41

thomaswright opened this issue Nov 29, 2016 · 8 comments

Comments

@thomaswright
Copy link

Add a toggle to make relation fields required, just like you can with scalar fields, when creating a node.

@schickling
Copy link
Member

Very good point. This is fairly important!

@sedubois
Copy link

Any news on this front?

@schickling
Copy link
Member

Hi @sedubois! This feature is now in beta.

Feel free to ping us in Slack to get access to this new feature.

@marktani
Copy link
Contributor

marktani commented Jun 6, 2017

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.

@sedubois
Copy link

sedubois commented Jun 6, 2017

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 field course cannot 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?

@marktani
Copy link
Contributor

marktani commented Jun 6, 2017

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:

image

@sedubois
Copy link

sedubois commented Jun 6, 2017

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.

screen shot 2017-06-06 at 16 22 52

@marktani
Copy link
Contributor

marktani commented Jun 6, 2017

No, this is a separate bug - could you please create a new issue here?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants