Skip to content

Add gRPC reflection-based discovery and h2c support#453

Merged
ryanfowler merged 6 commits intomainfrom
grpc-reflection
Mar 20, 2026
Merged

Add gRPC reflection-based discovery and h2c support#453
ryanfowler merged 6 commits intomainfrom
grpc-reflection

Conversation

@ryanfowler
Copy link
Owner

Summary

  • add --grpc-list and --grpc-describe for grpcurl-style service discovery
  • make --grpc automatically use reflection when no local proto schema is provided
  • add plaintext loopback h2c support for gRPC calls and discovery
  • reuse reflected descriptors for JSON-to-protobuf conversion, streaming detection, and response formatting
  • update CLI validation, docs, and integration coverage for reflection and offline descriptor workflows

Testing

  • GOCACHE=/tmp/fetch-gocache go test -mod=mod ./internal/fetch ./internal/cli ./internal/client
  • GOCACHE=/tmp/fetch-gocache go test -mod=mod ./integration -run 'TestMain/grpc reflection discovery and calls'

fetch() already calls applyGRPCDefaults before setupGRPC, making the
call inside setupGRPC dead work.
loadDiscoverySchema already fetches the schema via SchemaForSymbol for
the describe symbol. The fallback that retried the same call when
lookupDescribeSymbol failed was dead code — it would return the same
schema and fail identically.
h2c was unconditionally evaluated for all requests, meaning non-gRPC
`--http 2 http://` requests would silently use cleartext HTTP/2. Gate
shouldUseH2C on HasGRPCMode() and remove the misleading HTTPDefault to
HTTP2 mapping that didn't match the client transport switch. Rename
newGRPCClient to newClient since it serves all request types.
@ryanfowler ryanfowler merged commit b857871 into main Mar 20, 2026
10 checks passed
@ryanfowler ryanfowler deleted the grpc-reflection branch March 20, 2026 19:03
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

Successfully merging this pull request may close these issues.

1 participant