Skip to content

Commit 25952ae

Browse files
committed
fix: remove milliseconds from isoformat
1 parent d46544c commit 25952ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

openapi_python_client/templates/property_templates/datetime_property.py.jinja

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ isoparse({{ source }})
1111
{% macro check_type_for_construct(property, source) %}isinstance({{ source }}, str){% endmacro %}
1212

1313
{% macro transform(property, source, destination, declare_type=True) %}
14-
{% set transformed = source + ".isoformat()" %}
14+
{% set transformed = source + ".isoformat(timespec='seconds') + 'Z'" %}
1515
{% if property.required %}
1616
{{ destination }} = {{ transformed }}
1717
{%- else %}
@@ -27,7 +27,7 @@ if not isinstance({{ source }}, Unset):
2727
{% endmacro %}
2828

2929
{% macro transform_multipart(property, source, destination) %}
30-
{% set transformed = source + ".isoformat().encode()" %}
30+
{% set transformed = "(" + source + ".isoformat(timespec='seconds') + 'Z').encode()" %}
3131
{% if property.required %}
3232
{{ destination }} = {{ transformed }}
3333
{%- else %}

0 commit comments

Comments
 (0)