Skip to content

Commit 40b418b

Browse files
committed
fix: update condition for default value assignment in BaseModel template
1 parent 1f9869e commit 40b418b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/datamodel_code_generator/model/template/pydantic_v2/BaseModel.jinja2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class {{ class_name }}({{ base_class }}):{% if comment is defined %} # {{ comme
3232
{%- else %}
3333
{{ field.name }}: {{ field.type_hint }}
3434
{%- endif %}
35-
{%- if not field.required and (field.represented_default != 'None' or not field.strip_default_none) or field.data_type.is_optional)
35+
{%- if not field.required and (field.represented_default != 'None' or not field.strip_default_none or field.data_type.is_optional)
3636
%} = {{ field.represented_default }}
3737
{%- endif -%}
3838
{%- endif %}

0 commit comments

Comments
 (0)