Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem converting messages with recursive type references. #11

Open
chillinski opened this issue Jan 25, 2019 · 3 comments
Open

Problem converting messages with recursive type references. #11

chillinski opened this issue Jan 25, 2019 · 3 comments

Comments

@chillinski
Copy link

chillinski commented Jan 25, 2019

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
@thetimetraveler
Copy link

@devongovett any thoughts in this issue?

@geek29
Copy link

geek29 commented Jun 19, 2019

@devongovett I am also stuck at recursivee type references. Json schema supports recursive types. I looked into the code specifically resolve method : resolve but couldnt figure out why it is not able to resolve to use already defined messages

@chillinski
Copy link
Author

I will have a look into this again. It shouldn't be a big problem to solve this.

ilyanep added a commit to ilyanep/protobuf-jsonschema that referenced this issue Jun 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants