grpc / grpc/grpc-node

Can't compile and produce the js file for proto with inner "["

Open
#1,964 6 comments 0 reactions 0 assignees View on GitHub
package: @grpc/proto-loader
Dominant language
TypeScript
Stars
4.8k
Forks
716
Avg merge
2d 3h
Merged PRs (30d)
10

Description

Hi! I have error with compiling .proto having inner "[" char when use custom [mountebank](https://github.com/ozonru/mountebank-grpc/blob/master/src/mock.js#L40):

`error: [2021-11-11T11:36:31.231Z] - [grpc:4542] /app/node_modules/@ozonru/mountebank-grpc/src/mock.js:40
throw new ProtoError(serviceOptions.file, error.message)
^

ProtoError: Could not loading a proto file "my_service.proto". Have you added a path with vendor's proto files to request?
Error message: illegal value '[' (protos/my_service/my_service.proto, line 440)
at /app/node_modules/@ozonru/mountebank-grpc/src/mock.js:40:19
at Array.forEach ()
at Object.getServerInstance (/app/node_modules/@ozonru/mountebank-grpc/src/mock.js:31:37)
at Server. (/app/node_modules/@ozonru/mountebank-grpc/src/index.js:22:41)
at Object.onceWrapper (events.js:420:28)
at Server.emit (events.js:314:20)
at emitCloseNT (net.js:1657:8)
at processTicksAndRejections (internal/process/task_queues.js:83:21)`

In proto on line 440 file we have field:
`int64 some_id = 1 [(grpc.gateway.protoc_gen_openapiv2.options.openapiv2_field) = {required: ['some_id']}];`

I assume it may be related to [this](https://github.com/protobufjs/protobuf.js/issues/1289).

Could you help to solve this problem?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.