Skip to content

Problem converting messages with recursive type references. #11

@chillinski

Description

@chillinski

I am using the version 1.1.1 of the protobuf-jsonschema and I try to convert the following proto file:

syntax = "proto3";

message Directory {
	string name = 1;
	repeated Directory sub_directories = 2;
	repeated File files = 3;
}

message File {
	string name = 1;
}

The result of the execution is the following

/home/.../lib/node_modules/protobuf-jsonschema/index.js:85
    var id = lookup.slice(0, i).concat(type).join('.');
                                             ^

RangeError: Maximum call stack size exceeded
    at Array.join (native)
    at Compiler.resolve (/home/.../lib/node_modules/protobuf-jsonschema/index.js:85:46)
    at Compiler.build (/home/.../lib/node_modules/protobuf-jsonschema/index.js:128:18)
    at Compiler.<anonymous> (/home/.../lib/node_modules/protobuf-jsonschema/index.js:175:14)
    at Array.forEach (<anonymous>)
    at Compiler.compileMessage (/home/.../lib/node_modules/protobuf-jsonschema/index.js:157:18)
    at Compiler.resolve (/home/.../lib/node_modules/protobuf-jsonschema/index.js:101:18)
    at Compiler.build (/home/.../lib/node_modules/protobuf-jsonschema/index.js:128:18)
    at Compiler.<anonymous> (/home/.../lib/node_modules/protobuf-jsonschema/index.js:175:14)
    at Array.forEach (<anonymous>)

I am using the node module on

  • Linux x86_64 16.04
  • node v8.11.4
  • npm 5.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions