fix(Set Node): Null should not throw an error (#7416)

Github issue / Community forum post (link here to close automatically):
This commit is contained in:
Michael Kret
2023-10-12 18:07:12 +03:00
committed by GitHub
parent 46977a2aff
commit e9b6ab04cd
5 changed files with 258 additions and 3 deletions

View File

@@ -21,7 +21,7 @@ const versionDescription: INodeTypeDescription = {
name: 'set',
icon: 'fa:pen',
group: ['input'],
version: [3, 3.1],
version: [3, 3.1, 3.2],
description: 'Change the structure of your items',
subtitle: '={{$parameter["mode"]}}',
defaults: {

View File

@@ -163,6 +163,11 @@ export const validateEntry = (
) => {
let entryValue = entry[entry.type];
const name = entry.name;
if (nodeVersion && nodeVersion >= 3.2 && (entryValue === undefined || entryValue === null)) {
return { name, value: null };
}
const entryType = entry.type.replace('Value', '') as FieldType;
const description = `To fix the error try to change the type for the field "${name}" or activate the option “Ignore Type Conversion Errors” to apply a less strict type validation`;

View File

@@ -182,7 +182,12 @@ export async function execute(
const newData: IDataObject = {};
for (const entry of fields) {
if (entry.type === 'objectValue' && rawFieldsData[entry.name] !== undefined) {
if (
entry.type === 'objectValue' &&
rawFieldsData[entry.name] !== undefined &&
entry.objectValue !== undefined &&
entry.objectValue !== null
) {
entry.objectValue = parseJsonParameter(
resolveRawData.call(this, rawFieldsData[entry.name] as string, i),
node,