Log in / Sign up
Content Editing XP
Powered by Canny
Specify relation column as required
Created by Derrick Mehaffy
March 28, 2022
Just wanted to add that the
doesn't work since 4.5.0 where
With that PR the content manager started submitting more complex object as the value for relations fields even if the value was empty. Unfortunately, this object passes through the
validator as it merely checks the value isn’t null or undefined.
The validator will keep working in the REST API as long as the clients won't use this new object syntax. In other words, the validator works but can be circumvented by a specifically crafted request. So don't rely on it, if you positively must enforce the rule.
November 27, 2022
In Strapi v4.3.9 if i add
to the field specification in
the relation seems to be enforced. The UX is a bit subpar: just flashing an error "<field> cannot be null" after trying to save. But better than nothing.
Would be nice if the docs mentioned this. .)
October 11, 2022
Do we know if the strapi team will create a solution for this?
September 14, 2022
Leandro de Paula Borges
Also, be able to set a max and min validation to a relation, since there is some use cases that business need that a component can have at max N entries for a relation.
August 3, 2022
Perhaps this could first be implemented at a user level, and leave the enforcing at the database level for later, as @hunter mentioned in his workaround in
This could mean a very low-cost implementation and would save us from the typicial error of leaving those columns unfilled and creating a 500 error on the frontEnd.
July 28, 2022
Also, better support cascade delete when a required relation entry is deleted
June 11, 2022
Powered by Canny