Description
There is an error in googleapis/python-debugger-client#151 which occurs in the transcoding logic when the name of the request field whose value is mapped to the HTTP request body is a reserved word in python. In the case of python-debugger-client
, the breakpoint
field is used in the HTTP request body here.
See the transcode
function below.
python-api-core/google/api_core/path_template.py
Lines 250 to 252 in 2a6a36b
Gapic generator python adds a trailing underscore to field names if the name is also a reserved word in Python. A similar issue was reported in #227 and fixed in #228. Based on comment #227 (comment) it is not possible for fields to have a trailing _
at the proto level (Creating a field like this generates an error from the protobuf runtime).
See build log https://github.com/googleapis/python-debugger-client/actions/runs/4292539515/jobs/7479094983 which shows the failure when a request has body with breakpoint_
instead of breakpoint
.
> response = client.set_breakpoint(request)
tests/unit/gapic/debugger_v2/test_debugger2.py:1920:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
google/cloud/debugger_v2/services/debugger2/client.py:547: in set_breakpoint
response = rpc(
.nox/unit-3-8/lib/python3.8/site-packages/google/api_core/gapic_v1/method.py:113: in __call__
return wrapped_func(*args, **kwargs)
.nox/unit-3-8/lib/python3.8/site-packages/google/api_core/timeout.py:120: in func_with_timeout
return func(*args, **kwargs)
.nox/unit-3-8/lib/python3.8/site-packages/google/api_core/grpc_helpers.py:72: in error_remapped_callable
return callable_(*args, **kwargs)
google/cloud/debugger_v2/services/debugger2/transports/rest.py:722: in __call__
transcoded_request = path_template.transcode(http_options, pb_request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
http_options = [{'body': 'breakpoint', 'method': 'post', 'uri': '/v2/debugger/debuggees/{debuggee_id}/breakpoints/set'}]
message = debuggee_id: "sample1"
breakpoint_ {
id: "id_value"
action: LOG
location {
path: "path_value"
line: 424
...alue"
type_: "type__value"
var_table_index {
value: 541
}
status {
}
}
}
}