Skip to content

Commit 24ae2a3

Browse files
feat: [common-protos,common-protos] add new FieldBehavior value IDENTIFIER (#1937)
* feat: add new FieldBehavior value IDENTIFIER PiperOrigin-RevId: 559119958 Source-Link: googleapis/googleapis@f5987af Source-Link: https://github.com/googleapis/googleapis-gen/commit/cdecaddcc425659d3fc2e43caa820ba067607961 Copy-Tag: eyJwIjoiamF2YS1jb21tb24tcHJvdG9zLy5Pd2xCb3QueWFtbCIsImgiOiJjZGVjYWRkY2M0MjU2NTlkM2ZjMmU0M2NhYTgyMGJhMDY3NjA3OTYxIn0= feat: add new FieldBehavior value IDENTIFIER PiperOrigin-RevId: 559119958 Source-Link: googleapis/googleapis@f5987af Source-Link: https://github.com/googleapis/googleapis-gen/commit/cdecaddcc425659d3fc2e43caa820ba067607961 Copy-Tag: eyJwIjoiamF2YS1jb21tb24tcHJvdG9zLy5Pd2xCb3QueWFtbCIsImgiOiJjZGVjYWRkY2M0MjU2NTlkM2ZjMmU0M2NhYTgyMGJhMDY3NjA3OTYxIn0= * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
1 parent dde34fb commit 24ae2a3

3 files changed

Lines changed: 65 additions & 7 deletions

File tree

java-common-protos/proto-google-common-protos/src/main/java/com/google/api/FieldBehavior.java

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,27 @@ public enum FieldBehavior implements com.google.protobuf.ProtocolMessageEnum {
130130
* <code>NON_EMPTY_DEFAULT = 7;</code>
131131
*/
132132
NON_EMPTY_DEFAULT(7),
133+
/**
134+
*
135+
*
136+
* <pre>
137+
* Denotes that the field in a resource (a message annotated with
138+
* google.api.resource) is used in the resource name to uniquely identify the
139+
* resource. For AIP-compliant APIs, this should only be applied to the
140+
* `name` field on the resource.
141+
*
142+
* This behavior should not be applied to references to other resources within
143+
* the message.
144+
*
145+
* The identifier field of resources often have different field behavior
146+
* depending on the request it is embedded in (e.g. for Create methods name
147+
* is optional and unused, while for Update methods it is required). Instead
148+
* of method-specific annotations, only `IDENTIFIER` is required.
149+
* </pre>
150+
*
151+
* <code>IDENTIFIER = 8;</code>
152+
*/
153+
IDENTIFIER(8),
133154
UNRECOGNIZED(-1),
134155
;
135156

@@ -230,6 +251,27 @@ public enum FieldBehavior implements com.google.protobuf.ProtocolMessageEnum {
230251
* <code>NON_EMPTY_DEFAULT = 7;</code>
231252
*/
232253
public static final int NON_EMPTY_DEFAULT_VALUE = 7;
254+
/**
255+
*
256+
*
257+
* <pre>
258+
* Denotes that the field in a resource (a message annotated with
259+
* google.api.resource) is used in the resource name to uniquely identify the
260+
* resource. For AIP-compliant APIs, this should only be applied to the
261+
* `name` field on the resource.
262+
*
263+
* This behavior should not be applied to references to other resources within
264+
* the message.
265+
*
266+
* The identifier field of resources often have different field behavior
267+
* depending on the request it is embedded in (e.g. for Create methods name
268+
* is optional and unused, while for Update methods it is required). Instead
269+
* of method-specific annotations, only `IDENTIFIER` is required.
270+
* </pre>
271+
*
272+
* <code>IDENTIFIER = 8;</code>
273+
*/
274+
public static final int IDENTIFIER_VALUE = 8;
233275

234276
public final int getNumber() {
235277
if (this == UNRECOGNIZED) {
@@ -271,6 +313,8 @@ public static FieldBehavior forNumber(int value) {
271313
return UNORDERED_LIST;
272314
case 7:
273315
return NON_EMPTY_DEFAULT;
316+
case 8:
317+
return IDENTIFIER;
274318
default:
275319
return null;
276320
}

java-common-protos/proto-google-common-protos/src/main/java/com/google/api/FieldBehaviorProto.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,16 @@ public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() {
6767
java.lang.String[] descriptorData = {
6868
"\n\037google/api/field_behavior.proto\022\ngoogl"
6969
+ "e.api\032 google/protobuf/descriptor.proto*"
70-
+ "\246\001\n\rFieldBehavior\022\036\n\032FIELD_BEHAVIOR_UNSP"
70+
+ "\266\001\n\rFieldBehavior\022\036\n\032FIELD_BEHAVIOR_UNSP"
7171
+ "ECIFIED\020\000\022\014\n\010OPTIONAL\020\001\022\014\n\010REQUIRED\020\002\022\017\n"
7272
+ "\013OUTPUT_ONLY\020\003\022\016\n\nINPUT_ONLY\020\004\022\r\n\tIMMUTA"
7373
+ "BLE\020\005\022\022\n\016UNORDERED_LIST\020\006\022\025\n\021NON_EMPTY_D"
74-
+ "EFAULT\020\007:Q\n\016field_behavior\022\035.google.prot"
75-
+ "obuf.FieldOptions\030\234\010 \003(\0162\031.google.api.Fi"
76-
+ "eldBehaviorBp\n\016com.google.apiB\022FieldBeha"
77-
+ "viorProtoP\001ZAgoogle.golang.org/genproto/"
78-
+ "googleapis/api/annotations;annotations\242\002"
79-
+ "\004GAPIb\006proto3"
74+
+ "EFAULT\020\007\022\016\n\nIDENTIFIER\020\010:Q\n\016field_behavi"
75+
+ "or\022\035.google.protobuf.FieldOptions\030\234\010 \003(\016"
76+
+ "2\031.google.api.FieldBehaviorBp\n\016com.googl"
77+
+ "e.apiB\022FieldBehaviorProtoP\001ZAgoogle.gola"
78+
+ "ng.org/genproto/googleapis/api/annotatio"
79+
+ "ns;annotations\242\002\004GAPIb\006proto3"
8080
};
8181
descriptor =
8282
com.google.protobuf.Descriptors.FileDescriptor.internalBuildGeneratedFileFrom(

java-common-protos/proto-google-common-protos/src/main/proto/google/api/field_behavior.proto

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,18 @@ enum FieldBehavior {
8787
// a non-empty value will be returned. The user will not be aware of what
8888
// non-empty value to expect.
8989
NON_EMPTY_DEFAULT = 7;
90+
91+
// Denotes that the field in a resource (a message annotated with
92+
// google.api.resource) is used in the resource name to uniquely identify the
93+
// resource. For AIP-compliant APIs, this should only be applied to the
94+
// `name` field on the resource.
95+
//
96+
// This behavior should not be applied to references to other resources within
97+
// the message.
98+
//
99+
// The identifier field of resources often have different field behavior
100+
// depending on the request it is embedded in (e.g. for Create methods name
101+
// is optional and unused, while for Update methods it is required). Instead
102+
// of method-specific annotations, only `IDENTIFIER` is required.
103+
IDENTIFIER = 8;
90104
}

0 commit comments

Comments
 (0)