Skip to content

Commit 81812fd

Browse files
authored
feat: add field api_version to message ServiceForTransport (#14843)
This PR was created locally. The reason that this could not be automated is that the current directory structure [gapic/metadata](https://github.com/googleapis/googleapis/tree/master/gapic/metadata) doesn't align with the protobuf package name [google.gapic.metadata](https://github.com/googleapis/googleapis/blob/53af3b727f84acc34e31c23f3b6e7b8aa4b7e837/gapic/metadata/gapic_metadata.proto#L18). The expected directory structure for `google.gapic.metadata` is `google/gapic/metadata`. In the `googleapis-common-protos` package, the `gencode` is in the expected location https://github.com/googleapis/google-cloud-python/tree/main/packages/googleapis-common-protos/google/gapic/metadata. I fixed the directory structure in my local clone of googleapis, and applied the diff below locally and then ran `librarian generate --api-source=/usr/local/google/home/partheniou/git/googleapis --library=googleapis-common-protos` to generate this PR. ``` partheniou@partheniou-vm-3:~/git/google-cloud-python$ git diff diff --git a/.librarian/state.yaml b/.librarian/state.yaml index fd0f18b..1a0cd56 100644 --- a/.librarian/state.yaml +++ b/.librarian/state.yaml @@ -4680,8 +4680,6 @@ libraries: service_config: serviceconfig.yaml - path: google/cloud/location service_config: cloud.yaml + - path: google/gapic/metadata + service_config: "" - path: google/logging/type service_config: "" - path: google/rpc @@ -4694,7 +4692,7 @@ libraries: - packages/googleapis-common-protos preserve_regex: [] remove_regex: + - ^packages/googleapis-common-protos/google/(?:api|cloud|gapic|rpc|type)/.*/.*_pb2\.(?:py|pyi)$/ - - ^packages/googleapis-common-protos/google/(?:api|cloud|rpc|type)/.*/.*_pb2\.(?:py|pyi)$/ tag_format: '{id}-v{version}' - id: grafeas version: 1.16.0 ```
1 parent 8197d16 commit 81812fd

File tree

4 files changed

+36
-25
lines changed

4 files changed

+36
-25
lines changed

.librarian/state.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4674,7 +4674,7 @@ libraries:
46744674
tag_format: '{id}-v{version}'
46754675
- id: googleapis-common-protos
46764676
version: 1.71.0
4677-
last_generated_commit: e8365a7f88fabe8717cb8322b8ce784b03b6daea
4677+
last_generated_commit: 91361b6b2df5f7f3bfc0858be061e31fd2b7be98
46784678
apis:
46794679
- path: google/api
46804680
service_config: serviceconfig.yaml

packages/googleapis-common-protos/google/gapic/metadata/gapic_metadata.proto

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ option java_package = "com.google.gapic.metadata";
2525
option php_namespace = "Google\\Gapic\\Metadata";
2626
option ruby_package = "Google::Gapic::Metadata";
2727

28-
// Metadata about a GAPIC library for a specific combination of API, version,
29-
// and computer language.
28+
// Metadata about a GAPIC library service for a specific combination of API,
29+
// version, and computer language.
3030
message GapicMetadata {
3131
// Schema version of this proto. Current value: 1.0
3232
string schema = 1;
@@ -57,11 +57,18 @@ message GapicMetadata {
5757
// A map from a transport name to ServiceAsClient, which allows
5858
// listing information about the client objects that implement the
5959
// parent RPC service for the specified transport.
60-
//
61-
// The key name is the transport, lower-cased with no separators
62-
// (e.g. "grpc", "rest").
6360
message ServiceForTransport {
61+
// Map of transport name to ServiceAsClient. The key name is the transport,
62+
// lower-cased with no separators (e.g. "grpc", "rest").
6463
map<string, ServiceAsClient> clients = 1;
64+
65+
// The API version for the interface definition found in the
66+
// `google.api.api_version` annotation of this proto-defined service during
67+
// code generation.
68+
// This is the value populated by the client in the API version request
69+
// parameter as per
70+
// [AIP-4236](https://google.aip.dev/client-libraries/4236).
71+
string api_version = 2;
6572
}
6673

6774
// Information about a specific client implementing a proto-defined service.

packages/googleapis-common-protos/google/gapic/metadata/gapic_metadata_pb2.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# limitations under the License.
1616

1717
# Generated by the protocol buffer compiler. DO NOT EDIT!
18-
# source: gapic/metadata/gapic_metadata.proto
18+
# source: google/gapic/metadata/gapic_metadata.proto
1919
# Protobuf Python Version: 4.25.3
2020
"""Generated protocol buffer code."""
2121
from google.protobuf import descriptor as _descriptor
@@ -29,13 +29,13 @@
2929

3030

3131
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(
32-
b'\n#gapic/metadata/gapic_metadata.proto\x12\x15google.gapic.metadata"\xf0\x05\n\rGapicMetadata\x12\x0e\n\x06schema\x18\x01 \x01(\t\x12\x0f\n\x07\x63omment\x18\x02 \x01(\t\x12\x10\n\x08language\x18\x03 \x01(\t\x12\x15\n\rproto_package\x18\x04 \x01(\t\x12\x17\n\x0flibrary_package\x18\x05 \x01(\t\x12\x44\n\x08services\x18\x06 \x03(\x0b\x32\x32.google.gapic.metadata.GapicMetadata.ServicesEntry\x1ai\n\rServicesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.gapic.metadata.GapicMetadata.ServiceForTransport:\x02\x38\x01\x1a\xd3\x01\n\x13ServiceForTransport\x12V\n\x07\x63lients\x18\x01 \x03(\x0b\x32\x45.google.gapic.metadata.GapicMetadata.ServiceForTransport.ClientsEntry\x1a\x64\n\x0c\x43lientsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x43\n\x05value\x18\x02 \x01(\x0b\x32\x34.google.gapic.metadata.GapicMetadata.ServiceAsClient:\x02\x38\x01\x1a\xd5\x01\n\x0fServiceAsClient\x12\x16\n\x0elibrary_client\x18\x01 \x01(\t\x12L\n\x04rpcs\x18\x02 \x03(\x0b\x32>.google.gapic.metadata.GapicMetadata.ServiceAsClient.RpcsEntry\x1a\\\n\tRpcsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.google.gapic.metadata.GapicMetadata.MethodList:\x02\x38\x01\x1a\x1d\n\nMethodList\x12\x0f\n\x07methods\x18\x01 \x03(\tB\xba\x01\n\x19\x63om.google.gapic.metadataB\x12GapicMetadataProtoP\x01Z=google.golang.org/genproto/googleapis/gapic/metadata;metadata\xaa\x02\x15Google.Gapic.Metadata\xca\x02\x15Google\\Gapic\\Metadata\xea\x02\x17Google::Gapic::Metadatab\x06proto3'
32+
b'\n*google/gapic/metadata/gapic_metadata.proto\x12\x15google.gapic.metadata"\x85\x06\n\rGapicMetadata\x12\x0e\n\x06schema\x18\x01 \x01(\t\x12\x0f\n\x07\x63omment\x18\x02 \x01(\t\x12\x10\n\x08language\x18\x03 \x01(\t\x12\x15\n\rproto_package\x18\x04 \x01(\t\x12\x17\n\x0flibrary_package\x18\x05 \x01(\t\x12\x44\n\x08services\x18\x06 \x03(\x0b\x32\x32.google.gapic.metadata.GapicMetadata.ServicesEntry\x1ai\n\rServicesEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x38.google.gapic.metadata.GapicMetadata.ServiceForTransport:\x02\x38\x01\x1a\xe8\x01\n\x13ServiceForTransport\x12V\n\x07\x63lients\x18\x01 \x03(\x0b\x32\x45.google.gapic.metadata.GapicMetadata.ServiceForTransport.ClientsEntry\x12\x13\n\x0b\x61pi_version\x18\x02 \x01(\t\x1a\x64\n\x0c\x43lientsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12\x43\n\x05value\x18\x02 \x01(\x0b\x32\x34.google.gapic.metadata.GapicMetadata.ServiceAsClient:\x02\x38\x01\x1a\xd5\x01\n\x0fServiceAsClient\x12\x16\n\x0elibrary_client\x18\x01 \x01(\t\x12L\n\x04rpcs\x18\x02 \x03(\x0b\x32>.google.gapic.metadata.GapicMetadata.ServiceAsClient.RpcsEntry\x1a\\\n\tRpcsEntry\x12\x0b\n\x03key\x18\x01 \x01(\t\x12>\n\x05value\x18\x02 \x01(\x0b\x32/.google.gapic.metadata.GapicMetadata.MethodList:\x02\x38\x01\x1a\x1d\n\nMethodList\x12\x0f\n\x07methods\x18\x01 \x03(\tB\xba\x01\n\x19\x63om.google.gapic.metadataB\x12GapicMetadataProtoP\x01Z=google.golang.org/genproto/googleapis/gapic/metadata;metadata\xaa\x02\x15Google.Gapic.Metadata\xca\x02\x15Google\\Gapic\\Metadata\xea\x02\x17Google::Gapic::Metadatab\x06proto3'
3333
)
3434

3535
_globals = globals()
3636
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
3737
_builder.BuildTopDescriptorsAndMessages(
38-
DESCRIPTOR, "gapic.metadata.gapic_metadata_pb2", _globals
38+
DESCRIPTOR, "google.gapic.metadata.gapic_metadata_pb2", _globals
3939
)
4040
if _descriptor._USE_C_DESCRIPTORS == False:
4141
_globals["DESCRIPTOR"]._options = None
@@ -50,18 +50,18 @@
5050
]._serialized_options = b"8\001"
5151
_globals["_GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY"]._options = None
5252
_globals["_GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY"]._serialized_options = b"8\001"
53-
_globals["_GAPICMETADATA"]._serialized_start = 63
54-
_globals["_GAPICMETADATA"]._serialized_end = 815
55-
_globals["_GAPICMETADATA_SERVICESENTRY"]._serialized_start = 249
56-
_globals["_GAPICMETADATA_SERVICESENTRY"]._serialized_end = 354
57-
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT"]._serialized_start = 357
58-
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT"]._serialized_end = 568
59-
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY"]._serialized_start = 468
60-
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY"]._serialized_end = 568
61-
_globals["_GAPICMETADATA_SERVICEASCLIENT"]._serialized_start = 571
62-
_globals["_GAPICMETADATA_SERVICEASCLIENT"]._serialized_end = 784
63-
_globals["_GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY"]._serialized_start = 692
64-
_globals["_GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY"]._serialized_end = 784
65-
_globals["_GAPICMETADATA_METHODLIST"]._serialized_start = 786
66-
_globals["_GAPICMETADATA_METHODLIST"]._serialized_end = 815
53+
_globals["_GAPICMETADATA"]._serialized_start = 70
54+
_globals["_GAPICMETADATA"]._serialized_end = 843
55+
_globals["_GAPICMETADATA_SERVICESENTRY"]._serialized_start = 256
56+
_globals["_GAPICMETADATA_SERVICESENTRY"]._serialized_end = 361
57+
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT"]._serialized_start = 364
58+
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT"]._serialized_end = 596
59+
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY"]._serialized_start = 496
60+
_globals["_GAPICMETADATA_SERVICEFORTRANSPORT_CLIENTSENTRY"]._serialized_end = 596
61+
_globals["_GAPICMETADATA_SERVICEASCLIENT"]._serialized_start = 599
62+
_globals["_GAPICMETADATA_SERVICEASCLIENT"]._serialized_end = 812
63+
_globals["_GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY"]._serialized_start = 720
64+
_globals["_GAPICMETADATA_SERVICEASCLIENT_RPCSENTRY"]._serialized_end = 812
65+
_globals["_GAPICMETADATA_METHODLIST"]._serialized_start = 814
66+
_globals["_GAPICMETADATA_METHODLIST"]._serialized_end = 843
6767
# @@protoc_insertion_point(module_scope)

packages/googleapis-common-protos/google/gapic/metadata/gapic_metadata_pb2.pyi

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class GapicMetadata(_message.Message):
4747
) -> None: ...
4848

4949
class ServiceForTransport(_message.Message):
50-
__slots__ = ("clients",)
50+
__slots__ = ("clients", "api_version")
5151

5252
class ClientsEntry(_message.Message):
5353
__slots__ = ("key", "value")
@@ -61,9 +61,13 @@ class GapicMetadata(_message.Message):
6161
value: _Optional[_Union[GapicMetadata.ServiceAsClient, _Mapping]] = ...,
6262
) -> None: ...
6363
CLIENTS_FIELD_NUMBER: _ClassVar[int]
64+
API_VERSION_FIELD_NUMBER: _ClassVar[int]
6465
clients: _containers.MessageMap[str, GapicMetadata.ServiceAsClient]
66+
api_version: str
6567
def __init__(
66-
self, clients: _Optional[_Mapping[str, GapicMetadata.ServiceAsClient]] = ...
68+
self,
69+
clients: _Optional[_Mapping[str, GapicMetadata.ServiceAsClient]] = ...,
70+
api_version: _Optional[str] = ...,
6771
) -> None: ...
6872

6973
class ServiceAsClient(_message.Message):

0 commit comments

Comments
 (0)