Skip to content

Commit

Permalink
feat: When requesting numeric enums in responses, also send them in r…
Browse files Browse the repository at this point in the history
…equests (#1405)
  • Loading branch information
vchudnov-g authored Aug 13, 2022
1 parent faba515 commit 31b1b16
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -330,12 +330,12 @@ class {{service.name}}RestTransport({{service.name}}Transport):
body = {% if body_spec == '*' -%}
{{method.input.ident}}.to_json(
{{method.input.ident}}(transcoded_request['body']),
{%- else -%}
{% else -%}
{{method.input.fields[body_spec].type.ident}}.to_json(
{{method.input.fields[body_spec].type.ident}}(transcoded_request['body']),
{%- endif %}{# body_spec == "*" #}
{% endif %}{# body_spec == "*" #}
including_default_value_fields=False,
use_integers_for_enums=False
use_integers_for_enums={{ opts.rest_numeric_enums }}
)
{%- endif %}{# body_spec #}

Expand All @@ -346,7 +346,7 @@ class {{service.name}}RestTransport({{service.name}}Transport):
query_params = json.loads({{method.input.ident}}.to_json(
{{method.input.ident}}(transcoded_request['query_params']),
including_default_value_fields=False,
use_integers_for_enums=False
use_integers_for_enums={{ opts.rest_numeric_enums }}
))

{% if method.input.required_fields %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -338,12 +338,12 @@ class {{service.name}}RestTransport({{service.name}}Transport):
body = {% if body_spec == '*' -%}
{{method.input.ident}}.to_json(
{{method.input.ident}}(transcoded_request['body']),
{%- else -%}
{% else -%}
{{method.input.fields[body_spec].type.ident}}.to_json(
{{method.input.fields[body_spec].type.ident}}(transcoded_request['body']),
{%- endif %}{# body_spec == "*" #}
{% endif %}{# body_spec == "*" #}
including_default_value_fields=False,
use_integers_for_enums=False
use_integers_for_enums={{ opts.rest_numeric_enums }}
)
{%- endif %}{# body_spec #}

Expand All @@ -354,7 +354,7 @@ class {{service.name}}RestTransport({{service.name}}Transport):
query_params = json.loads({{method.input.ident}}.to_json(
{{method.input.ident}}(transcoded_request['query_params']),
including_default_value_fields=False,
use_integers_for_enums=False
use_integers_for_enums={{ opts.rest_numeric_enums }}
))

{% if method.input.required_fields %}
Expand Down

0 comments on commit 31b1b16

Please sign in to comment.