Skip to content

Commit

Permalink
fix: fixes for dynamic routing and streaming descriptors (#947)
Browse files Browse the repository at this point in the history
- [ ] Regenerate this pull request now.

Use gapic-generator-typescript v2.14.5.

PiperOrigin-RevId: 450616838

Source-Link: googleapis/googleapis@7a47b72

Source-Link: googleapis/googleapis-gen@42cc633
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiNDJjYzYzMzFiYWUwYjk5ZjYxYjhlMDFhZTE1YjA1MjExNzE2YzRmOSJ9

docs: Document encoding of non-UTF-8 key strings in the Cloud Datastore API
PiperOrigin-RevId: 450535507

Source-Link: googleapis/googleapis@2f003c0

Source-Link: googleapis/googleapis-gen@7d78e9e
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiN2Q3OGU5ZWQ5NmRiZWE2YmY1ZTAxNzljMGVlMTY1NjEwMDc2MTZhYyJ9
  • Loading branch information
gcf-owl-bot[bot] authored May 31, 2022
1 parent eecf7ac commit ba6c190
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 7 deletions.
11 changes: 11 additions & 0 deletions protos/google/datastore/v1/entity.proto
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,33 @@ message Key {
// If neither is set, the element is incomplete.
message PathElement {
// The kind of the entity.
//
// A kind matching regex `__.*__` is reserved/read-only.
// A kind must not contain more than 1500 bytes when UTF-8 encoded.
// Cannot be `""`.
//
// Must be valid UTF-8 bytes. Legacy values that are not valid UTF-8 are
// encoded as `__bytes<X>__` where `<X>` is the base-64 encoding of the
// bytes.
string kind = 1;

// The type of ID.
oneof id_type {
// The auto-allocated ID of the entity.
//
// Never equal to zero. Values less than zero are discouraged and may not
// be supported in the future.
int64 id = 2;

// The name of the entity.
//
// A name matching regex `__.*__` is reserved/read-only.
// A name must not be more than 1500 bytes when UTF-8 encoded.
// Cannot be `""`.
//
// Must be valid UTF-8 bytes. Legacy values that are not valid UTF-8 are
// encoded as `__bytes<X>__` where `<X>` is the base-64 encoding of the
// bytes.
string name = 3;
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/v1/datastore_admin_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ export class DatastoreAdminClient {
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
project_id: request.projectId || '',
index_id: request.indexId || '',
});
this.initialize();
return this.innerApiCalls.getIndex(request, options, callback);
Expand Down Expand Up @@ -1114,6 +1115,7 @@ export class DatastoreAdminClient {
options.otherArgs.headers['x-goog-request-params'] =
gax.routingHeader.fromParams({
project_id: request.projectId || '',
index_id: request.indexId || '',
});
this.initialize();
return this.innerApiCalls.deleteIndex(request, options, callback);
Expand Down
22 changes: 15 additions & 7 deletions test/gapic_datastore_admin_v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,8 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.GetIndexRequest()
);
request.projectId = '';
const expectedHeaderRequestParams = 'project_id=';
request.indexId = '';
const expectedHeaderRequestParams = 'project_id=&index_id=';
const expectedOptions = {
otherArgs: {
headers: {
Expand Down Expand Up @@ -284,7 +285,8 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.GetIndexRequest()
);
request.projectId = '';
const expectedHeaderRequestParams = 'project_id=';
request.indexId = '';
const expectedHeaderRequestParams = 'project_id=&index_id=';
const expectedOptions = {
otherArgs: {
headers: {
Expand Down Expand Up @@ -331,7 +333,8 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.GetIndexRequest()
);
request.projectId = '';
const expectedHeaderRequestParams = 'project_id=';
request.indexId = '';
const expectedHeaderRequestParams = 'project_id=&index_id=';
const expectedOptions = {
otherArgs: {
headers: {
Expand Down Expand Up @@ -359,6 +362,7 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.GetIndexRequest()
);
request.projectId = '';
request.indexId = '';
const expectedError = new Error('The client has already been closed.');
client.close();
await assert.rejects(client.getIndex(request), expectedError);
Expand Down Expand Up @@ -954,7 +958,8 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.DeleteIndexRequest()
);
request.projectId = '';
const expectedHeaderRequestParams = 'project_id=';
request.indexId = '';
const expectedHeaderRequestParams = 'project_id=&index_id=';
const expectedOptions = {
otherArgs: {
headers: {
Expand Down Expand Up @@ -986,7 +991,8 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.DeleteIndexRequest()
);
request.projectId = '';
const expectedHeaderRequestParams = 'project_id=';
request.indexId = '';
const expectedHeaderRequestParams = 'project_id=&index_id=';
const expectedOptions = {
otherArgs: {
headers: {
Expand Down Expand Up @@ -1040,7 +1046,8 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.DeleteIndexRequest()
);
request.projectId = '';
const expectedHeaderRequestParams = 'project_id=';
request.indexId = '';
const expectedHeaderRequestParams = 'project_id=&index_id=';
const expectedOptions = {
otherArgs: {
headers: {
Expand Down Expand Up @@ -1071,7 +1078,8 @@ describe('v1.DatastoreAdminClient', () => {
new protos.google.datastore.admin.v1.DeleteIndexRequest()
);
request.projectId = '';
const expectedHeaderRequestParams = 'project_id=';
request.indexId = '';
const expectedHeaderRequestParams = 'project_id=&index_id=';
const expectedOptions = {
otherArgs: {
headers: {
Expand Down

0 comments on commit ba6c190

Please sign in to comment.