Skip to content

Add option to generate single client across all packages for single module #1

Open
@mfridman

Description

@mfridman

Problem

Some projects lean heavily towards structuring RPC services by package. Unfortunately, the current plugin generates code in a way that results in as many clients as there are packages. However, I'd prefer there to always be exactly one client for a given module.

As an example, the BSR v1alpha1 API had most of its definitions in a single package1:

buf.alpha.registry.v1alpha1

However, the new BSR v1 API has its services split across many packages. And likely more packages to come.

buf.registry.owner.v1
buf.registry.module.v1

Proposal

I'd like to add an option (not sure if it should be the default) to generate a client that operates at the module level rather than the package level. This approach would create a single client that encompasses all services across multiple packages within a module.

For example, when generating the bufbuild/registry module, we'd end up with exactly one client that provides access to all services in that module, rather than separate clients for each package. For example,

client := registry.NewClient()
_, err :=  client.OwnerV1.UserService.GetUsers()

Footnotes

  1. Granted, the downside is 34 services were crammed into a single package, making it a bit challenging to understand. But on the flip side, it meant a single client could be generated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions