-
Notifications
You must be signed in to change notification settings - Fork 4
chore: update protobuf to latest #23
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -71,7 +71,7 @@ object TypeNames { | |
| } | ||
|
|
||
| if ( | ||
| fieldDescriptor.hasOptionalKeyword() || | ||
| fieldDescriptor.isOptional || | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this causes a bug, we should update this to be
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or maybe |
||
| fieldDescriptor.type == Descriptors.FieldDescriptor.Type.MESSAGE || | ||
| fieldDescriptor.realContainingOneof != null | ||
| ) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,23 +23,15 @@ public class MessageNoFields() { | |
| @Serializable | ||
| public data class SubMessageNoFieldsExtend( | ||
| @ProtoNumber(number = 1) | ||
| public val type: Type = testgen.messages.MessageNoFields.Type.UNKNOWN, | ||
| public val type: Type? = testgen.messages.MessageNoFields.Type.UNKNOWN, | ||
| ) | ||
| } | ||
|
|
||
| @Serializable | ||
| public data class SubMessageOneofFields( | ||
| @ProtoNumber(number = 1) | ||
| public val someValue: Int? = null, | ||
| ) { | ||
| init { | ||
| require( | ||
| listOfNotNull( | ||
| someValue, | ||
| ).size <= 1 | ||
| ) { "Should only contain one of some_oneof." } | ||
| } | ||
| } | ||
|
Comment on lines
-34
to
-42
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, I wonder whether |
||
| ) | ||
|
|
||
| @Serializable | ||
| public enum class Type { | ||
|
|
||
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 am not sure if this works as intended.
In proto 3, having field presence = being marked as
optional.The method name was a little confusing, maybe we should name that something like
hasFieldPresence()?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.
Also I wonder whether
optional int32 a = 1in proto3 andint32 a = 1in edition 2023 both havehasFieldPresenceset to true. Can you cross-check, write a test and confirm?