Commit 9011e83
[Fixed] Preserve integer precision in additionalProperties past 2^53 (#3650)
* Preserve integer precision in additionalProperties past 2^53
Avoid lossy int -> float upconversion in validate_and_convert_types when
both int and float are valid target types (e.g. additionalProperties on
every ModelNormal subclass). Without this guard, calling float() on any
integer above 2^53 silently rounds to the nearest IEEE 754 double,
losing the low bits.
Fixes #3649.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* Apply precision fix to model_utils.j2 template
The previous commit patched only the generated src/datadog_api_client/model_utils.py;
this commit applies the same guard to the Jinja2 template at
.generator/src/generator/templates/model_utils.j2 so the fix survives the
next regeneration via ./generate.sh.
Verified: rerunning the generator + ruff (pinned to v0.1.4 per
.pre-commit-config.yaml) produces no diff against the file from the prior
commit.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* pre-commit fixes
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>1 parent 117979c commit 9011e83
3 files changed
Lines changed: 45 additions & 0 deletions
File tree
- .generator/src/generator/templates
- src/datadog_api_client
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1348 | 1348 | | |
1349 | 1349 | | |
1350 | 1350 | | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
1351 | 1358 | | |
1352 | 1359 | | |
1353 | 1360 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1364 | 1364 | | |
1365 | 1365 | | |
1366 | 1366 | | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
1367 | 1374 | | |
1368 | 1375 | | |
1369 | 1376 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
308 | 308 | | |
309 | 309 | | |
310 | 310 | | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
0 commit comments