Common Migration Scenarios
Renaming Parameters
When updating parameter names across an API, you need to update both the function definition and all call sites:See dependencies and usages for more on updating parameter names and types.
Adding Required Parameters
When adding a new required parameter to an API:See function calls and callsites for more on handling call sites.
Changing Parameter Types
When updating parameter types:See working with type annotations for more on changing parameter types.
Deprecating Functions
When deprecating an old API in favor of a new one:Bulk Updates to Method Chains
When updating chained method calls, like database queries or builder patterns:Handling Breaking Changes
When making breaking changes to an API, it’s important to:- Identify all affected call sites
- Make changes consistently
- Update related documentation
- Consider backward compatibility
Best Practices
-
Analyze First: Before making changes, analyze all call sites to understand usage patterns
-
Make Atomic Changes: Update one aspect at a time
-
Maintain Backwards Compatibility:
-
Document Changes:
Remember to test thoroughly after making bulk changes to APIs. While Codegen ensures syntactic correctness, you’ll want to verify the semantic correctness of the changes.