Skip to content

bug: Not able to set nested property of an object and array to required or provide default value #7476

@Marshall-Qiu

Description

@Marshall-Qiu

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 isRequired doesn't save the state
  • When leaving the advanced settings and returning, the toggle resets to false even if it was previously set to true

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, false for 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 isRequired toggle (when visible) doesn't persist its state

To reproduce

  1. Go to Script page
  2. define a nested object parameter
  3. go to advanced ui setting to set nested property to required
  4. 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 isRequired toggle working consistently)
    • Set custom default values for fields in the advanced UI settings
    • Control whether fields default to undefined vs. component-provided defaults
  • The isRequired toggle should:
    • Be consistently visible when applicable
    • Persist its state when saved
    • Properly mark fields as required in the schema

Screenshots

  1. In advanced setting can not find isRequired toggle
Image 2. default form will fill in a empty string Image

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 working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions