Skip to main content
Seasoned ⭐️⭐️⭐️
Mar 22, 2023 7:48 PM UTC
Solved

Unable to model a direct relationship as required field in a view using UI

type Employee {

name: String!

department: Department!

}

type Department {

name: String!

}

I can't model a use case where an employee must belong to a department.

Dilini Fernando
Expert ⭐️⭐️⭐️⭐️
Apr 19, 2023 7:41 AM UTC

Hi @Shreyas Mehta,

I hope Anders’s reply was helpful. I’m closing this topic now, please feel free to create a new post if you have any questions.  

Br,
Dilini

4 replies

Anders Hafreager
Practitioner ⭐️⭐️⭐️
Practitioner ⭐️⭐️⭐️
Mar 22, 2023 11:06 PM UTC

Correct. As of today, we don’t support required relation fields like that.

Seasoned ⭐️⭐️⭐️
Mar 23, 2023 1:13 PM UTC

@Anders Hafreager - Is there a work around for this? If not, do you plan to fix this by GA?

Being able to ensure that an employee will always belong to a department is a very common use case in data modeling. 

Anders Hafreager
Practitioner ⭐️⭐️⭐️
Practitioner ⭐️⭐️⭐️
Mar 29, 2023 8:30 AM UTC

There is no workaround. The reason is the following:

If node X is in space A with a reference to node Y in space B.

If I delete my node Y, but don’t have access to delete your node X, what should happen? 

 

I definitely see the use case, but we will not have a solution for this on the short term.

Dilini Fernando
Expert ⭐️⭐️⭐️⭐️
Expert ⭐️⭐️⭐️⭐️
Apr 19, 2023 7:41 AM UTC

Hi @Shreyas Mehta,

I hope Anders’s reply was helpful. I’m closing this topic now, please feel free to create a new post if you have any questions.  

Br,
Dilini