Re:Why We’re Switching to gRPC
by q3k on Tuesday May 28, 2019 @07:51AM
(#20029150)
This seems like an odd requirement. Are you trying to generate stubs for your API users ahead of time? This will likely not work as generated stubs evolve in lockstep with protoc and runtime support libraries, and thus are not guaranteed to work across discrepant versions. Thus, stub code should be generated alongside the consumer/client. It also likely shouldn't be committed into a VCS.
[ Parent
| on HN ]
It would be done in CI. Generate stubs -> package/compile -> push to internal package repo.
This way your protocol for your infrastructure is just another library.
Having an explicit 'create client library by generating/compiling proto stubs' is generally also bad mojo from my experience, unless you're also abstracting API stability and service discovery. If not, it will be unnecessarily painful to make a change to either the service discovery method or a non-backwards-compatible proto change, as you will have to lockstep both the service rollout, the library build and the client bump.