We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
date-time
Describe the bug code generated for date-time fromat in models file like this for now:
_update_time = d.pop("updateTime", UNSET) update_time: Union[Unset, datetime.datetime] if isinstance(_update_time, Unset): update_time = UNSET else: update_time = isoparse(_update_time)
if response data of updateTime field is null, the _update_time variable will be set to None, so isoparse function will rasie TypeError except.
updateTime
null
_update_time
None
self = <dateutil.parser.isoparser.isoparser object at 0x7f94bf7ae950>, dt_str = None def _parse_isodate_common(self, dt_str): > len_str = len(dt_str) E TypeError: object of type 'NoneType' has no len() ../../../../.local/lib/python3.10/site-packages/dateutil/parser/isoparser.py:213: TypeError
OpenAPI Spec File
{ "updateTime": { "type": "string", "description": "updateTime", "format": "date-time" } }
Desktop (please complete the following information):
Additional context my suggestion is, adding branch check value is None before call isoparse function, generate code like this:
_update_time = d.pop("updateTime", UNSET) update_time: Union[Unset, datetime.datetime] if isinstance(_update_time, Unset): update_time = UNSET elif _update_time is None: update_time = None else: update_time = isoparse(_update_time)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
code generated for
date-time
fromat in models file like this for now:if response data of
updateTime
field isnull
, the_update_time
variable will be set toNone
, so isoparse function will rasie TypeError except.OpenAPI Spec File
Desktop (please complete the following information):
Additional context
my suggestion is, adding branch check value is None before call isoparse function, generate code like this:
The text was updated successfully, but these errors were encountered: