Skip to content

Commit dc04c1c

Browse files
Google APIscopybara-github
authored andcommitted
fix!: annotating some fields as REQUIRED
These fields were actually always required by the backend, so annotation just documents status quo. I believe this change will not require major version bump for any language. PiperOrigin-RevId: 429093810
1 parent 1bbb5df commit dc04c1c

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

google/spanner/admin/instance/v1/spanner_instance_admin.proto

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,19 +350,22 @@ message Instance {
350350
// after the instance is created. Values are of the form
351351
// `projects/<project>/instances/[a-z][-a-z0-9]*[a-z0-9]`. The final
352352
// segment of the name must be between 2 and 64 characters in length.
353-
string name = 1;
353+
string name = 1 [(google.api.field_behavior) = REQUIRED];
354354

355355
// Required. The name of the instance's configuration. Values are of the form
356356
// `projects/<project>/instanceConfigs/<configuration>`. See
357357
// also [InstanceConfig][google.spanner.admin.instance.v1.InstanceConfig] and
358358
// [ListInstanceConfigs][google.spanner.admin.instance.v1.InstanceAdmin.ListInstanceConfigs].
359-
string config = 2 [(google.api.resource_reference) = {
360-
type: "spanner.googleapis.com/InstanceConfig"
361-
}];
359+
string config = 2 [
360+
(google.api.field_behavior) = REQUIRED,
361+
(google.api.resource_reference) = {
362+
type: "spanner.googleapis.com/InstanceConfig"
363+
}
364+
];
362365

363366
// Required. The descriptive name for this instance as it appears in UIs.
364367
// Must be unique per project and between 4 and 30 characters in length.
365-
string display_name = 3;
368+
string display_name = 3 [(google.api.field_behavior) = REQUIRED];
366369

367370
// Required. The number of nodes allocated to this instance. This may be zero
368371
// in API responses for instances that are not yet in state `READY`.

google/spanner/v1/mutation.proto

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ syntax = "proto3";
1717
package google.spanner.v1;
1818

1919
import "google/api/annotations.proto";
20+
import "google/api/field_behavior.proto";
2021
import "google/protobuf/struct.proto";
2122
import "google/spanner/v1/keys.proto";
2223

@@ -36,7 +37,7 @@ message Mutation {
3637
// [replace][google.spanner.v1.Mutation.replace] operations.
3738
message Write {
3839
// Required. The table whose rows will be written.
39-
string table = 1;
40+
string table = 1 [(google.api.field_behavior) = REQUIRED];
4041

4142
// The names of the columns in [table][google.spanner.v1.Mutation.Write.table] to be written.
4243
//
@@ -59,15 +60,15 @@ message Mutation {
5960
// Arguments to [delete][google.spanner.v1.Mutation.delete] operations.
6061
message Delete {
6162
// Required. The table whose rows will be deleted.
62-
string table = 1;
63+
string table = 1 [(google.api.field_behavior) = REQUIRED];
6364

6465
// Required. The primary keys of the rows within [table][google.spanner.v1.Mutation.Delete.table] to delete. The
6566
// primary keys must be specified in the order in which they appear in the
6667
// `PRIMARY KEY()` clause of the table's equivalent DDL statement (the DDL
6768
// statement used to create the table).
6869
// Delete is idempotent. The transaction will succeed even if some or all
6970
// rows do not exist.
70-
KeySet key_set = 2;
71+
KeySet key_set = 2 [(google.api.field_behavior) = REQUIRED];
7172
}
7273

7374
// Required. The operation to perform.

google/spanner/v1/spanner.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ message CreateSessionRequest {
300300
}
301301
];
302302

303-
// The session to create.
304-
Session session = 2;
303+
// Required. The session to create.
304+
Session session = 2 [(google.api.field_behavior) = REQUIRED];
305305
}
306306

307307
// The request for [BatchCreateSessions][google.spanner.v1.Spanner.BatchCreateSessions].
@@ -647,7 +647,7 @@ message ExecuteBatchDmlRequest {
647647
// A single DML statement.
648648
message Statement {
649649
// Required. The DML string.
650-
string sql = 1;
650+
string sql = 1 [(google.api.field_behavior) = REQUIRED];
651651

652652
// Parameter names and values that bind to placeholders in the DML string.
653653
//

0 commit comments

Comments
 (0)