-
Notifications
You must be signed in to change notification settings - Fork 341
[WIP] Add array support with any constraints #184
base: master
Are you sure you want to change the base?
Conversation
* New validator: forEach and forEachSingle * Add validator specification about return value.
|
Hey guys, when can we expect this to be released? 😃 |
|
Is there any update on this? |
|
+1 |
|
I think that instead return a object like: should be: or: What you think? |
|
+1 |
|
At first glance, without writing a custom formatter, it looks like the minimum we can do is the following. which only checks length and a string would give us a false positive, when we're looking for an array. Is there a widely accepted array formatter pattern that people are using in the meantime? Something that could validate this kind of pattern: definitely looking forward to this PR! thanks :) edit: example custom validator to validate all values in an array for example above custom validator: schema: |
|
I'm so sorry. This PR slipped through the cracks it seems, it looks like a good first implementation. If you add some tests I'll try to get it merged ASAP. |
|
@ansman Any update on when this will be released? Thank you. |
|
+1 |
|
This would be pretty cool |
|
Its some way how works with var constraints = {} like with array I have trouble, when is in {} some element which not exists, code does not work Original: Will be like: // dont care about "exists()" // dont care about "exists()" |
|
@nishidayuya resolve merge conflicts when you have time :D |
|
any update on when this will be released? |
|
+1 when can we expect this? |
feffe94 to
40e06a1
Compare
|
I worked around this for now, but it would be great to have this baked in. |
I implemented
forEachvalidator andforEachSinglevalidator. We can specify any constraints for each array element.Why [WIP]?
This pull-request is WIP (work in progress), because I want you to check following:
foreach)After you accept them, I will create tests,
git pushit and remove [WIP] mark.forEachvalidatorThis validator checks object properties in array element.
Sample:
This is following requests implementation:
I think this validator name is
forEachand it is better thaneach. I thought following:forEachKeyInKeypath.forEach(Array.prototype.forEach), and it doesn't useeach. http://www.ecma-international.org/ecma-262/7.0/#sec-array.prototype.foreachforEachSinglevalidatorThis validator checks object in array element like
validateSinglefunction.Sample: