-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Generate fake form from metadata #10641
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
thomtrp
commented
Mar 4, 2025
- add name to form field metadata
- extract field generation from object record schema
- use field generation to generate field from metadata
- add tests
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.
PR Summary
This PR introduces utilities for generating fake form responses and fields based on metadata, enabling better testing and development of form-related functionality in the workflow system.
- Added
packages/twenty-server/src/modules/workflow/workflow-builder/workflow-schema/utils/generate-fake-field.ts
to handle both simple and composite field types with comprehensive test coverage - Added
packages/twenty-server/src/modules/workflow/workflow-builder/workflow-schema/utils/generate-fake-form-response.ts
to generate fake form responses from field metadata - Modified
workflow-form-action-settings.type.ts
to include required 'name' field and use FieldMetadataType enum for better type safety - Enhanced
workflow-schema.workspace-service.ts
with newcomputeFormActionOutputSchema
method for form action types - Refactored field generation logic in
generate-fake-object-record.ts
for better modularity and reusability
7 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings | Greptile
...ty-server/src/modules/workflow/workflow-builder/workflow-schema/utils/generate-fake-field.ts
Show resolved
Hide resolved
...orkflow/workflow-builder/workflow-schema/utils/__tests__/generate-fake-form-response.spec.ts
Show resolved
Hide resolved
...orkflow/workflow-builder/workflow-schema/utils/__tests__/generate-fake-form-response.spec.ts
Show resolved
Hide resolved
...odules/workflow/workflow-builder/workflow-schema/utils/__tests__/generate-fake-field.spec.ts
Show resolved
Hide resolved
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.
Interesting! I approve. I left a small question to be sure I understand the scope of this PR.
case WorkflowActionType.FORM: | ||
return this.computeFormActionOutputSchema({ | ||
formMetadata: step.settings.input, | ||
}); |
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.
If I understand well, we pre-compute the output of the FORM step, and we'll replace it once the user submits the form.
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.
exactly. We give the user the shape of the output so he can use it as variables. During execution, the response stored in context should have the same shape as this output schema