Skip to content

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

Merged
merged 2 commits into from
Mar 4, 2025
Merged

Conversation

thomtrp
Copy link
Contributor

@thomtrp 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

Copy link
Contributor

@greptile-apps greptile-apps bot left a 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 new computeFormActionOutputSchema 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

@Devessier Devessier self-requested a review March 4, 2025 09:27
Copy link
Contributor

@Devessier Devessier left a 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.

Comment on lines +82 to +85
case WorkflowActionType.FORM:
return this.computeFormActionOutputSchema({
formMetadata: step.settings.input,
});
Copy link
Contributor

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.

Copy link
Contributor Author

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

@thomtrp thomtrp merged commit d151b13 into main Mar 4, 2025
32 checks passed
@thomtrp thomtrp deleted the tt-output-schema-for-form-steps branch March 4, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants