Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Client-side code generators and Ask Advise for dependent servers #67

Open
danielkurniadi opened this issue Aug 6, 2020 · 1 comment

Comments

@danielkurniadi
Copy link

Let's take a look at your slack example and say we have two server:

  1. ServerOne implements Announce() via gRPC interface (say to announce notif to slack)
  2. ServerTwo needs a server to announce something to slack. It needs to call ServerOne

Well then, I build ServerOne with lileio/lile and get an autogenerated code in Go. Neat and pretty.

How about ServerTwo? Hmmm its a bit tedious because:

  1. To commnicate with ServerOne, developer need to read and understand the proto file of ServerOne. Good thing if ServerOne developers kindly have an API docs.
  2. Then come changes in ServerOne proto file which change the comminication contract between ServerOne and ServerTwo. Then these changes also affect the dependent microservice (ServerTwo)

Ideas

There are two ideas for Go developer to resolve this:

  1. Versioning of API: ServerOne do two version of API: the old schema and new schema. Allowing ServerTwo to slowly migrate.
  2. Autogenerated Client-side: ServerOne can give its protofile to ServerTwo and we can build a code generator for client side.

I want to highlight on the (2) Ideas here and whether it should be supported, what are the Pros and Cons.

Pros

  • Easy migration for dependent services. Using protofile as single source of truth

Cons

  • Generated code in Golang doesn't always adhere to how Go code is written. Some developers think its OK because its an autogenerated code. Hence, if we want this feature we have to make it autgenerated but clean
  • Same problem as above, but this time autogenerated code like that of thrift can yield freaking 50,000 lines of code just
    for 12 endpoints. This pollute the codebase, git commits, and slows down IDE and code intellisense (VSCode, Vim, GoLand, you name it).
@danielkurniadi
Copy link
Author

Hence, what do you think? If you say No to this feature, can you help me suggest what are the neat and efficient way to build a client-side Go application that can communicate with ServerTwo but minimize coupling to ServerOne gRPC schema as much as possible. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant