Commit 52ba58c
Cast time_period to string before posting to simulation gateway
The policyengine-api-v2 simulation gateway (PR #458, deployed in v42 on
2026-04-26) tightened its request schema to require time_period as
Optional[str]. The locally-installed policyengine PyPI package
(PolicyEngine/policyengine.py, commit 29f2c1a 2025-01-28) declares
TimePeriodType = int on SimulationOptions.time_period, so
model_validate() coerces incoming string years to int and model_dump()
re-emits them as int. The gateway then 422s every economy-comparison
request.
Cast time_period to str on the dict produced by model_dump() right
before passing to simulation_api.run(), without changing the
SimulationOptions schema. This is the minimum-surface fix on the
caller side; downstream simulation code that consumes time_period as
int is unaffected because that work happens after the gateway has
deserialized the body.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 1112996 commit 52ba58c
2 files changed
Lines changed: 10 additions & 0 deletions
File tree
- changelog.d
- policyengine_api/services
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
511 | 511 | | |
512 | 512 | | |
513 | 513 | | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
514 | 523 | | |
515 | 524 | | |
516 | 525 | | |
| |||
0 commit comments