-
Notifications
You must be signed in to change notification settings - Fork 73
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
feature: replace the old parsing strategy and move towards a tree based one #733
Conversation
a97af81
to
bbfa298
Compare
This pr it's experimental, even if it's passing all the tests stuff can be still moved around and a final judgement should be given from @jjaakola-aiven before going forward. Please try as much valid (and invalid) schemas as possible and provide feedbacks if something it's fishy. |
bbfa298
to
be81a6a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left some minor nits.
3abacdb
to
fff366c
Compare
Can I have another round of review @jjaakola-aiven and @aiven-anton? Except that wdyt? I've tried to transform the TypeTree into an immutable object but the descending visit would become much harder to read, I think that in that case the penalty of having a mutable object is ok if the parsing algorithm it's easier. We can also create an internal object called |
a4c8b11
to
f8563fa
Compare
…towards a tree based type verification strategy. From this commit it's possible to refer to a type using a partial path and not only a fully specified path. If we declare for e.g. the following schema: ```protobuf syntax = "proto3"; package my.awesome.customer.plan.entity.v1beta1; message CustomerPlan { string plan_name = 1; } ``` When importing it it's sufficient to use a part of the full specified path (that in this case would be `my.awesome.customer.plan.entity.v1beta1.CustomerPlan`). As e.g. it would be enough to use `entity.v1beta1.CustomerPlan` or `v1beta1.CustomerPlan`, so the following declaration would be accepted: ```protobuf syntax = "proto3"; package my.awesome.customer.plan.entity.v1beta1; import "my/awesome/customer/plan/entity/v1beta1/entity.proto"; message CustomerPlanEvent { message Created { entity.v1beta1.CustomerPlan plan = 1; } } ```
f8563fa
to
04bff10
Compare
The scope of this pr is to replace the old parsing strategy and move towards a tree based type verification strategy.
From this commit it's possible to refer to a type using a partial path and not only a fully specified path. If we declare for e.g. the following schema:
When importing it it's sufficient to use a part of the full specified path (that in this case would be
my.awesome.customer.plan.entity.v1beta1.CustomerPlan
). As e.g. it would be enough to useentity.v1beta1.CustomerPlan
orv1beta1.CustomerPlan
, so the following declaration would be accepted: