Skip to content

Add ability to put generated test clients into separate files from their production equivalents #878

Closed
@davidpasztor

Description

@davidpasztor

Is your feature request related to a problem? Please describe it.

#870 introduced the TestClient=true option for generating test clients, which is great for unit testing client-side gRPC code. However, the current implementation generates the test client code in the same file as the real, production client code, which isn't ideal. The test client code should only be added to the (unit) test target in most scenarios, but due to the fact that it is generated in the same file as its non-test equivalent, this cannot be achieved without manually modifying the generated files (which isn't ideal).

Describe the solution you'd like

It would be great if a new protoc flag was introduced that would enable the test client code to be generated into separate files so that clients don't need to pollute their production targets with test code while also not having to manually edit generated code.

Describe alternatives you've considered

If we deem that most consumers of grpc-swift want their test clients to only be accessible from the test target, instead of adding a new flag, the current implementation could simply be changed, which would result in the test clients automatically being generated into their own files.

Additional context

Add any other context about the feature request here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/enhancementImprovements to existing feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions