fullstorydev / grpcurl

Like cURL, but for gRPC: Command-line tool for interacting with gRPC servers
MIT License
10.75k stars 502 forks source link

Support v1 of server reflection API #312

Open akshayjshah opened 2 years ago

akshayjshah commented 2 years ago

Now that the server reflection schema is stable, it'd be great if grpcurl supported v1 in addition to v1alpha. The new proto schema is identical to the old one, so this should be as simple as trying the v1 URL and falling back to v1alpha if necessary — the remainder of the code can stay unchanged.

It looks like this is blocked on grpc-go shipping an equivalent of google.golang.org/grpc/reflection/grpc_reflection_v1alpha. Is that accurate, or could we make this change independently?

jhump commented 1 year ago

This change can be made independently. grpcurl uses github.com/jhump/protoreflect/grpcreflect under the hood, and that package now supports v1 of server reflection. With the latest version of that package, if using the new grpcreflect.NewClientAuto function, it will try using v1 first and then fallback to v1alpha.

There is no grpcreflect.NewClientV1 (to force use of v1) because, for symmetry with the similar method for v1alpha, it should directly accept a v1 stub. But there is no exported Go types for a stub at that version, so that part of the API is blocked on grpc-go shipping the newer version.