Skip to content

Infinite recursion on compile step when using custom option on message used as custom option #141

Closed
@doochik

Description

Here is my test.proto

syntax = "proto3";

import "google/protobuf/descriptor.proto";

extend google.protobuf.FieldOptions {
    string example = 61201;
    FieldOptions field = 72000;
}

message FieldOptions {
    bool key = 1 [(example) = "foo bar"];
}

I've got error with protobuf-ts v1 and v2

$ node --version
v14.17.3
$ npm --version
6.14.14
$ npx protoc --ts_out . --proto_path . test.proto                      
--ts_out: RangeError: Maximum call stack size exceeded
    at ReflectionTypeCheck.is (node_modules/@protobuf-ts/runtime/build/commonjs/reflection-type-check.js:64:7)
    at FieldDescriptorProto$Type.is (node_modules/@protobuf-ts/runtime/build/commonjs/message-type.js:63:34)
    at ReflectionTypeCheck.messages (node_modules/@protobuf-ts/runtime/build/commonjs/reflection-type-check.js:164:27)
    at ReflectionTypeCheck.field (node_modules/@protobuf-ts/runtime/build/commonjs/reflection-type-check.js:125:33)
    at ReflectionTypeCheck.is (node_modules/@protobuf-ts/runtime/build/commonjs/reflection-type-check.js:101:23)
    at DescriptorProto$Type.is (node_modules/@protobuf-ts/runtime/build/commonjs/message-type.js:63:34)
    at DescriptorInfo.getMapEntryMessage (node_modules/@protobuf-ts/plugin-framework/build/commonjs/descriptor-info.js:175:43)
    at DescriptorInfo.isMapField (node_modules/@protobuf-ts/plugin-framework/build/commonjs/descriptor-info.js:132:21)
    at DescriptorInfo.isMessageField (node_modules/@protobuf-ts/plugin-framework/build/commonjs/descriptor-info.js:92:18)
    at DescriptorInfo.getMessageFieldMessage (node_modules/@protobuf-ts/plugin-framework/build/commonjs/descriptor-info.js:101:19)

js_out or python_out works well.

$ protoc --js_out . --proto_path . test.proto 
$ protoc --python_out . --proto_path . test.proto 

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions