-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
Hi!
I've stuck with a problem, which I'm not sure how to solve.
So I have a file like this:
syntax = "proto3";
package validation;
import "google/protobuf/descriptor.proto";
option java_package = "com.reserve.validation";
option java_outer_classname = "ValidationRules";
extend google.protobuf.FieldOptions {
FieldRules rules = 70001;
}
message FieldRules {
reserved 1;
reserved "optional";
}
In fact I have this file as a nested dependency , so cannot change the way of extending.
I want to convert this file to graphQL schema using this module:
https://www.graphql-mesh.com/docs/handlers/grpc
So internally they build decodedDescriptorSet and call protobuf like this:
https://github.com/grpc/grpc-node/blob/a8719c4f38f9c356ca5f699656ff49c0292fceb7/packages/proto-loader/src/index.ts#L345
which calls Root.fromDescriptor from this module.
The problem is - right now it gives the error:
mesh build
💡 🕸️ Mesh Cleaning existing artifacts
💡 🕸️ Mesh Reading the configuration
💡 🕸️ Mesh Generating the unified schema
💥 🕸️ Mesh - order-search Failed to generate the schema Error: duplicate name '.validation.rules' in Type .google.protobuf.FieldOptions
at Type.add (/workspaces/order-search-graphql/node_modules/protobufjs/src/type.js:331:15)
at tryHandleExtension (/workspaces/order-search-graphql/node_modules/protobufjs/src/root.js:278:22)
at Root._handleAdd (/workspaces/order-search-graphql/node_modules/protobufjs/src/root.js:306:21)
at Type.onAdd (/workspaces/order-search-graphql/node_modules/protobufjs/src/object.js:126:14)
at Namespace.add (/workspaces/order-search-graphql/node_modules/protobufjs/src/namespace.js:243:12)
at Function.fromDescriptor (/workspaces/order-search-graphql/node_modules/protobufjs/ext/descriptor/index.js:92:33)
at createPackageDefinitionFromDescriptorSet (/workspaces/order-search-graphql/node_modules/@grpc/proto-loader/build/src/index.js:159:32)
at Object.loadFileDescriptorSetFromObject (/workspaces/order-search-graphql/node_modules/@grpc/proto-loader/build/src/index.js:214:12)
at GrpcHandler.getMeshSource (/workspaces/order-search-graphql/node_modules/@graphql-mesh/grpc/index.js:532:51)
at async /workspaces/order-search-graphql/node_modules/@graphql-mesh/runtime/index.js:281:28
💥 🕸️ Mesh Error: Schemas couldn't be generated successfully. Check for the logs by running Mesh with DEBUG=1 e...
This issue is very similar to #1080 however in my case i don't have an option to change imported files. I tried also to load this file as a root - the result is the same. What triggers this error - is exactly extend statement.
Do you have any ideas why can it happen?