Implements a destructuring compatability syntax for v1 style in v2#1832
Implements a destructuring compatability syntax for v1 style in v2#1832
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the migration path for Firebase Cloud Functions v1 users transitioning to v2. By implementing a new Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a significant and well-executed refactoring to implement a generic v1 compatibility layer for v2 functions, enabling easier migration. The core change is the new generic addV1Compat function, which replaces provider-specific patching logic. This greatly improves code structure and maintainability. The use of TypeScript overloads to support both v1 and v2 style handlers is a clever approach to maintain type safety for developers. The accompanying test changes are comprehensive and validate the new compatibility layer effectively. I have one minor suggestion to improve robustness in an edge case.
|
Broken into 7 PRs |
Description
V2 handlers that have a corresponding v1 handler will now be able to destructure the original event format.
This allows migration of function declarations without migration of business logic.
NOTE: You can do a YOLO migration with this if you rename your function "fooV2" so the CLI deletes your old one and creates your new one, but this is not a true hand-held migration. You may drop events in the interim. If you want to do a migration before tooling is supported you should do the following:
Code sample
Standalone feature
As a DIY migration tool