File tree Expand file tree Collapse file tree 3 files changed +9
-3
lines changed
openapi_python_client/templates Expand file tree Collapse file tree 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.
44The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
55and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
66
7+ ## 0.1.2 - 2020-03-16
8+ - Improve handling of optional properties in generated ` to_dict ` function for models
9+
710## 0.1.1 - 2020-03-06
811- Fix mypy issue in generated models ` from_dict ` with datetime or reference properties
912- 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 }}:
1818
1919 def to_dict (self ) - > Dict :
2020 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 ,
2326 {% endfor % }
2427 }
2528
Original file line number Diff line number Diff line change 11[tool .poetry ]
22name = " openapi-python-client"
3- version = " 0.1.1 "
3+ version = " 0.1.2 "
44description = " Generate modern Python clients from OpenAPI"
55
66authors = [
You can’t perform that action at this time.
0 commit comments