Open MarcBresson opened 2 months ago
Interesting feature request! I'm not opposed. Wdyt @Viicos?
I can open a PR with support for this in v2.10, potentially.
The thing is we don't support using AliasChoices
/AliasPath
for alias
.
I don't recall exactly how alias_generator
plays with validation_alias
/serialization_alias
, might be good looking into this.
Perhaps https://github.com/pydantic/pydantic/issues/8379 could be tackled first (I don't know if it relates with this issue or not).
Yeah, #8379 is definitely higher prio.
Initial Checks
Description
allow alias generator to access FieldInfo, and particularly its aliases.
It would allow users to generate aliases based on already present aliases
Affected Components
.model_dump()
and.model_dump_json()
model_construct()
, pickling, private attributes, ORM mode