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
Hey, @seandstewart . I have another feature request.
For data model, there is default_factory which can be used to set dynamic default value. For function argument, if set the default value as a instance of typic.Field, it won't be validated as a default value. datetime.now as a default_factory is quite common. Every time I have to handle it like this:
Especilly when we have many functions with dynamic default value, it would be a problem. Currently, beacuse the default value would not be validated, I defined a Helper class to solve this.
This is a great idea, and again, thank you for the detailed example. I haven’t focused much on this issue in the past because the original focus of the decorator was simply to ensure external inputs are the type you expect, but I do see the value here.
I’m beginning to compile a list of features for the next minor release - I definitely think this is achievable and worth adding to it.
Description
Hey, @seandstewart . I have another feature request.
For data model, there is
default_factory
which can be used to set dynamic default value. For function argument, if set the default value as a instance oftypic.Field
, it won't be validated as a default value.datetime.now
as a default_factory is quite common. Every time I have to handle it like this:Especilly when we have many functions with dynamic default value, it would be a problem. Currently, beacuse the default value would not be validated, I defined a Helper class to solve this.
Now we can redefine
foo
like this:By the way, what if the user want to use the key words such as
dict
,schema
,coerce
,strict
and so on, as the function argument or data attribute?The text was updated successfully, but these errors were encountered: