Skip to content

Commit a1264d6

Browse files
authored
fix(ui): omit empty schema params so eval-backed defaults resolve (#2173)
1 parent 844d563 commit a1264d6

2 files changed

Lines changed: 20 additions & 1 deletion

File tree

ui/src/features/dags/components/dag-execution/__tests__/paramSchemaForm.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,14 @@ describe('paramSchemaForm helpers', () => {
9595
})
9696
).toBe('{"region":"us-west-2","count":5,"debug":false}');
9797
});
98+
99+
it('omits empty string and null values so eval-backed params are not overridden', () => {
100+
expect(
101+
stringifyParamSchemaFormData({
102+
sharedWorkDir: '',
103+
region: 'us-east-1',
104+
optional: null,
105+
} as ParamSchemaFormData)
106+
).toBe('{"region":"us-east-1"}');
107+
});
98108
});

ui/src/features/dags/components/dag-execution/paramSchemaForm.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,20 @@ export function buildParamSchemaUiSchema(
6565

6666
/**
6767
* Serializes schema form data into the parameter payload expected by the start API.
68+
* Empty strings and nulls are omitted so the backend does not treat them as explicit
69+
* overrides (which would skip eval-backed parameters). See dagucloud/dagu#2032.
6870
*/
6971
export function stringifyParamSchemaFormData(
7072
formData: ParamSchemaFormData
7173
): string {
72-
return JSON.stringify(formData);
74+
const filtered: ParamSchemaFormData = {};
75+
for (const [key, value] of Object.entries(formData)) {
76+
if (value === '' || value === null) {
77+
continue;
78+
}
79+
filtered[key] = value;
80+
}
81+
return JSON.stringify(filtered);
7382
}
7483

7584
/**

0 commit comments

Comments
 (0)