Skip to content

Commit

Permalink
replace Field.alias with Field.serialization_alias
Browse files Browse the repository at this point in the history
> serialization_alias: Like `alias`, but only affects serialization, not validation.
  • Loading branch information
NextFire committed Oct 16, 2024
1 parent 8774fe7 commit 23d8d2c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mahou/templates/model.py.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ class {{dataclass.name}}():
{%- for element in dataclass.required_elements %}
{{element.name}}{% if element.type %}: {{element.type}}{% endif %}
{%- if element.alias -%}
= Field(alias="{{element.alias}}")
= Field(serialization_alias="{{element.alias}}")
{%- endif %}
{%- endfor -%}
{%- for element in dataclass.optional_elements %}
{{element.name}}{% if element.type %}: {{element.type}} | None{% endif %}
{%- if element.alias -%}
= Field(alias="{{element.alias}}", default=None)
= Field(serialization_alias="{{element.alias}}", default=None)
{%- else -%}
= None
{%- endif %}
Expand Down

0 comments on commit 23d8d2c

Please sign in to comment.