Skip to content

Commit 51b376c

Browse files
Fix Proto loading for Node tests (#5917)
1 parent 73fcec9 commit 51b376c

File tree

4 files changed

+224
-1
lines changed

4 files changed

+224
-1
lines changed
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.api;
18+
19+
import "google/protobuf/descriptor.proto";
20+
21+
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
22+
option java_multiple_files = true;
23+
option java_outer_classname = "ClientProto";
24+
option java_package = "com.google.api";
25+
option objc_class_prefix = "GAPI";
26+
27+
extend google.protobuf.MethodOptions {
28+
// A definition of a client library method signature.
29+
//
30+
// In client libraries, each proto RPC corresponds to one or more methods
31+
// which the end user is able to call, and calls the underlying RPC.
32+
// Normally, this method receives a single argument (a struct or instance
33+
// corresponding to the RPC request object). Defining this field will
34+
// add one or more overloads providing flattened or simpler method signatures
35+
// in some languages.
36+
//
37+
// The fields on the method signature are provided as a comma-separated
38+
// string.
39+
//
40+
// For example, the proto RPC and annotation:
41+
//
42+
// rpc CreateSubscription(CreateSubscriptionRequest)
43+
// returns (Subscription) {
44+
// option (google.api.method_signature) = "name,topic";
45+
// }
46+
//
47+
// Would add the following Java overload (in addition to the method accepting
48+
// the request object):
49+
//
50+
// public final Subscription createSubscription(String name, String topic)
51+
//
52+
// The following backwards-compatibility guidelines apply:
53+
//
54+
// * Adding this annotation to an unannotated method is backwards
55+
// compatible.
56+
// * Adding this annotation to a method which already has existing
57+
// method signature annotations is backwards compatible if and only if
58+
// the new method signature annotation is last in the sequence.
59+
// * Modifying or removing an existing method signature annotation is
60+
// a breaking change.
61+
// * Re-ordering existing method signature annotations is a breaking
62+
// change.
63+
repeated string method_signature = 1051;
64+
}
65+
66+
extend google.protobuf.ServiceOptions {
67+
// The hostname for this service.
68+
// This should be specified with no prefix or protocol.
69+
//
70+
// Example:
71+
//
72+
// service Foo {
73+
// option (google.api.default_host) = "foo.googleapi.com";
74+
// ...
75+
// }
76+
string default_host = 1049;
77+
78+
// OAuth scopes needed for the client.
79+
//
80+
// Example:
81+
//
82+
// service Foo {
83+
// option (google.api.oauth_scopes) = \
84+
// "https://www.googleapis.com/auth/cloud-platform";
85+
// ...
86+
// }
87+
//
88+
// If there is more than one scope, use a comma-separated string:
89+
//
90+
// Example:
91+
//
92+
// service Foo {
93+
// option (google.api.oauth_scopes) = \
94+
// "https://www.googleapis.com/auth/cloud-platform,"
95+
// "https://www.googleapis.com/auth/monitoring";
96+
// ...
97+
// }
98+
string oauth_scopes = 1050;
99+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Copyright 2018 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
syntax = "proto3";
16+
17+
package google.api;
18+
19+
import "google/protobuf/descriptor.proto";
20+
21+
option go_package = "google.golang.org/genproto/googleapis/api/annotations;annotations";
22+
option java_multiple_files = true;
23+
option java_outer_classname = "FieldBehaviorProto";
24+
option java_package = "com.google.api";
25+
option objc_class_prefix = "GAPI";
26+
27+
extend google.protobuf.FieldOptions {
28+
// A designation of a specific field behavior (required, output only, etc.)
29+
// in protobuf messages.
30+
//
31+
// Examples:
32+
//
33+
// string name = 1 [(google.api.field_behavior) = REQUIRED];
34+
// State state = 1 [(google.api.field_behavior) = OUTPUT_ONLY];
35+
// google.protobuf.Duration ttl = 1
36+
// [(google.api.field_behavior) = INPUT_ONLY];
37+
// google.protobuf.Timestamp expire_time = 1
38+
// [(google.api.field_behavior) = OUTPUT_ONLY,
39+
// (google.api.field_behavior) = IMMUTABLE];
40+
repeated google.api.FieldBehavior field_behavior = 1052;
41+
}
42+
43+
// An indicator of the behavior of a given field (for example, that a field
44+
// is required in requests, or given as output but ignored as input).
45+
// This **does not** change the behavior in protocol buffers itself; it only
46+
// denotes the behavior and may affect how API tooling handles the field.
47+
//
48+
// Note: This enum **may** receive new values in the future.
49+
enum FieldBehavior {
50+
// Conventional default for enums. Do not use this.
51+
FIELD_BEHAVIOR_UNSPECIFIED = 0;
52+
53+
// Specifically denotes a field as optional.
54+
// While all fields in protocol buffers are optional, this may be specified
55+
// for emphasis if appropriate.
56+
OPTIONAL = 1;
57+
58+
// Denotes a field as required.
59+
// This indicates that the field **must** be provided as part of the request,
60+
// and failure to do so will cause an error (usually `INVALID_ARGUMENT`).
61+
REQUIRED = 2;
62+
63+
// Denotes a field as output only.
64+
// This indicates that the field is provided in responses, but including the
65+
// field in a request does nothing (the server *must* ignore it and
66+
// *must not* throw an error as a result of the field's presence).
67+
OUTPUT_ONLY = 3;
68+
69+
// Denotes a field as input only.
70+
// This indicates that the field is provided in requests, and the
71+
// corresponding field is not included in output.
72+
INPUT_ONLY = 4;
73+
74+
// Denotes a field as immutable.
75+
// This indicates that the field may be set once in a request to create a
76+
// resource, but may not be changed thereafter.
77+
IMMUTABLE = 5;
78+
79+
// Denotes that a (repeated) field is an unordered list.
80+
// This indicates that the service may provide the elements of the list
81+
// in any arbitrary order, rather than the order the user originally
82+
// provided. Additionally, the list's order may or may not be stable.
83+
UNORDERED_LIST = 6;
84+
85+
// Denotes that this field returns a non-empty default value if not set.
86+
// This indicates that if the user provides the empty value in a request,
87+
// a non-empty value will be returned. The user will not be aware of what
88+
// non-empty value to expect.
89+
NON_EMPTY_DEFAULT = 7;
90+
}

packages/firestore/src/protos/protos.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2588,6 +2588,40 @@
25882588
"id": 2
25892589
}
25902590
}
2591+
},
2592+
"methodSignature": {
2593+
"rule": "repeated",
2594+
"type": "string",
2595+
"id": 1051,
2596+
"extend": "google.protobuf.MethodOptions"
2597+
},
2598+
"defaultHost": {
2599+
"type": "string",
2600+
"id": 1049,
2601+
"extend": "google.protobuf.ServiceOptions"
2602+
},
2603+
"oauthScopes": {
2604+
"type": "string",
2605+
"id": 1050,
2606+
"extend": "google.protobuf.ServiceOptions"
2607+
},
2608+
"fieldBehavior": {
2609+
"rule": "repeated",
2610+
"type": "google.api.FieldBehavior",
2611+
"id": 1052,
2612+
"extend": "google.protobuf.FieldOptions"
2613+
},
2614+
"FieldBehavior": {
2615+
"values": {
2616+
"FIELD_BEHAVIOR_UNSPECIFIED": 0,
2617+
"OPTIONAL": 1,
2618+
"REQUIRED": 2,
2619+
"OUTPUT_ONLY": 3,
2620+
"INPUT_ONLY": 4,
2621+
"IMMUTABLE": 5,
2622+
"UNORDERED_LIST": 6,
2623+
"NON_EMPTY_DEFAULT": 7
2624+
}
25912625
}
25922626
}
25932627
},

packages/firestore/src/protos/update.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ git clone --depth 1 https://github.com/google/protobuf.git
4040

4141
# Copy necessary protos.
4242
mkdir -p "${PROTOS_DIR}/google/api"
43-
cp googleapis/google/api/{annotations.proto,http.proto} \
43+
cp googleapis/google/api/{annotations.proto,http.proto,client.proto,field_behavior.proto} \
4444
"${PROTOS_DIR}/google/api/"
4545

4646
mkdir -p "${PROTOS_DIR}/google/firestore/v1"

0 commit comments

Comments
 (0)