Open c0b opened 6 years ago
hello?
Looked over protoset pretty quick, appears to be binary encoded file descriptor sets. There is no first-class support, but there's an extension that might be useful: https://github.com/dcodeIO/protobuf.js/tree/master/ext/descriptor
from https://github.com/grpc/grpc-node/issues/550#issuecomment-443163398 I want to report a problem not sure which side can resolve it better?
because most grpc uses this require('@grpc/proto-loader')
package's load
or loadSync
and that's the only exported methods, and it seems the authors of @grpc/proto-loader
are reluctant to export more, the load
or loadSync
method's problem is they do load plain text *.proto
files only,
to make it work with the require("protobufjs/ext/descriptor")
I have to export the createPackageDefinition
method from this module, but they're not willing to do so, so my temporary solution is to keep a copy its compiled code, and change createPackageDefinition
method to be exported, I name it as loader.js
and uses in my project require("./loader.js").createPackageDefinition(root, ...)
source code is mainly in this ts file
https://github.com/grpc/grpc-node/blob/master/packages/proto-loader/src/index.ts
example code from https://github.com/grpc/grpc/blob/master/examples/node/dynamic_codegen/greeter_client.js
var protoLoader = require('@grpc/proto-loader');
var packageDefinition = protoLoader.loadSync(
PROTO_PATH,
{ keepCase: true, longs: String, enums: String, defaults: true, oneofs: true, });
var hello_proto = grpc.loadPackageDefinition(packageDefinition).helloworld;
keep a private copy is not a good solution, hope either side can have a better one
+1 if file descriptor sets are a supported feature of protoc, then we will need the ability to create PackageDefinition
objects using them.
keep a private copy is not a good solution, hope either side can have a better one
@dcodeIO or @nicolasnoble Do you have time to look at the linked graphql-mesh
issue (1086) and offer advice?
I would love the comments by @c0b to be addressed as I am in the same predicament.
It seems the path forward on this is to fork this project.
from grpc/grpc-node#556 wonder is the protoset binary format already supported? or can be added?
I have searched the keyword of grpc + nodejs + protoset on google and within this repo, nothing found so far
I see the compiled protoset binary format is a good solution to bundle many related
*.proto
files into a single one file, it's pretty well supported by protoc compiler, and in Go language pkggithub.com/golang/protobuf
, and tools like grpcurl https://github.com/fullstorydev/grpcurl#protoset-files https://github.com/golang/protobuf/tree/master/protoc-gen-go/descriptor