grpc-web
grpc-web copied to clipboard
Remove Unused bindings for Annotations Imports?
My .proto file includes imports that are never used by the generated JS client - eg.
import google/api/annotations.proto
import "protoc-gen-swagger/options/annotations.proto"
I was able to generate the JS client with protoc-get-grpc-web, however, the generated code includes those imports even though they are not used by the client:
var google_api_annotations_pb = require('../../google/api/annotations_pb.js')
var protoc$gen$swagger_options_annotations_pb = require('../../protoc-gen-swagger/options/annotations_pb.js')
// Lint Errors:
>>> var `google_api_annotations_pb` is declared but its value is never read
>>> var `google_protobuf_empty_pb` is declared but its value is never read
Is there something in place to prevent unused bindings from being included in the generated code?
Similar issue with grpc-gateway code gen: https://github.com/grpc-ecosystem/grpc-gateway/issues/310
Any updates on this? I'm new to grpc-web, my backend is in go, and I don't know what to do about this. (e.g. ../../google/api/annotations_pb.js isn't even a file path that would be within my repo.
Did you work around this somehow @gtalarico ?
Any updates on this? I'm new to grpc-web, my backend is in go, and I don't know what to do about this. (e.g.
../../google/api/annotations_pb.jsisn't even a file path that would be within my repo.Did you work around this somehow @gtalarico ?
I ended up with lines like this in my Makefile:
ls -1 api/pb/*.js | xargs sed -i '/google_api_annotations_pb =/d'
Are there any updates on this?
would love to see some progress on this one, since it's a really annoying issue
the same issue
Is this project alive or dead?
Same issue here. I started with annotating in a side-car yaml and then decided to move the annotations inline in the proto file. But came to find that it is actually a bit annoying for every client to need to satisfy those extra annotation dependencies (python, C++, ..) in the generated code when they dont need them. Its the same problem for grpc-gateway / openapi/swagger
I think my recent PR #1235 should resolve this problem; could some of you try my PR and report if it solves the problem. If not I would like to get a minimal reproducer.