Commit b9de23c
committed
fix: preserve write_default when applying a name mapping
NameMappingProjectionVisitor.field rebuilt each NestedField with an
initial_write= keyword, but NestedField.__init__ has no such parameter
(the write-default keyword is write_default). Being a Pydantic model,
the unknown key was swallowed by **data and silently ignored, so
apply_name_mapping dropped every field's write_default to None.
Pass write_default= to match the NestedField constructor and add a
regression test asserting both initial_default and write_default
survive a name mapping.1 parent 9d36e23 commit b9de23c
2 files changed
Lines changed: 20 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
341 | 341 | | |
342 | 342 | | |
343 | 343 | | |
344 | | - | |
| 344 | + | |
345 | 345 | | |
346 | 346 | | |
347 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
403 | 403 | | |
404 | 404 | | |
405 | 405 | | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
0 commit comments