Skip to content
This repository has been archived by the owner on Jul 20, 2023. It is now read-only.

fix: preserve default values in x-goog-request-params header #1044

Merged
merged 10 commits into from
Sep 21, 2022
3 changes: 2 additions & 1 deletion protos/google/cloud/vision/v1/image_annotator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ message Feature {

// Model to use for the feature.
// Supported values: "builtin/stable" (the default if unset) and
// "builtin/latest".
// "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
// support "builtin/weekly" for the bleeding edge release updated weekly.
string model = 3;
}

Expand Down
3 changes: 2 additions & 1 deletion protos/google/cloud/vision/v1p1beta1/image_annotator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ message Feature {

// Model to use for the feature.
// Supported values: "builtin/stable" (the default if unset) and
// "builtin/latest".
// "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
// support "builtin/weekly" for the bleeding edge release updated weekly.
string model = 3;
}

Expand Down
3 changes: 2 additions & 1 deletion protos/google/cloud/vision/v1p2beta1/image_annotator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ message Feature {

// Model to use for the feature.
// Supported values: "builtin/stable" (the default if unset) and
// "builtin/latest".
// "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
// support "builtin/weekly" for the bleeding edge release updated weekly.
string model = 3;
}

Expand Down
3 changes: 2 additions & 1 deletion protos/google/cloud/vision/v1p3beta1/image_annotator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ message Feature {

// Model to use for the feature.
// Supported values: "builtin/stable" (the default if unset) and
// "builtin/latest".
// "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
// support "builtin/weekly" for the bleeding edge release updated weekly.
string model = 3;
}

Expand Down
3 changes: 2 additions & 1 deletion protos/google/cloud/vision/v1p4beta1/image_annotator.proto
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ message Feature {

// Model to use for the feature.
// Supported values: "builtin/stable" (the default if unset) and
// "builtin/latest".
// "builtin/latest". `DOCUMENT_TEXT_DETECTION` and `TEXT_DETECTION` also
// support "builtin/weekly" for the bleeding edge release updated weekly.
string model = 3;
}

Expand Down
2 changes: 1 addition & 1 deletion samples/system-test/detect.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ describe('detect', () => {

if (webDetection.webEntities.length) {
assert.match(output, /Web entities found:/);
assert.match(output, /Description: Google Cloud Platform/);
assert.match(output, /Description:/);
}

if (webDetection.bestGuessLabels.length) {
Expand Down
8 changes: 4 additions & 4 deletions src/v1/image_annotator_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,7 @@ export class ImageAnnotatorClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.batchAnnotateImages(request, options, callback);
Expand Down Expand Up @@ -598,7 +598,7 @@ export class ImageAnnotatorClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.batchAnnotateFiles(request, options, callback);
Expand Down Expand Up @@ -725,7 +725,7 @@ export class ImageAnnotatorClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.asyncBatchAnnotateImages(
Expand Down Expand Up @@ -885,7 +885,7 @@ export class ImageAnnotatorClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.asyncBatchAnnotateFiles(
Expand Down
54 changes: 27 additions & 27 deletions src/v1/product_search_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createProductSet(request, options, callback);
Expand Down Expand Up @@ -626,7 +626,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getProductSet(request, options, callback);
Expand Down Expand Up @@ -723,7 +723,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
'product_set.name': request.productSet!.name || '',
'product_set.name': request.productSet!.name ?? '',
});
this.initialize();
return this.innerApiCalls.updateProductSet(request, options, callback);
Expand Down Expand Up @@ -814,7 +814,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deleteProductSet(request, options, callback);
Expand Down Expand Up @@ -916,7 +916,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createProduct(request, options, callback);
Expand Down Expand Up @@ -1006,7 +1006,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getProduct(request, options, callback);
Expand Down Expand Up @@ -1112,7 +1112,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
'product.name': request.product!.name || '',
'product.name': request.product!.name ?? '',
});
this.initialize();
return this.innerApiCalls.updateProduct(request, options, callback);
Expand Down Expand Up @@ -1204,7 +1204,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deleteProduct(request, options, callback);
Expand Down Expand Up @@ -1324,7 +1324,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.createReferenceImage(request, options, callback);
Expand Down Expand Up @@ -1424,7 +1424,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.deleteReferenceImage(request, options, callback);
Expand Down Expand Up @@ -1522,7 +1522,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.getReferenceImage(request, options, callback);
Expand Down Expand Up @@ -1628,7 +1628,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.addProductToProductSet(
Expand Down Expand Up @@ -1737,7 +1737,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.removeProductFromProductSet(
Expand Down Expand Up @@ -1859,7 +1859,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.importProductSets(request, options, callback);
Expand Down Expand Up @@ -2030,7 +2030,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.purgeProducts(request, options, callback);
Expand Down Expand Up @@ -2164,7 +2164,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listProductSets(request, options, callback);
Expand Down Expand Up @@ -2204,7 +2204,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listProductSets'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2253,7 +2253,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listProductSets'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2358,7 +2358,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listProducts(request, options, callback);
Expand Down Expand Up @@ -2399,7 +2399,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listProducts'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2449,7 +2449,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listProducts'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2565,7 +2565,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
this.initialize();
return this.innerApiCalls.listReferenceImages(request, options, callback);
Expand Down Expand Up @@ -2609,7 +2609,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listReferenceImages'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2662,7 +2662,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
parent: request.parent || '',
parent: request.parent ?? '',
});
const defaultCallSettings = this._defaults['listReferenceImages'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2775,7 +2775,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
this.initialize();
return this.innerApiCalls.listProductsInProductSet(
Expand Down Expand Up @@ -2820,7 +2820,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
const defaultCallSettings = this._defaults['listProductsInProductSet'];
const callSettings = defaultCallSettings.merge(options);
Expand Down Expand Up @@ -2870,7 +2870,7 @@ export class ProductSearchClient {
options.otherArgs.headers = options.otherArgs.headers || {};
options.otherArgs.headers['x-goog-request-params'] =
this._gaxModule.routingHeader.fromParams({
name: request.name || '',
name: request.name ?? '',
});
const defaultCallSettings = this._defaults['listProductsInProductSet'];
const callSettings = defaultCallSettings.merge(options);
Expand Down
8 changes: 1 addition & 7 deletions src/v1p3beta1/image_annotator_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,13 +199,7 @@ export class ImageAnnotatorClient {
};
if (opts.fallback === 'rest') {
lroOptions.protoJson = protoFilesRoot;
lroOptions.httpRules = [
{
selector: 'google.longrunning.Operations.GetOperation',
get: '/v1/{name=operations/*}',
additional_bindings: [{get: '/v1/{name=locations/*/operations/*}'}],
},
];
lroOptions.httpRules = [];
}
this.operationsClient = this._gaxModule
.lro(lroOptions)
Expand Down
Loading