8000 mypy check fails for google-shopping-merchant-accounts · Issue #2548 · googleapis/gapic-generator-python · GitHub
[go: up one dir, main page]

Skip to content

mypy check fails for google-shopping-merchant-accounts #2548

@parthea

Description

@parthea

See the following failure for the generated client google-shopping-merchant-accounts

2026-01-16T21:56:55.2345227Z .nox/mypy-3-14/lib/python3.14/site-packages/google/shopping/merchant_accounts_v1/services/developer_registration_service/transports/rest.py:461: error: "type[Empty]" has no attribute "to_json"  [attr-defined]

Specifically the code here

https://github.com/googleapis/google-cloud-python/blob/ca15a7e691a1f66e1b3beaa9b88a2e450a6947f5/packages/google-shopping-merchant-accounts/google/shopping/merchant_accounts_v1/services/developer_registration_service/transports/rest.py#L461

                try:
                    request_payload = type(request).to_json(request)
                except:
                    request_payload = None

In this case the request is google.protobuf.empty_pb2.Empty and does not have a to_json method

As per the following template, the method.output.ident.is_proto_plus_type method is unexpectedly returning True for google.protobuf.empty_pb2.Empty

response_payload = {% if method.output.ident.is_proto_plus_type %}{{ method.output.ident }}.to_json(response){% else %}json_format.MessageToJson(resp){% endif %}

Metadata

Metadata

Assignees

Labels

priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0