Support defining a serialization name on the model type that is applied any time that type is parsed by a DTO factory
from dataclasses import dataclass, field
from typing import Annotated, Any, TypeAlias
from litestar.dto.field import DTOField
AliasedStr: TypeAlias = Annotated[str, DTOField(serialization_name="bar")]
@dataclass
class Message:
id: str
foo: AliasedStr
Impact should be relatively minor, adds yet another way to rename fields, however the pattern is already established for marking fields private.
Should we just bite the bullet and embellish DTOField
with every parameter on DTOConfig
that makes sense?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too