This validation returns no errors. Which it should not since email is not defined in the schema and by that virtue, email is an optional, free-text value, but I think there are real-time situations where rules could be forgotten to be passed into the schema with potentially serious consequences. This also applies for schema.clone.
Shouldn't validate in this case output a warning about email not being part of the schema?
Perhaps new Schema, schema.clone and/or validate method could take an optional second argument as a configuration object where the option for this would be something like suppressWarnings: false?
Consider
and then validating
This validation returns no errors. Which it should not since email is not defined in the schema and by that virtue, email is an optional, free-text value, but I think there are real-time situations where rules could be forgotten to be passed into the schema with potentially serious consequences. This also applies for
schema.clone
.Shouldn't
validate
in this case output a warning about email not being part of the schema?Perhaps
new Schema
,schema.clone
and/orvalidate
method could take an optional second argument as a configuration object where the option for this would be something likesuppressWarnings: false
?