File tree 3 files changed +9
-3
lines changed
openapi_python_client/templates
3 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,9 @@ All notable changes to this project will be documented in this file.
4
4
The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
5
5
and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
6
6
7
+ ## 0.1.2 - 2020-03-16
8
+ - Improve handling of optional properties in generated ` to_dict ` function for models
9
+
7
10
## 0.1.1 - 2020-03-06
8
11
- Fix mypy issue in generated models ` from_dict ` with datetime or reference properties
9
12
- Generated clients now raise an ` ApiResponseError ` if they receive a response that was not declared
Original file line number Diff line number Diff line change @@ -18,8 +18,11 @@ class {{ schema.reference.class_name }}:
18
18
19
19
def to_dict (self ) - > Dict :
20
20
return {
21
- {% for property in schema .required_properties + schema .optional_properties % }
22
- "{{ property.name }}" : self .{{ property .transform () }} if self .{{ property .name }} else None ,
21
+ {% for property in schema .required_properties % }
22
+ "{{ property.name }}" : self .{{ property .transform () }},
23
+ {% endfor % }
24
+ {% for property in schema .optional_properties % }
25
+ "{{ property.name }}" : self .{{ property .transform () }} if self .{{ property .name }} is not None else None ,
23
26
{% endfor % }
24
27
}
25
28
Original file line number Diff line number Diff line change 1
1
[tool .poetry ]
2
2
name = " openapi-python-client"
3
- version = " 0.1.1 "
3
+ version = " 0.1.2 "
4
4
description = " Generate modern Python clients from OpenAPI"
5
5
6
6
authors = [
You can’t perform that action at this time.
0 commit comments