Closed bebraw closed 8 years ago
I'd probably go with first argument = config, second arg: options (including schema). I expect the majority of people to use it without options - in that case just wrapping the config object with a validate
call seems most straight forward to me.
I think lets go with a major version, but check if second arg is a joi schema, in that case give a deprecation warning, remove with version 3. I totally dig that pattern but I'm not 100 percent share if it's overkill for the scope of the library. Thoughts? (also cc @kentcdodds)
Why do we need the schema Parameter at all? You can concat the existing schema or overwrite it
To override the default schema. Without explicitly telling the function which schema to take it'll default to the presupplied one.
Implemented in #81.
To set
quiet
now, you need to do something like this:Instead, it would be neater to make schema optional by swapping the last two parameter. Then we would get just:
Or we could fold all this to an object:
This would be future proof (easy to add features).
The last option would be possible to implement in a backwards compatible way (check for
config
key).What do you think?