Skip to content
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

Nested structure validation #23

Closed
samdark opened this issue Jul 25, 2019 · 5 comments
Closed

Nested structure validation #23

samdark opened this issue Jul 25, 2019 · 5 comments

Comments

@samdark
Copy link
Member

samdark commented Jul 25, 2019

It would be great to be able to specify validation for nested structures such as arrays or JSON.

See https://yiiframework.ru/forum/viewtopic.php?f=38&t=51463

@samdark samdark added the type:enhancement Enhancement label Jul 25, 2019
@demonking
Copy link

Could you post an example?

@samdark
Copy link
Member Author

samdark commented Oct 24, 2019

Input:

$_POST = [
   'id' => 42,
   'name' => 'Nested structure validation',
   'tags' => ['nested', 'validation'],
];

Need to validate that each item in tags is a string with at least 3 characters.

@samdark
Copy link
Member Author

samdark commented Dec 26, 2019

That is now possible with Each validator but I'm not sure it will work well for more complicated structures.

@demonking
Copy link

i will test , and when needed implement it

@SOHELAHMED7
Copy link

@Insolita has created a amazing package (https://github.com/Insolita/yii2-array-structure-validator) for similar thing in Yii2. We can re-use it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants