-
Notifications
You must be signed in to change notification settings - Fork 806
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
Extra struct content #179
Extra struct content #179
Conversation
option (gogoproto.sizer_all) = true; | ||
|
||
message ExtraStructContent { | ||
option (gogoproto.extra_struct_content) = "MyMagicValue int64\nMyOtherMagicValue string"; |
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.
Hmmm, looks good, but is there some way we could have a raw string?
option (gogoproto.extra_struct_content) = `
MyMagicValue int64
MyOtherMagicValue string
`;
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.
It does not seem the protobuf spec supports that.
Looks really good :) |
Rather than taking a raw Go string, would it be better to take a structured option? Check out [https://github.com/googleapis/googleapis/blob/master/google/api/annotations.proto#L26] for an example and the syntax. Basically, you would have an inline structure with a list of types and names for the extra fields. It would probably be a little more robust and nicer to read. |
Sadly it's above my understanding of proto syntax, so you either need to provide better examples or walk me there. But before we do that, I'd need an acknowledgement that this new version would be merged upstream as a justification for me to spend the effort. Current version already works for my needs, and the only benefits I could reap from the new version would be not having to maintain a fork. |
I'll say it definitely increases the chances. But I can't make a guarantee
|
@AudriusButkevicius Here is an example of the syntax. I would hope you would take the time to explore other approaches before pushing for merging this. The current suggestion just seems very fragile. |
I am guessing you found another solution. I am closing this, but please comment if want to continue work. |
No description provided.