-
Couldn't load subscription status.
- Fork 159
update items.validtion to allow single entry inserts to existing array #1507
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
SUPPORT. This is great. |
|
Hey. Thank you for making this commit. Our team is taking a look at it and will let you know if we have any questions. |
|
Just a quick update: still taking a look at this, will have more concrete feedback/questions/approvals in the next 2 weeks, hopefully sooner. In the meantime I'll run the circle CI tests. Thanks for the patience. |
|
Looks like there might be some failing tests? |
| const fields = ct.fields | ||
| const field = fields.getField(this.getFieldId()) | ||
|
|
||
| if (!field.items) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
field would only have a items property if it is of type reference or media. So we might want to add one more check here to make sure we don't unnecessarily add the items field to a field where it wouldn't belong. Something like:
if (!field.items && ['Array', 'Link'].includes(field.type)) {
Summary
Implements fix for issue: #1166
When updating the valid Content Types for a reference Content Model field, you cannot just insert or add a single entry as
validationswill completely write over the existing entries. This requires copying and pasting the list which introduces the risk that someone might do it wrong and wipe out needed values.Instead, we should be able to just add/insert a new value to the array, reducing risk and headache.
Description
implements a new method addItemsValidation that allows you to update existing validations on items without completely writing over the existing values.
Motivation and Context
Given an existing model defined as:
Today if we wanted to add contentModelC to this list of validations, we must redefine the entire array:
Instead it would be desirable to be able to add a single entry:
Todos
None
Screenshots