Azure / autorest.java

Extension for AutoRest (https://github.com/Azure/autorest) that generates Java code
MIT License
33 stars 82 forks source link

Reduce Number of Methods Generates in Clients #1942

Open alzimmermsft opened 1 year ago

alzimmermsft commented 1 year ago

Currently, depending on the configuration setup, in ClientMethodMapper we can end up generating overloads of methods that'll never be used. For example, if Context is enabled we'll end up with api(params) and api(paramsPlusContext) and if this is being used with a hand-written SDK the non-Context overload will almost never be called as the written layer will handle either propagating a Context or use an empty Context. This has a few downsides, it increases the size of JARs, results in longer compilation times, and skews test code coverage, given that we should look into the following ideas/improvements:

weidongxu-microsoft commented 1 year ago

If the client is generated only for implementation, one might actually use the sync-methods=NONE in readme (that seems to be the original intention) to only generate the Response Rest methods (that likely be the minimum), and wrapper client can do whatever they want?