-
Notifications
You must be signed in to change notification settings - Fork 37
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
oneof structure is not persisted in protolock #133
Comments
I also noticed that oneof options are not recorded (options can be written on enum types, enum values, oneof fields, service types, and service methods). @nilslice If there is anything I can do to help, let me know! Happy to work on a PR, just wasn't sure if this has been previously rejected. Either way I will likely make these changes to my own fork if they are not desired for the main protolock repo |
Hi @YaseenAlk -
Yes, that's right - a plugin is probably the best way to go. Ideally
There are a few places where there may be missing implementations (though I believe protolock is fairly comprehensive), and I would love to have help filling in any gaps you find. With regard to your specific need, I think recording options on oneof types is a great addition, and a PR would be welcomed. Thank you! |
I created #151 expanding on YaseenAlk@287eb47 and also added a rule utilizing the new field to prevent backwards-incompatible Go changes per https://google.aip.dev/180#moving-into-oneofs. |
Thanks @pdecks! I'll take a look at this now. for the time being, I'm running tests locally, as the CI situation isn't up to date. I need to move off Circle CI and onto GitHub actions. Maybe the holiday break will gift me some free time 😆 |
I'd like to add some additional rules for my own use case of protolock. From reading the wiki, it's my understanding that the preferred way to add more rules is to implement them in a plugin, which takes as input a
Protolock
go struct that is built from the output of the proto parser.One rule I'd like to add is to check if a field becomes part of a
oneof
, or if it is removed from aoneof
. However, I don't believe this is possible because the Protolock file does not track which fields are inoneof
s. One way around this could be to introduce an optional "oneof parent" pointer for fields (demonstrated here) but I'm not sure if that is the most elegant solution.I would like to hear your thoughts on this and whether this was previously considered and rejected, or if there is a way to find
oneof
s in the plugins that I am not aware of. Happy to also author a PR or help out however I can! CCing @adisuissaThe text was updated successfully, but these errors were encountered: