-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Key validation shouldn't happen when no schema for a hash is set #452
Comments
Discovered in #450 |
Bumping this |
This would be really helpful. |
Is there any way how to bump this up more than giving the like? Or is there any way how to achieve similar behaviour? What I would need is for validation to throw error, if the input hash has a key (attribute) I am not expecting, but also allow one of the defined keys which value is hash with undefined keys/structure. Example to allow (
Example to disallow (because
|
@flash-gordon Hello, I managed to put together some code, that is trying to tackle this issue. I am not really sure if it is the right approach. Also not really sure if it is already in a state for PR. https://github.com/JanecekJ/dry-schema/tree/fix-hash-without-schema-validation Can you maybe give me a pointer if this could work or it is not a way to go? |
@JanecekJ did you persevere with this fix? as I to have stumbled across this issue and it is blocking a feature I want to progress with |
Describe the bug
There can be a case when no schema for a hash is set. In such a case, there's not need to validate keys. I might be wrong but it's just logical to me.
To Reproduce
Expected behavior
The validation passes. We didn't specify any key for nested hashes, key validation shouldn't be applied in such cases. I would expect such values to be validated at later stages with rules or custom code.
My environment
The text was updated successfully, but these errors were encountered: