Skip to content

Commit 4cefaea

Browse files
fix: simplify logic for HTTP/1.1 REST fallback option (#1138)
* docs: Update property requirement specifications PiperOrigin-RevId: 557861399 Source-Link: googleapis/googleapis@3303b93 Source-Link: googleapis/googleapis-gen@fb0d0a4 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZmIwZDBhNDUzODVlYjBiZTU4NDIxMTFhZjc5YWY1ZDcxOWQzMjE2OCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md * fix: simplify logic for HTTP/1.1 REST fallback option For the `fallback` parameter, all values considered as `true` in Boolean context will enable HTTP/1.1 REST fallback, since the other fallback transport, proto over HTTP, is removed from `google-gax` v4. PiperOrigin-RevId: 559812260 Source-Link: googleapis/googleapis@6a6fd29 Source-Link: googleapis/googleapis-gen@56c1665 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNTZjMTY2NTdlN2E1OTEyMmIxZGE5NDc3MWE5ZWY0MDk4OWMyODJjMCJ9 * 🦉 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> Co-authored-by: danieljbruce <[email protected]>
1 parent b25537d commit 4cefaea

File tree

3 files changed

+15
-12
lines changed

3 files changed

+15
-12
lines changed

protos/google/datastore/v1/query.proto

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,13 @@ message KindExpression {
279279

280280
// A reference to a property relative to the kind expressions.
281281
message PropertyReference {
282-
// The name of the property.
283-
// If name includes "."s, it may be interpreted as a property name path.
282+
// A reference to a property.
283+
//
284+
// Requires:
285+
//
286+
// * MUST be a dot-delimited (`.`) string of segments, where each segment
287+
// conforms to [entity property name][google.datastore.v1.Entity.properties]
288+
// limitations.
284289
string name = 2;
285290
}
286291

src/v1/datastore_admin_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,16 +138,15 @@ export class DatastoreAdminClient {
138138
* API remote host.
139139
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
140140
* Follows the structure of {@link gapicConfig}.
141-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
142-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
141+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
143142
* For more information, please check the
144143
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
145144
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
146145
* need to avoid loading the default gRPC version and want to use the fallback
147146
* HTTP implementation. Load only fallback version and pass it to the constructor:
148147
* ```
149148
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
150-
* const client = new DatastoreAdminClient({fallback: 'rest'}, gax);
149+
* const client = new DatastoreAdminClient({fallback: true}, gax);
151150
* ```
152151
*/
153152
constructor(
@@ -213,7 +212,7 @@ export class DatastoreAdminClient {
213212
}
214213
if (!opts.fallback) {
215214
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
216-
} else if (opts.fallback === 'rest') {
215+
} else {
217216
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
218217
}
219218
if (opts.libName && opts.libVersion) {
@@ -241,7 +240,7 @@ export class DatastoreAdminClient {
241240
auth: this.auth,
242241
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
243242
};
244-
if (opts.fallback === 'rest') {
243+
if (opts.fallback) {
245244
lroOptions.protoJson = protoFilesRoot;
246245
lroOptions.httpRules = [
247246
{

src/v1/datastore_client.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,15 @@ export class DatastoreClient {
9595
* API remote host.
9696
* @param {gax.ClientConfig} [options.clientConfig] - Client configuration override.
9797
* Follows the structure of {@link gapicConfig}.
98-
* @param {boolean | "rest"} [options.fallback] - Use HTTP fallback mode.
99-
* Pass "rest" to use HTTP/1.1 REST API instead of gRPC.
98+
* @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode.
10099
* For more information, please check the
101100
* {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}.
102101
* @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you
103102
* need to avoid loading the default gRPC version and want to use the fallback
104103
* HTTP implementation. Load only fallback version and pass it to the constructor:
105104
* ```
106105
* const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC
107-
* const client = new DatastoreClient({fallback: 'rest'}, gax);
106+
* const client = new DatastoreClient({fallback: true}, gax);
108107
* ```
109108
*/
110109
constructor(
@@ -170,7 +169,7 @@ export class DatastoreClient {
170169
}
171170
if (!opts.fallback) {
172171
clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`);
173-
} else if (opts.fallback === 'rest') {
172+
} else {
174173
clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`);
175174
}
176175
if (opts.libName && opts.libVersion) {
@@ -187,7 +186,7 @@ export class DatastoreClient {
187186
auth: this.auth,
188187
grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined,
189188
};
190-
if (opts.fallback === 'rest') {
189+
if (opts.fallback) {
191190
lroOptions.protoJson = protoFilesRoot;
192191
lroOptions.httpRules = [
193192
{

0 commit comments

Comments
 (0)