ProtixIT / dataclass-binder

Python library to bind TOML data to dataclasses in a type-safe way
MIT License
13 stars 2 forks source link

Require fields with `None` in their annotation to have `None` as their default #37

Closed mthuurne closed 1 year ago

mthuurne commented 1 year ago

TOML doesn't have a None equivalent, so we're not able to format a None value unless it is the default. Also we wouldn't be able to ever bind None to it, so user code handling None would be redundant.

Maybe this is something to revisit if we ever add JSON support, but for now I think this is an improvement over silently ignoring None values.

Closes #31