nodejs
nodejs copied to clipboard
[sync-actions] Type FieldDefinition change from required false to true failed
Description
When I have a fieldDefintion changed from required=false to required=true
{
"name": {
"en": "Subscription order"
},
"description": {
"en": "Subscription order definition"
},
"resourceTypeIds": ["order"],
"fieldDefinitions": [
{
"name": "deliveryDate",
"type": {
"name": "DateTime"
},
"required": true, // changed here from false to true
"label": {
"en": "deliveryDate"
},
"inputHint": "SingleLine"
}
]
}
sync-actions throws an error "Cannot read properties of undefined (reading 'values')
and fails at this line: https://github.com/commercetools/nodejs/blob/4974bb700aa9469282f38da4e40ecbb8bba7d513/packages/sync-actions/src/types-actions.js#L131 When I inspect that code, diffValue has this value:
diffValue = `{
"required": [
false,
true
]
}
Expected Behavior
Since there is no update action for this change I would expect following:
- It would try to remove the fieldDefinition and re-add it with the correct required value. This might not work since there could be resources created based on this type.
- If the previous point doesn't work, it should fail with a nice error describing what is the problem and what could be done.
Hi team, any changes here? Thank you.
I am getting this as well, would be great if it could be fixed