File tree 2 files changed +10
-1
lines changed
openapi_python_client/templates
2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
## 0.1.1 - 2020-03-06
8
8
- Fix mypy issue in generated models ` from_dict ` with datetime or reference properties
9
9
- Generated clients now raise an ` ApiResponseError ` if they receive a response that was not declared
10
+ - Stop including optional query parameters when value is set to None
10
11
11
12
## 0.1.0 - 2020-02-28
12
13
- Initial Release
Original file line number Diff line number Diff line change @@ -47,9 +47,17 @@ def {{ endpoint.name }}(
47
47
{% if endpoint .query_parameters % }
48
48
params = {
49
49
{% for parameter in endpoint .query_parameters % }
50
- "{{ parameter.name }}" : {{ parameter .transform () }},
50
+ {% if parameter .required % }
51
+ "{{ parameter.name }}" : {{ parameter .transform () }},
52
+ {% endif % }
51
53
{% endfor % }
52
54
}
55
+ {% for parameter in endpoint .query_parameters % }
56
+ {% if not parameter .required % }
57
+ if {{ parameter .name }} is not None :
58
+ params ["{{ parameter.name }}" ] = {{ parameter .transform () }}
59
+ {% endif % }
60
+ {% endfor % }
53
61
{% endif % }
54
62
55
63
response = requests .{{ endpoint .method }}(
You can’t perform that action at this time.
0 commit comments