Cardinalities aren't taken into account when adding or removing relationships #1107
Labels
bug
component: configurable entities
related to configurable entities
component: submission
Estimate TBD
improvement
medium priority
needs discussion
Describe the bug
We don't take cardinalities into account when adding or removing relationships in the submission or on the edit relationships tab for an archived item.
For example, if you submit a new item that has a relationship with minCardinality 1, you can add that relationship once. But afterwards you can't remove it or replace it. Rest refuses a DELETE request, because that would leave the item without that required relationship, and replacing the relationship is currently implemented as a DELETE followed by a POST.
A PUT would likely work, so we could solve this by checking the cardinality and sending a PUT in the case both min and max are 1. But that would essentially make that relationship a required field for that submission, and that's not how other required fields work
If a title is required, and you fill it in, you're still allowed to clear it afterwards. You get an error message, and you can't deposit your submission until you enter a title, but you can clear it.
I think for the best user experience it should work the same way for relationships in the submission. That is perhaps something we can achieve in the context of #858
We should also keep in mind that the all operations should also be possible for an admin on an archived item in the edit relationships tab. In that case I wouldn't think it is a big problem if we simply disable the remove button for the last relationship that would put the item under the minCardinality limit, ideally with a tooltip explaining why.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
To be discussed
Related work
#858
The text was updated successfully, but these errors were encountered: