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

Generate optional service interfaces with JProtoc #30

Open
rmichela opened this issue Sep 11, 2017 · 5 comments
Open

Generate optional service interfaces with JProtoc #30

rmichela opened this issue Sep 11, 2017 · 5 comments

Comments

@rmichela
Copy link
Collaborator

grpc-java won't generate interfaces for services because it isn't API safe. This make sense in the global sense, but isn't as much of an issue when you own all the code yourself.

Investigate the feasibility of generating client and server interfaces for gRPC stubs with JProtoc.

@kjarrio
Copy link
Contributor

kjarrio commented Aug 8, 2019

I have this. Both for clients and servers, but it still needs some work and testing though but eventually I'll get it cleaned up and pushed, might be a week or so.

@rmichela
Copy link
Collaborator Author

rmichela commented Aug 8, 2019

Fantastic! What do the generated interfaces look like?

@kjarrio
Copy link
Contributor

kjarrio commented Aug 8, 2019

Here's an example of the current state of the server/client interfaces. I'm still playing around with this but any input would be appreciated.

ServerAndClient.zip

@rmichela
Copy link
Collaborator Author

rmichela commented Aug 8, 2019

Thanks. I'll take a look.

@kjarrio
Copy link
Contributor

kjarrio commented Aug 8, 2019

Although this might be off topic for this issue....

I'd suggest moving away from mustache as a template engine, as it's extremely limited.

I'm currently using it to generate clients, servers, models and more for Java, Python and TypeScript+NodeJS. It's especially painful to use it for python because of the way Python handles white space and the templates tend to get very ugly to produce correct output. There might be a way to get it formatted in like I've already done with google-java-format but I haven't checked if there is a similar solution for Python, but I'm guessing it would be much harder to do that automatically though while maintaining the templates looking good.

Before migrating to jProtoc, I did try out the google api compiler, which uses a custom built engine seen here but I think it does too much - because it's almost a complete programming language built as a template engine. It's very interesting but again, too much for a template engine, in my opinion.

I've also had a look at protoc-gen-star from Lyft and it's very complete and efficient, but it's written in Go, and too complex for small or even medium sized projects/organizations.

The options that are worth considering are: Apache Velocity, Apache FreeMarker, or Handlebars.java (which just extends Mustache with the use of helpers)

Each of those has it's pros/cons:

  • Velocity is heavily used within the Java Community, but it would break backwards compatibility with existing projects using jprotoc and mustache.

  • FreeMarker, very powerful and similar to Velocity, but again, it would break compatibility.

  • Handlebars, powerful and extendable, used heavily both within the Java Community and outside, and it's a superset of mustache, which means that it can replace mustache without breaking any existing projects using jprotoc and mustache.

rmichela pushed a commit that referenced this issue Dec 18, 2022
…plugins-maven-install-plugin-3.1.0

build(deps): bump maven-install-plugin from 2.5.2 to 3.1.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants