-
-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Default Schema don't filter undescribed params #366
Comments
I think that such behavior is OK. Because we do not specify that any other params should be filtered. Maybe it is good idea to implement such DSL: schema = Dry::Validation.Schema do
method :default # as it used to be
method :strict # makes :success? to be false if any not declared keys are present
method :filter # just filters keys not declared keys
end |
This was considered as bug and solved Howto: Dry::Validation.Schema do
configure do
config.input_processor = :sanitizer
end
key(:email).required
key(:age).maybe(:int?, gt?: 18)
key(:address).schema do
key(:city).required
key(:street).required
end
end
result = schema.(
email: 'jane@doe',
age: 19,
such: 'key',
address: { city: 'NYC', street: 'Street', wow: 'bad' }
)
result.output
# { email: 'jane@doe', age: 19, address: { city: 'NYC', street: 'Street' } |
Yep. I arrived here after looking at #66. Add |
This will be the default behavior in the next release |
I thought |
@mengqing no, you either configure it in each schema, or use a base schema and inherit from it |
@solnic Thanks for the quick reply |
The text was updated successfully, but these errors were encountered: