Transcoding fails when HTTP request body contains a field name which is a reserved word in python #490
Labels
priority: p2
Moderately-important priority. Fix may not be included in next release.
type: bug
Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
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
, thebreakpoint
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 ofbreakpoint
.The text was updated successfully, but these errors were encountered: