-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Today, it's quite hard for users to mix generated code + handwritten code. You either have to have your handwritten code overwritten every time, generate in a separate folder, and create a convenience layer on top, or use patch_sdk inside a patch.py file, which can be hard to use.
Therefore, for autorest improvement, we want to fix this. The main idea we have here is to make extension classes for each of our clients, and each of our operation groups. Our generated clients and operation groups will now be a combination of generated code + customization classes. We want to keep using the _patch.py file, for this, and we want to have a pattern in this file. For each client and operation group, we will look in the _patch.py file for that object's name + the suffix Customization. Say you are trying to modify the generated client GeneratedClient. Then, in the _patch.py file, you would put your code under GeneratedClientCustomization. I have also mocked roughly the design for how to integrate these customization classes into our clients + operation groups here
Here is a loose structure for implementation, roughly ordered from easier -> harder and building on each other
- Do this one first Remove metadata from version tolerant operations remove metadata property for version-tolerant generation #1035 want this one done earlier, because it will be breaking if we do it after GA of version tolerant
- Add an async patch file add an async patch file #1034
- Generate a patch.py file if none exist generate patch files if a patch file doesn't already exist #1036
- Reconfigure generated code to take into account customization classes + add tests Reconfigure generated code to take patch customization classes #1037
- add samples for how to customize generated code add samples for SDK authors to customize our generated code #1038
- make generated more granular so it's easier for users to customize make generated code more granular for easier customizations #1039