Package naming for same entity's internal vs public service

54 views
Skip to first unread message

Gorka Lertxundi

unread,
Jun 13, 2019, 3:28:25 AM6/13/19
to grp...@googlegroups.com
Hi people

Currently in our company we're trying to resolve a package naming issue. We would like define a pattern for naming the public vs internal packages. If those APIs are completely different there is no problem at all, i.e, GaragesAPI (internal/private) or CarsAPI (public). But what about the same entity that could have public & private fields and/or methods? For example, CarsAPI has the public facing part (list, get, update -only public fields-) and then internally there is a similar API but with much more capabilities like (update -any fields-, custom methods like transfer ownership, etc.).

So, how does people solve this issue? I'm thinking on something like mycompany.cars.v1 (file mycompany/cars/v1/cars.proto) & mycompany.carsinternal.v1 (file mycompany/carsinternal/v1/carsinternal.proto)?

If someone is thinking on the burden of managing two similar but different APIs (public & internal), don't worry as we already solved how to deal with duplication by creating a custom protobuf extension (mycompany.api.internal) over fields and methods and then autogenerate the public facing proto as it's the one with less fields & methods. Also the stub is autogenerated and cars will call carsinternal automatically.

Thanks!

glert...@gmail.com

unread,
Jul 8, 2019, 11:57:45 AM7/8/19
to grpc.io
In case someone is interested we finally reached to a solution we are comfortable with: https://github.com/uber/prototool/issues/469#issuecomment-509284046.

Sketch - 6.png

kos...@stackpulse.io

unread,
Feb 16, 2020, 4:54:28 AM2/16/20
to grpc.io
Hey
Do you have this protobuf extension on github somewhere?
I would like to use the same method
Reply all
Reply to author
Forward
0 new messages