Inversed transport layer for Client #79
Nirum compiler currently generates client classes of services by inheriting a service and
Suppose we have 2 services:
One possible way is to subclass these client classes and override hooks like
It's basically because we use inheritance to extend transport. It can be more flexible if we refactor it to use composition instead of inheritance.
The following is how the currently generated code looks like:
class CustomerServiceClient(Client, CustomerService): ...
It should be changed to the following way:
class CustomerServiceClient(CustomerService): def __init__(self, transport: Transport) -> None: ...
In the above
client = CustomerServiceClient(transport=HttpTransport('https://api.example.com/'))
@admire93 Any opinions?
The text was updated successfully, but these errors were encountered: