Skip to content

Commit

Permalink
fix: handle repeated fields in method signatures (#445)
Browse files Browse the repository at this point in the history
Co-authored-by: Dov Shlachter <dovs@google.com>
  • Loading branch information
miraleung and software-dov authored Sep 25, 2020
1 parent 8b2a5ab commit 3aae799
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,12 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):
# If we have keyword arguments corresponding to fields on the
# request, apply these.
{% endif -%}
{%- for key, field in method.flattened_fields.items() if not(field.repeated and method.input.ident.package != method.ident.package) %}
{%- for key, field in method.flattened_fields.items() if not(field.repeated or method.input.ident.package != method.ident.package) %}
if {{ field.name }} is not None:
request.{{ key }} = {{ field.name }}
{%- endfor %}
{# They can be _extended_, however -#}
{%- for key, field in method.flattened_fields.items() if (field.repeated and method.input.ident.package != method.ident.package) %}
{%- for key, field in method.flattened_fields.items() if field.repeated %}
if {{ field.name }}:
request.{{ key }}.extend({{ field.name }})
{%- endfor %}
Expand Down

0 comments on commit 3aae799

Please sign in to comment.