SIGN IN SIGN UP

chore: use alias_generator on generated models instead of per-field aliases (#858)

The codegen postprocess now adds `alias_generator=to_camel` to every
model's `ConfigDict` and emits an explicit `Field(alias=...)` only where
the camelCase conversion is irregular (all-caps usage keys,
`gitHubGistUrl`, `schema`, ...). This drops the explicit per-field
aliases in `_models.py` from 623 to 45 and shrinks the file from 3852 to
3077 lines.

The wire format is unchanged, guarded by tests: Pydantic lets an
explicit alias override the generator, and `populate_by_name=True` keeps
snake_case input working. The before/after runtime alias contract is
byte-identical across all 212 models / 1060 fields, and `_typeddicts.py`
/ `_literals.py` regenerate unchanged (the camel `*Dict` synthesis now
derives names via `to_camel` plus the irregular-alias overrides).

datamodel-codegen has no native option for this (its `--no-alias` would
drop the irregular aliases too), so the work lives in
`scripts/postprocess_generated_models.py`.

Closes #852
V
Vlada Dusek committed
8ff8ec77e20db8108914fc154f19e30435308766
Parent: 8dffe34
Committed by GitHub <noreply@github.com> on 6/22/2026, 11:55:14 AM