Skip to content

Commit

Permalink
fix: corner case fix for empty request generated test (#801)
Browse files Browse the repository at this point in the history
Fix for #791
  • Loading branch information
software-dov authored Mar 4, 2021
1 parent 26a3e2d commit 039dc71
Showing 1 changed file with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,14 +359,13 @@ class {{ service.client_name }}(metaclass={{ service.client_name }}Meta):

{% endif -%}
{% if method.input.ident.package != method.ident.package -%} {# request lives in a different package, so there is no proto wrapper #}
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
if isinstance(request, dict):
# The request isn't a proto-plus wrapped type,
# so it must be constructed via keyword expansion.
request = {{ method.input.ident }}(**request)
{% if method.flattened_fields -%}{# Cross-package req and flattened fields #}
elif not request:
# Null request, just make one.
request = {{ method.input.ident }}()
{% endif -%}{# Cross-package req and flattened fields #}
{%- else %}
# Minor optimization to avoid making a copy if the user passes
# in a {{ method.input.ident }}.
Expand Down

0 comments on commit 039dc71

Please sign in to comment.