-
Notifications
You must be signed in to change notification settings - Fork 855
fix(schema): preserve user-defined JSON schema for Python list[dict] parameters #7280
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix(schema): preserve user-defined JSON schema for Python list[dict] parameters #7280
Conversation
Fixes issue where JSON schema properties manually defined in the UI are lost when saving Python scripts with list[dict] or untyped array parameters. Changes: - Preserve all items fields (properties, required, additionalProperties, etc.) - Preserve items.type instead of hardcoding "object" - Preserve type for untyped parameters using nullish coalescing - Add type safety check for items preservation The Python parser cannot infer object properties from list[dict] annotations. This fix preserves user-defined schema fields when parser cannot infer structure. Fixes windmill-labs#7209
Address bot feedback for consistency. The untyped list branch now preserves all user-defined fields (required, additionalProperties, enum, etc.) just like the record[] branch, instead of only preserving properties. This ensures users who define required fields or enum values for untyped list parameters don't lose that data on save. Related to windmill-labs#7209
|
Fixed the inconsistency. The untyped list branch now preserves all user-defined fields (required, additionalProperties, enum, resourceType, contentEncoding, description) just like the record[] branch, instead of only preserving properties. This ensures complete schema preservation regardless of whether the list is typed ( |
|
@hugocasa could you check please |
| } else { | ||
| newS.type = "object"; | ||
| // Preserve existing type when inference fails, default to "object" for undefined/null | ||
| newS.type = oldS.type ?? "object"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rubenfiszel are you ok with this? right now we fallback to "object" when we the type can't be parsed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that feels reasonable, but we may want to try how it behave with a few real world examples of typing live and see the result with new behavior and old behavior
Problem
When defining Python scripts with
list[dict]or untyped array parameters, user-defined JSON schema properties are lost upon saving as draft or deploying. This prevents users from creating proper UI forms for complex data structures like message arrays for LLM calls.Resolves #7209
According to comments made following changes
Frontend:
cli/windmill-utils-internal/src/parse/parse-schema.ts:Testing
Test Case 1:
list[dict]with properties and required fieldsTest Case 2: Untyped array parameter
type: "array"with properties via UITest Case 3: Backward compatibility
Breaking Changes
None. This change only preserves user-defined fields when they exist.