-
Notifications
You must be signed in to change notification settings - Fork 70
Allow both :optional and :defaulty as occurrence to support gpb 4.13 #112
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
base: master
Are you sure you want to change the base?
Conversation
gpb changed the occurence field from optional to defaulty before version 4.13 (see tomas-abrahamsson/gpb@a363325). This made Exprotobuf fail when compiling protobufs with gpb >= 4.13.
|
@bitwalker I'm not 100% sure about the implications, let me know if it's ok or if you want give me some pointers to provide the correct solution |
|
In gpb-4.13.0, I changed the internal structure from
I wrote this in some more defails in the doc/dev-guide/proto-defs-versions.md file Edited to include a link to Google's protobuf 3.12.0 field presence documentation |
|
It looks like exprotobuf is using functions in gpb_parse and gpb_scan directly instead of going through the api in gpb_compile. This is why the aforementioned seamless opt-in failed here. I consider the functions in gpb_scan and gpb_parse to be internal to gpb, while gpb_compile is public and documented. I suppose origins are from early days when gpb was more fuzzy about what was internal or public. I think the functions in gpb_compile can do the same work and be more future-proof. If not, please let me know. For reference, some details related to this was discussed earlier. |
I've come to realize this was not currently the case, due to the way exprotobuf handles multiple files, as described in the imports upgrade guide. However, the way exprotobuf uses functions in gpb_parse and gpb_scan is not very viable either, for example, I've been working a bit on replacing the parser in gpb with a recursive descent-parser to get around the problem of keywords in message names etc, and I have I'll open a separate issue for making exprotobuf use gpb_compile functions instead, and also meanwhile try to think if of some way to make change gpb to better support this use case. Edit: I have merged the branch and it is included in 4.14.0 |
|
👋 @bitwalker, are you able to review this change? |
gpb changed the occurence field from optional to defaulty before version
4.13 (see
tomas-abrahamsson/gpb@a363325).
This made Exprotobuf fail when compiling protobufs with gpb >= 4.13.