I am looking into using grpc for communication between microservices using 
the grpc-go library, because of the reasons outlined 
here: http://www.grpc.io/docs/guides/concepts.html

However, rather than using protobuf as the codec, I want to use graphql as 
callers can define the shape of the response and only fetch the things they 
need.

I have thought of 2 options:
1. Use protobufs to wrap graphql/json. Requests will contain the graphql 
query, variables and the queryname. Responses will just contain a result 
field containing serialized JSON. This method allows me to use existing 
tooling and code generation, but the double encoding bothers me.

2. Create a custom codec (https://godoc.org/google.golang.org/grpc#Codec) 
to decode and encode requests and responses in JSON. This seems like the 
best and cleanest way, but no code generation.

What are your thoughts?

Cheers,
Francis

-- 
You received this message because you are subscribed to the Google Groups 
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/83f41d4e-0729-44f4-bcf8-22d83398e459%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to