Skip to content
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

8311 serverless function functions can be executed with any input #8380

Conversation

martmull
Copy link
Contributor

@martmull martmull commented Nov 7, 2024

  • remove ts-morph
  • update inputSchema shape
    image
t.mov

TODO

  • have inputTypes to match the inputSchema type (string, number, boolean, etc...), only string for now
  • handle required/optional inputs
  • handle case when inputSchema changes, fix data reset when switching function

@martmull martmull linked an issue Nov 7, 2024 that may be closed by this pull request
@martmull martmull force-pushed the 8311-serverless-function-functions-can-be-executed-with-any-input branch from e8fcbba to 9a5232e Compare November 7, 2024 16:17
@martmull martmull marked this pull request as ready for review November 7, 2024 16:20
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 updates the serverless function input schema handling to be more flexible and maintainable. Here's a concise summary of the key changes:

  • Replaced ts-morph dependency with native TypeScript compiler API for code introspection and schema generation
  • Added new recursive InputSchema type system supporting nested objects, arrays, and enums
  • Changed serverless function handler from handler(event, context) to main(params) for simpler interface
  • Updated WorkflowEditActionFormServerlessFunction component to handle nested input schemas with path-based access
  • Added getDefaultFunctionInputFromInputSchema utility to generate default values based on schema types

Key points to review:

  • Early returns in serverless-function-publication.listener.ts could skip processing remaining events in batch
  • Use of any type in FunctionInput reduces type safety
  • Consider adding more test cases for getDefaultFunctionInputFromInputSchema to cover edge cases
  • Verify error handling in local driver with new input schema format

21 file(s) reviewed, 21 comment(s)
Edit PR Review Bot Settings | Greptile

@martmull martmull removed the -PR: wip label Nov 8, 2024
Copy link
Contributor

@thomtrp thomtrp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will take time before this gets robust. But looks this is a huge step already. Congrats @martmull 💪

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.

Great job, @martmull! We can merge.

@Devessier Devessier self-requested a review November 8, 2024 10:06
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.

I just spot an any type that could be replaced with a more specific type.

@martmull martmull enabled auto-merge (squash) November 8, 2024 16:12
@martmull martmull merged commit 354ee86 into main Nov 8, 2024
18 checks passed
@martmull martmull deleted the 8311-serverless-function-functions-can-be-executed-with-any-input branch November 8, 2024 16:15
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.

[Serverless function] Functions can be executed with any input
3 participants