-
Notifications
You must be signed in to change notification settings - Fork 937
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
Add optional info for google.proto types #6153
Changes from 2 commits
41dc06f
c863988
22bbc07
68fb08c
32fa834
63924ef
80f212b
da2d4f2
dd4cc09
4c997bb
7740c9e
daa55b8
6334464
ac1ec53
1997946
a024ee4
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 |
---|---|---|
|
@@ -451,7 +451,11 @@ void httpEndpoint() { | |
FieldInfo.builder("message_id", TypeSignature.ofBase(JavaType.STRING.name())) | ||
.location(FieldLocation.PATH).requirement(FieldRequirement.REQUIRED).build(), | ||
FieldInfo.builder("text", TypeSignature.ofBase(JavaType.STRING.name())) | ||
.location(FieldLocation.BODY).requirement(FieldRequirement.REQUIRED).build())); | ||
.location(FieldLocation.BODY).requirement(FieldRequirement.REQUIRED).build(), | ||
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. Isn't this optional? 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. Java String type should be Required without behavior I guess 🙇 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. 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 thought we agreed that fields are optional by default if I think this should be false 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. What I meant is doing something like: 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 see. it should be Required, right? so, it only depends on 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. That's correct. 👍 👍 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.
Some people may want to make the fields required by default. Should we provide a configuration to override the default behavior? 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.
Can we do this when there's a clear demand for it? I really hope users follow the AIP if they want to make it required. 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. Discussed this with @ikhoon and understood his concern about the principle. |
||
FieldInfo.builder("required_text", TypeSignature.ofBase(JavaType.STRING.name())) | ||
.location(FieldLocation.BODY).requirement(FieldRequirement.REQUIRED).build(), | ||
FieldInfo.builder("optional_text", TypeSignature.ofBase(JavaType.STRING.name())) | ||
.location(FieldLocation.BODY).requirement(FieldRequirement.OPTIONAL).build())); | ||
assertThat(updateMessageV2.useParameterAsRoot()).isFalse(); | ||
} | ||
|
||
|
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.
When could
NoSuchMethodError
be raised?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.
./gradlew :it:grpc:protobuf4:shadedTest --info
In this case, protobuf4 throw NoSuchMethodError.
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 would be nice if we can support
[(google.api.field_behavior) = REQUIRED]
for protobuf 4 version.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.
okay, then I should find other logic. because in protobuf4, GeneratedMessageV3 is deprecated.
So I can't use
getExtension
function.I'll try other approach 🙇
but it was really hard to find.. do you have another idea?
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.
We can fix it:
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.
omg thanks..!
I'll try it.