-
Notifications
You must be signed in to change notification settings - Fork 862
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Describe the bug
When a function signature defines an object with required properties, the advanced auto-generated UI settings cannot set nested fields (e.g., c and d in the example below) as required or set default values for them.
Currently, the UI automatically assigns default values to empty fields, and these defaults are not controllable by the user. This behavior is not ideal for some use cases where we need fields to be undefined when not provided, rather than receiving automatic defaults from the component.
Additionally, there is an isRequired toggle that sometimes appears in the advanced settings of the auto-generated UI, but:
- It's not consistently visible (unclear when it appears)
- When it does appear, it doesn't function properly - setting a field to
isRequireddoesn't save the state - When leaving the advanced settings and returning, the toggle resets to
falseeven if it was previously set totrue
Example
export async function main(
a: {
b: {
c: string
d: string
}
}
) {
return { foo: a };
}
Current behavior:
- Empty fields receive automatic default values (e.g., empty string
''for strings,falsefor booleans,[]for arrays) - Users cannot control these defaults in the advanced UI settings
- Nested object properties cannot be marked as required or have user-defined defaults
- The
isRequiredtoggle (when visible) doesn't persist its state
To reproduce
- Go to Script page
- define a nested object parameter
- go to advanced ui setting to set nested property to required
- failed to achieved the user goal
Expected behavior
Expected behavior:
- When a field value is not provided, it should be
undefined(matching JavaScript argument behavior) - Users should be able to:
- Set fields as required in the advanced UI settings (with the
isRequiredtoggle working consistently) - Set custom default values for fields in the advanced UI settings
- Control whether fields default to
undefinedvs. component-provided defaults
- Set fields as required in the advanced UI settings (with the
- The
isRequiredtoggle should:- Be consistently visible when applicable
- Persist its state when saved
- Properly mark fields as required in the schema
Screenshots
- In advanced setting can not find isRequired toggle
2. default form will fill in a empty string
Browser information
Version 143.0.7499.170 (Official Build) (arm64)
Application version
CE v1.599.3
Additional Context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working