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
The examples of how to add a custom uuid function dynamicDefaults wrap uuid.v4(). However, I'd expect to be able to use either just uuid (which calls uuid.v4) or uuid.v4 itself, without a function uuidv4() wrapper.
It seems that the code in dynamicDefaults uses `func.length figure out if the value of the custom dynamicDefault should be called with arguments.
I guess func.length is being used to figure out if arguments should be passed to the func as defined in the schema via {func: "uuid", args }, but perhaps a better way would be to just check if args is defined?
It'd be nice if I didn't have to make a wrapper for functions that have default parameters.
The text was updated successfully, but these errors were encountered:
The examples of how to add a custom uuid function dynamicDefaults wrap
uuid.v4()
. However, I'd expect to be able to use either justuuid
(which callsuuid.v4
) oruuid.v4
itself, without afunction uuidv4()
wrapper.It seems that the code in dynamicDefaults uses `func.length figure out if the value of the custom dynamicDefault should be called with arguments.
(I didn't know this, but In javascript, Function.length is the number of arguments.)
I guess
func.length
is being used to figure out if arguments should be passed to the func as defined in the schema via{func: "uuid", args }
, but perhaps a better way would be to just check ifargs
is defined?It'd be nice if I didn't have to make a wrapper for functions that have default parameters.
The text was updated successfully, but these errors were encountered: