fix: enable self-referencing schemas #716
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Before this PR the protobuf schema was able to refer only to fully qualified names or names defined in an higher leaf of the parsing tree.
This commit enable a schema to refer the same scope level if at the same leaf level there is defined exactly the field required after.
In an example:
FancyMessage1
is allowed to callFancyEnum
because his scope is/FancyMessage1
while the scope ofFancyEnum
it's/
(the name itself doesn't count in the declarations, but take part only in field assignment inside the declarations, we could say thatfield
has the scope set to/FancyMessage1
but the typeFancyEnum
has also the scope/
, only when referring to a type you enter in it's scope during the parsing procedure).This was a valid declaration in the previous status.
Instead, in this example:
In the previous state was an invalid schema.
With this pr, since
FancyEnum field ...
it's declared inside the scope/FancyMessage1
but also the requested typeFancyEnum
it's declared in the same scope,/FancyMessage1
it's considered validFixes #713