reagento / adaptix

An extremely flexible and configurable data model conversion library.
https://adaptix.readthedocs.io
Apache License 2.0
362 stars 24 forks source link

Skipping optional field cause parameter shuffling #229

Closed zhPavel closed 6 months ago

zhPavel commented 6 months ago
from dataclasses import dataclass

from adaptix import Retort, name_mapping

@dataclass
class Model:
    a: int
    b: int = 2
    c: int = 3

retort = Retort(recipe=[name_mapping(Model, skip=['b'])])
assert retort.load({'a': 10, 'c': 30}, Model) == Model(a=10, b=30)

Result must be Model(a=10, c=30). This also affects on current converting implementation