Closed
Description
Describe the bug
I have a similar problem to #456, but in my case date-time
attribute isn't marked as required. Yet, the model's from_dict
method has following code:
_retry_at = d.pop("retry_at", UNSET)
retry_at: Union[Unset, datetime.datetime]
if isinstance(_retry_at, Unset):
retry_at = UNSET
else:
retry_at = isoparse(_retry_at)
which tries to parse None
value if there is no retry_at
in the server response.
To Reproduce
Client is generated like this
poetry run openapi-python-client generate --path ../swagger/$(API_VERSION)/swagger.json
Expected behavior
Client doesn't try to parse absent date-time
attributes in the response.
OpenAPI Spec File
{
"openapi": "3.0.0",
"servers": [
{
"url": "/api/v1"
}
],
"components": {
"schemas": {
"Operation": {
"type": "object",
"required": [
"id"
],
"properties": {
"id": {
"type": "string"
},
"retry_at": {
"type": "string",
"format": "date-time"
}
}
}
}
}
}
Desktop (please complete the following information):
- OS: Linux, PopOS 22
- Python Version: 3.9.0
- openapi-python-client version: 0.11.6