You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
When there is missing value in dict, it will raise Error, this is good for majority scenario but sometimes user want to give the attribute with default value for the specific type via default factory callable.
It would be nice to add this support in Config.
Describe the solution you'd like
Add default_factory kwarg in Config which is type dict[type, Callable[[], Any]. the return value of callable is the instance of the key type.
The default value of default_factory is None, which will raise Error when the key is missing.
When the missing value is the type beyond the keys in default_factory, it will also raise Error.
Describe alternatives you've considered
...
Additional context
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
When there is missing value in dict, it will raise Error, this is good for majority scenario but sometimes user want to give the attribute with default value for the specific type via default factory callable.
It would be nice to add this support in
Config
.Describe the solution you'd like
Add default_factory kwarg in
Config
which is typedict[type, Callable[[], Any]
. the return value of callable is the instance of the key type.The default value of
default_factory
isNone
, which will raise Error when the key is missing.When the missing value is the type beyond the keys in
default_factory
, it will also raise Error.Describe alternatives you've considered
...
Additional context
The text was updated successfully, but these errors were encountered: