From ccd69f4fada60fa869a6ea1abb9211428a958d9d Mon Sep 17 00:00:00 2001 From: nicosammito Date: Mon, 29 Jun 2026 10:37:07 +0200 Subject: [PATCH 1/2] fix: default value generation --- .../json/DataTypeJSONInputComponent.tsx | 27 ++++++++++--------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx b/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx index a26e2868..09ecf987 100644 --- a/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx +++ b/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx @@ -9,7 +9,7 @@ import { } from "@edition/datatype/components/inputs/json/DataTypeJSONInputEditDialogComponent"; import {DataTypeInputValueComponent} from "@edition/datatype/components/inputs/DataTypeInputValueComponent"; import {useDebouncedCallback} from "use-debounce"; -import {DataInput} from "@code0-tech/triangulum/dist/util/schema.util"; +import {DataInput, ListInput} from "@code0-tech/triangulum/dist/util/schema.util"; export interface EditableJSONEntry { key: string @@ -87,22 +87,23 @@ export const DataTypeJSONInputComponent: React.FC { return { __typename: "LiteralValue", - value: { - ...(Object.entries(schema.properties ?? {})?.map(([key, propSchema]) => { - if (!Array.isArray(propSchema)) { - if (propSchema.input === "data") { - return {[key]: generateDefaultDataValue(propSchema).value} - } - if (propSchema.input === "list") { - return {[key]: []} + value: Object.assign({}, ...Object.entries(schema.properties ?? {}).map(([key, propSchema]) => { + if (!Array.isArray(propSchema)) { + if (propSchema.input === "data") { + return {[key]: generateDefaultDataValue(propSchema).value} + } + if (propSchema.input === "list") { + const itemSchema = (propSchema as ListInput).items?.[0] + if (itemSchema && !Array.isArray(itemSchema) && itemSchema.input === "data") { + return {[key]: [generateDefaultDataValue(itemSchema as DataInput).value]} } - return {[key]: null} + return {[key]: []} } - })) - } + return {[key]: null} + } + })) } } From 5c18cd04eb6a2095c37b2325429776bd458ba8db Mon Sep 17 00:00:00 2001 From: nicosammito Date: Mon, 29 Jun 2026 13:42:03 +0200 Subject: [PATCH 2/2] fix: default value generation --- .../components/inputs/json/DataTypeJSONInputComponent.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx b/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx index 09ecf987..38f864be 100644 --- a/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx +++ b/src/packages/ce/src/datatype/components/inputs/json/DataTypeJSONInputComponent.tsx @@ -19,7 +19,6 @@ export interface EditableJSONEntry { export type DataTypeJSONInputComponentProps = DataTypeInputComponentProps -//TODO render fallback value if undefined based on schema export const DataTypeJSONInputComponent: React.FC = (props) => { const {schema, title, description, suggestions, formValidation, initialValue, onChange} = props