Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 383f655

Browse files
authored
fix: fix docstring for first attribute of protos (#1004)
1 parent ccdd17d commit 383f655

10 files changed

Lines changed: 108 additions & 5 deletions

File tree

gapic/ads-templates/%namespace/%name/%version/%sub/types/_message.py.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class {{ message.name }}({{ p }}.Message):
2-
r"""{{ message.meta.doc|rst(indent=4) }}{% if message.fields|length %}
2+
r"""{{ message.meta.doc|rst(indent=4) }}
3+
{% if message.fields|length %}
34

45
Attributes:
56
{% for field in message.fields.values() %}

gapic/templates/%namespace/%name_%version/%sub/types/_message.py.j2

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class {{ message.name }}({{ p }}.Message):
2-
r"""{{ message.meta.doc|rst(indent=4) }}{% if message.fields|length %}
2+
r"""{{ message.meta.doc|rst(indent=4) }}
3+
{% if message.fields|length %}
34

45
Attributes:
56
{% for field in message.fields.values() %}

tests/integration/goldens/asset/google/cloud/asset_v1/types/asset_service.py

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ class ContentType(proto.Enum):
7373

7474
class ExportAssetsRequest(proto.Message):
7575
r"""Export asset request.
76+
7677
Attributes:
7778
parent (str):
7879
Required. The relative name of the root
@@ -187,6 +188,7 @@ class ExportAssetsResponse(proto.Message):
187188

188189
class ListAssetsRequest(proto.Message):
189190
r"""ListAssets request.
191+
190192
Attributes:
191193
parent (str):
192194
Required. Name of the organization or project the assets
@@ -271,6 +273,7 @@ class ListAssetsRequest(proto.Message):
271273

272274
class ListAssetsResponse(proto.Message):
273275
r"""ListAssets response.
276+
274277
Attributes:
275278
read_time (google.protobuf.timestamp_pb2.Timestamp):
276279
Time the snapshot was taken.
@@ -305,6 +308,7 @@ def raw_page(self):
305308

306309
class BatchGetAssetsHistoryRequest(proto.Message):
307310
r"""Batch get assets history request.
311+
308312
Attributes:
309313
parent (str):
310314
Required. The relative name of the root
@@ -356,6 +360,7 @@ class BatchGetAssetsHistoryRequest(proto.Message):
356360

357361
class BatchGetAssetsHistoryResponse(proto.Message):
358362
r"""Batch get assets history response.
363+
359364
Attributes:
360365
assets (Sequence[google.cloud.asset_v1.types.TemporalAsset]):
361366
A list of assets with valid time windows.
@@ -370,6 +375,7 @@ class BatchGetAssetsHistoryResponse(proto.Message):
370375

371376
class CreateFeedRequest(proto.Message):
372377
r"""Create asset feed request.
378+
373379
Attributes:
374380
parent (str):
375381
Required. The name of the
@@ -409,6 +415,7 @@ class CreateFeedRequest(proto.Message):
409415

410416
class GetFeedRequest(proto.Message):
411417
r"""Get asset feed request.
418+
412419
Attributes:
413420
name (str):
414421
Required. The name of the Feed and it must be in the format
@@ -425,6 +432,7 @@ class GetFeedRequest(proto.Message):
425432

426433
class ListFeedsRequest(proto.Message):
427434
r"""List asset feeds request.
435+
428436
Attributes:
429437
parent (str):
430438
Required. The parent
@@ -443,6 +451,7 @@ class ListFeedsRequest(proto.Message):
443451

444452
class ListFeedsResponse(proto.Message):
445453
r"""
454+
446455
Attributes:
447456
feeds (Sequence[google.cloud.asset_v1.types.Feed]):
448457
A list of feeds.
@@ -457,6 +466,7 @@ class ListFeedsResponse(proto.Message):
457466

458467
class UpdateFeedRequest(proto.Message):
459468
r"""Update asset feed request.
469+
460470
Attributes:
461471
feed (google.cloud.asset_v1.types.Feed):
462472
Required. The new values of feed details. It must match an
@@ -484,6 +494,7 @@ class UpdateFeedRequest(proto.Message):
484494

485495
class DeleteFeedRequest(proto.Message):
486496
r"""
497+
487498
Attributes:
488499
name (str):
489500
Required. The name of the feed and it must be in the format
@@ -500,6 +511,7 @@ class DeleteFeedRequest(proto.Message):
500511

501512
class OutputConfig(proto.Message):
502513
r"""Output configuration for export assets destination.
514+
503515
Attributes:
504516
gcs_destination (google.cloud.asset_v1.types.GcsDestination):
505517
Destination on Cloud Storage.
@@ -525,6 +537,7 @@ class OutputConfig(proto.Message):
525537

526538
class OutputResult(proto.Message):
527539
r"""Output result of export assets.
540+
528541
Attributes:
529542
gcs_result (google.cloud.asset_v1.types.GcsOutputResult):
530543
Export result on Cloud Storage.
@@ -540,6 +553,7 @@ class OutputResult(proto.Message):
540553

541554
class GcsOutputResult(proto.Message):
542555
r"""A Cloud Storage output result.
556+
543557
Attributes:
544558
uris (Sequence[str]):
545559
List of uris of the Cloud Storage objects. Example:
@@ -554,6 +568,7 @@ class GcsOutputResult(proto.Message):
554568

555569
class GcsDestination(proto.Message):
556570
r"""A Cloud Storage location.
571+
557572
Attributes:
558573
uri (str):
559574
The uri of the Cloud Storage object. It's the same uri that
@@ -592,6 +607,7 @@ class GcsDestination(proto.Message):
592607

593608
class BigQueryDestination(proto.Message):
594609
r"""A BigQuery destination for exporting assets to.
610+
595611
Attributes:
596612
dataset (str):
597613
Required. The BigQuery dataset in format
@@ -719,6 +735,7 @@ class PartitionKey(proto.Enum):
719735

720736
class PubsubDestination(proto.Message):
721737
r"""A Pub/Sub destination.
738+
722739
Attributes:
723740
topic (str):
724741
The name of the Pub/Sub topic to publish to. Example:
@@ -733,6 +750,7 @@ class PubsubDestination(proto.Message):
733750

734751
class FeedOutputConfig(proto.Message):
735752
r"""Output configuration for asset feed destination.
753+
736754
Attributes:
737755
pubsub_destination (google.cloud.asset_v1.types.PubsubDestination):
738756
Destination on Pub/Sub.
@@ -838,6 +856,7 @@ class Feed(proto.Message):
838856

839857
class SearchAllResourcesRequest(proto.Message):
840858
r"""Search all resources request.
859+
841860
Attributes:
842861
scope (str):
843862
Required. A scope can be a project, a folder, or an
@@ -983,6 +1002,7 @@ class SearchAllResourcesRequest(proto.Message):
9831002

9841003
class SearchAllResourcesResponse(proto.Message):
9851004
r"""Search all resources response.
1005+
9861006
Attributes:
9871007
results (Sequence[google.cloud.asset_v1.types.ResourceSearchResult]):
9881008
A list of Resources that match the search
@@ -1012,6 +1032,7 @@ def raw_page(self):
10121032

10131033
class SearchAllIamPoliciesRequest(proto.Message):
10141034
r"""Search all IAM policies request.
1035+
10151036
Attributes:
10161037
scope (str):
10171038
Required. A scope can be a project, a folder, or an
@@ -1150,6 +1171,7 @@ class SearchAllIamPoliciesRequest(proto.Message):
11501171

11511172
class SearchAllIamPoliciesResponse(proto.Message):
11521173
r"""Search all IAM policies response.
1174+
11531175
Attributes:
11541176
results (Sequence[google.cloud.asset_v1.types.IamPolicySearchResult]):
11551177
A list of IamPolicy that match the search
@@ -1179,6 +1201,7 @@ def raw_page(self):
11791201

11801202
class IamPolicyAnalysisQuery(proto.Message):
11811203
r"""## IAM policy analysis query message.
1204+
11821205
Attributes:
11831206
scope (str):
11841207
Required. The relative name of the root asset. Only
@@ -1279,6 +1302,7 @@ class AccessSelector(proto.Message):
12791302

12801303
class Options(proto.Message):
12811304
r"""Contains query options.
1305+
12821306
Attributes:
12831307
expand_groups (bool):
12841308
Optional. If true, the identities section of the result will
@@ -1395,6 +1419,7 @@ class Options(proto.Message):
13951419

13961420
class ConditionContext(proto.Message):
13971421
r"""The IAM conditions context.
1422+
13981423
Attributes:
13991424
access_time (google.protobuf.timestamp_pb2.Timestamp):
14001425
The hypothetical access timestamp to evaluate IAM
@@ -1497,6 +1522,7 @@ class AnalyzeIamPolicyResponse(proto.Message):
14971522

14981523
class IamPolicyAnalysis(proto.Message):
14991524
r"""An analysis message to group the query and results.
1525+
15001526
Attributes:
15011527
analysis_query (google.cloud.asset_v1.types.IamPolicyAnalysisQuery):
15021528
The analysis query.
@@ -1563,6 +1589,7 @@ class IamPolicyAnalysisOutputConfig(proto.Message):
15631589

15641590
class GcsDestination(proto.Message):
15651591
r"""A Cloud Storage location.
1592+
15661593
Attributes:
15671594
uri (str):
15681595
Required. The uri of the Cloud Storage object. It's the same
@@ -1585,6 +1612,7 @@ class GcsDestination(proto.Message):
15851612

15861613
class BigQueryDestination(proto.Message):
15871614
r"""A BigQuery destination.
1615+
15881616
Attributes:
15891617
dataset (str):
15901618
Required. The BigQuery dataset in format
@@ -1694,7 +1722,8 @@ class AnalyzeIamPolicyLongrunningRequest(proto.Message):
16941722
class AnalyzeIamPolicyLongrunningResponse(proto.Message):
16951723
r"""A response message for
16961724
[AssetService.AnalyzeIamPolicyLongrunning][google.cloud.asset.v1.AssetService.AnalyzeIamPolicyLongrunning].
1697-
"""
1725+
1726+
"""
16981727

16991728

17001729
__all__ = tuple(sorted(__protobuf__.manifest))

tests/integration/goldens/asset/google/cloud/asset_v1/types/assets.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ class PriorAssetState(proto.Enum):
9898

9999
class TimeWindow(proto.Message):
100100
r"""A time window specified by its ``start_time`` and ``end_time``.
101+
101102
Attributes:
102103
start_time (google.protobuf.timestamp_pb2.Timestamp):
103104
Start time of the time window (exclusive).
@@ -253,6 +254,7 @@ class Asset(proto.Message):
253254

254255
class Resource(proto.Message):
255256
r"""A representation of a Google Cloud resource.
257+
256258
Attributes:
257259
version (str):
258260
The API version. Example: ``v1``
@@ -707,6 +709,7 @@ class IamPolicySearchResult(proto.Message):
707709

708710
class Explanation(proto.Message):
709711
r"""Explanation about the IAM policy search result.
712+
710713
Attributes:
711714
matched_permissions (Sequence[google.cloud.asset_v1.types.IamPolicySearchResult.Explanation.MatchedPermissionsEntry]):
712715
The map from roles to their included permissions that match
@@ -723,6 +726,7 @@ class Explanation(proto.Message):
723726

724727
class Permissions(proto.Message):
725728
r"""IAM permissions
729+
726730
Attributes:
727731
permissions (Sequence[str]):
728732
A list of permissions. A sample permission string:
@@ -806,6 +810,7 @@ class IamPolicyAnalysisState(proto.Message):
806810

807811
class ConditionEvaluation(proto.Message):
808812
r"""The Condition evaluation.
813+
809814
Attributes:
810815
evaluation_value (google.cloud.asset_v1.types.ConditionEvaluation.EvaluationValue):
811816
The evaluation result.
@@ -855,6 +860,7 @@ class IamPolicyAnalysisResult(proto.Message):
855860

856861
class Resource(proto.Message):
857862
r"""A Google Cloud resource under analysis.
863+
858864
Attributes:
859865
full_resource_name (str):
860866
The `full resource
@@ -875,6 +881,7 @@ class Resource(proto.Message):
875881

876882
class Access(proto.Message):
877883
r"""An IAM role or permission under analysis.
884+
878885
Attributes:
879886
role (str):
880887
The role.
@@ -902,6 +909,7 @@ class Access(proto.Message):
902909

903910
class Identity(proto.Message):
904911
r"""An identity under analysis.
912+
905913
Attributes:
906914
name (str):
907915
The identity name in any form of members appear in `IAM
@@ -932,6 +940,7 @@ class Identity(proto.Message):
932940

933941
class Edge(proto.Message):
934942
r"""A directional edge.
943+
935944
Attributes:
936945
source_node (str):
937946
The source node of the edge. For example, it
@@ -1023,6 +1032,7 @@ class AccessControlList(proto.Message):
10231032

10241033
class IdentityList(proto.Message):
10251034
r"""The identities and group edges.
1035+
10261036
Attributes:
10271037
identities (Sequence[google.cloud.asset_v1.types.IamPolicyAnalysisResult.Identity]):
10281038
Only the identities that match one of the following

tests/integration/goldens/credentials/google/iam/credentials_v1/types/common.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636

3737
class GenerateAccessTokenRequest(proto.Message):
3838
r"""
39+
3940
Attributes:
4041
name (str):
4142
Required. The resource name of the service account for which
@@ -92,6 +93,7 @@ class GenerateAccessTokenRequest(proto.Message):
9293

9394
class GenerateAccessTokenResponse(proto.Message):
9495
r"""
96+
9597
Attributes:
9698
access_token (str):
9799
The OAuth 2.0 access token.
@@ -113,6 +115,7 @@ class GenerateAccessTokenResponse(proto.Message):
113115

114116
class SignBlobRequest(proto.Message):
115117
r"""
118+
116119
Attributes:
117120
name (str):
118121
Required. The resource name of the service account for which
@@ -154,6 +157,7 @@ class SignBlobRequest(proto.Message):
154157

155158
class SignBlobResponse(proto.Message):
156159
r"""
160+
157161
Attributes:
158162
key_id (str):
159163
The ID of the key used to sign the blob.
@@ -173,6 +177,7 @@ class SignBlobResponse(proto.Message):
173177

174178
class SignJwtRequest(proto.Message):
175179
r"""
180+
176181
Attributes:
177182
name (str):
178183
Required. The resource name of the service account for which
@@ -215,6 +220,7 @@ class SignJwtRequest(proto.Message):
215220

216221
class SignJwtResponse(proto.Message):
217222
r"""
223+
218224
Attributes:
219225
key_id (str):
220226
The ID of the key used to sign the JWT.
@@ -234,6 +240,7 @@ class SignJwtResponse(proto.Message):
234240

235241
class GenerateIdTokenRequest(proto.Message):
236242
r"""
243+
237244
Attributes:
238245
name (str):
239246
Required. The resource name of the service account for which
@@ -285,6 +292,7 @@ class GenerateIdTokenRequest(proto.Message):
285292

286293
class GenerateIdTokenResponse(proto.Message):
287294
r"""
295+
288296
Attributes:
289297
token (str):
290298
The OpenId Connect ID token.

0 commit comments

Comments
 (0)