Prisma1: Make Relation Fields Required

Created on 29 Nov 2016  路  8Comments  路  Source: prisma/prisma1

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

areconsole

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.

All 8 comments

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:

image

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

schickling picture schickling  路  3Comments

tbrannam picture tbrannam  路  3Comments

sorenbs picture sorenbs  路  3Comments

akoenig picture akoenig  路  3Comments

notrab picture notrab  路  3Comments