chrusty / protoc-gen-jsonschema

Protobuf to JSON-Schema compiler
Apache License 2.0
496 stars 101 forks source link

Stackoverflow when referencing google/protobuf/descriptor.proto #49

Closed parsnips closed 3 years ago

parsnips commented 3 years ago

When generating a proto that references google/protobuf/descriptor.proto get a stack overflow:

https://gist.github.com/parsnips/ee0c863398f96877092d530b58768f24

Reproducible with

protoc --plugin=/Users/mparsons/go/bin/protoc-gen-jsonschema --jsonschema_out=. google/protobuf/descriptor.proto
protoc --version
libprotoc 3.13.0
chrusty commented 3 years ago

Hey @parsnips, thanks for reporting this. I can confirm that I can reproduce the issue. Looked into it last night but got a bit mind-boggled with the ENUM recursion code. I was able to successfully generate jsonschemas for this proto by making a copy of the proto file and renaming the package to something without dots (this isn't a solution, just an exploration of the issue).

I'll try to get a fix out this week.

chrusty commented 3 years ago

This turned out to be quite bewildering. Hopefully not too much of an issue, because it seemed that it was going to be quite an invasive fix.