Spotted during code review of PR #112.
Order (kalshi/models/orders.py) has no model_config, so it falls back to Pydantic's default (extra="ignore"). Several sibling response models explicitly set extra="allow". The result is inconsistent forwards-compatibility behavior when the Kalshi API adds a new field:
- Models with
extra="allow" silently accept and expose the new field via __pydantic_extra__.
- Models with the implicit
extra="ignore" silently drop the new field.
- Models with explicit
extra="forbid" (request bodies, per the v0.8.0+ convention) hard-fail — correct, since these are user-built.
The desired policy for response models is probably one of:
extra="allow" everywhere (forwards-compatible by default; matches the majority pattern).
extra="ignore" everywhere (current Pydantic default; matches Order).
This issue is to:
- Survey every response model in
kalshi/models/ and list which extra= policy each uses.
- Pick a single policy.
- Apply it uniformly. Add a test that asserts the chosen policy for every model in
kalshi.models.__all__ minus the request bodies.
Out of scope: request bodies, which must stay extra="forbid" per CLAUDE.md / v0.8.0+ convention.
Spotted during code review of PR #112.
Order(kalshi/models/orders.py) has nomodel_config, so it falls back to Pydantic's default (extra="ignore"). Several sibling response models explicitly setextra="allow". The result is inconsistent forwards-compatibility behavior when the Kalshi API adds a new field:extra="allow"silently accept and expose the new field via__pydantic_extra__.extra="ignore"silently drop the new field.extra="forbid"(request bodies, per the v0.8.0+ convention) hard-fail — correct, since these are user-built.The desired policy for response models is probably one of:
extra="allow"everywhere (forwards-compatible by default; matches the majority pattern).extra="ignore"everywhere (current Pydantic default; matchesOrder).This issue is to:
kalshi/models/and list whichextra=policy each uses.kalshi.models.__all__minus the request bodies.Out of scope: request bodies, which must stay
extra="forbid"per CLAUDE.md / v0.8.0+ convention.