-
Notifications
You must be signed in to change notification settings - Fork 878
fix(schema): preserve user-defined JSON schema for Python list[dict] parameters #7496
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
Conversation
hugocasa
commented
Jan 6, 2026
- fix(schema): preserve user-defined JSON schema for Python list[dict]
- fix(schema): preserve all fields for untyped lists, not just properties
- nits and publish
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 #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 #7209
|
Claude finished @hugocasa's task in 2m 32s —— View job PR Review: fix(schema): preserve user-defined JSON schema for Python list[dict] parameters
SummaryThis PR fixes an issue where user-defined JSON schema properties for Python Changes Overview
Code Quality AssessmentStrengths:
Observations:
Potential Issues
Recommendations
Security ImplicationsNo security concerns identified. This change only affects how schema metadata is preserved during type inference. Performance ConsiderationsThe change has negligible performance impact. The VerdictApprove with minor suggestions - The core fix is correct and addresses the schema preservation issue. The refactoring to use a shared constant improves maintainability. The only recommended improvement is updating the TypeScript interface to include all preserved fields for complete type safety. Testing InstructionsTo verify the changes, navigate to the Script Editor in Windmill, create a Python script with a |
Deploying windmill with
|
| Latest commit: |
d6d0d53
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a2f45076.windmill.pages.dev |
| Branch Preview URL: | https://fix-preserve-python-array-sc.windmill.pages.dev |
| "resourceType", | ||
| "contentEncoding", | ||
| "description", | ||
| ] as (keyof SchemaProperty["items"])[]; |
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.
The ITEMS_PRESERVED_FIELDS array includes "additionalProperties", "required", and "description" which are not defined in the SchemaProperty["items"] interface (lines 20-26). While this works at runtime, it creates a type inconsistency.
Consider updating the items interface to include these fields:
| ] as (keyof SchemaProperty["items"])[]; | |
| ] as (keyof SchemaProperty["items"])[]; | |
| // Note: Consider adding required?, additionalProperties?, and description? | |
| // to the items interface above for complete type safety |
Alternatively, update the interface definition around line 20:
items?: {
type?: "string" | "number" | "bytes" | "object" | "resource";
contentEncoding?: "base64";
enum?: EnumType;
resourceType?: string;
properties?: { [name: string]: SchemaProperty };
required?: string[];
additionalProperties?: boolean;
description?: string;
};