Null equivalence - Fix (#16050)

@charlesBochet 
In workflow codebase, NULL (instead of empty object) is expected on
workflow version object step field, when a new workflow is created for
example.
(packages/twenty-front/src/modules/workflow/workflow-diagram/utils/generateWorkflowDiagram.ts
- 42)
This case is not isolated and it creates many issues.

We decided to format NULL value to equivalent (empty string for text
field, empty object for raw_json) but it seems it complicates the dev x.

To unlock @Devessier I prefer revert the logic, the time we discuss how
to solve this cases.
This commit is contained in:
Etienne
2025-11-25 14:07:32 +01:00
committed by GitHub
parent ab3d48383b
commit 2028a8f9be
5 changed files with 10 additions and 19 deletions
@@ -1,6 +1,7 @@
import { type FieldMetadataTypesToTestForCreateInputValidation } from 'test/integration/graphql/suites/inputs-validation/types/field-metadata-type-to-test';
import { TEST_TARGET_OBJECT_RECORD_ID_FIELD_VALUE } from 'test/integration/graphql/suites/inputs-validation/utils/setup-test-objects-with-all-field-types.util';
import { FieldMetadataType } from 'twenty-shared/types';
import { isEmptyObject } from 'twenty-shared/utils';
export const successfulCreateInputByFieldMetadataType: {
[K in Exclude<
@@ -134,10 +135,7 @@ export const successfulCreateInputByFieldMetadataType: {
rawJsonField: {},
},
validateInput: (record: Record<string, any>) => {
return (
typeof record.rawJsonField === 'object' &&
Object.keys(record.rawJsonField).length === 0
);
return isEmptyObject(record.rawJsonField);
},
},
{
@@ -145,10 +143,7 @@ export const successfulCreateInputByFieldMetadataType: {
rawJsonField: null,
},
validateInput: (record: Record<string, any>) => {
return (
typeof record.rawJsonField === 'object' &&
Object.keys(record.rawJsonField).length === 0
);
return record.rawJsonField === null;
},
},
{