Skip to content

arrayIndex of parent arrays in nested array conditions #596

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

Closed
joelwkent opened this issue Nov 15, 2015 · 1 comment
Closed

arrayIndex of parent arrays in nested array conditions #596

joelwkent opened this issue Nov 15, 2015 · 1 comment

Comments

@joelwkent
Copy link
Member

I'm working on a project and have a schema with a 3 level deep array. In the form JSON I want a condition on one of the fields in the nested array. In conditions the only way I know to reference an array element in the model is to use arrayIndex but that is just the index of the inner most array. So the following condition will not work as arrayIndex will only be the correct index for prices[]:

"condition": " model.products[arrayIndex].versions[arrayIndex].prices[arrayIndex].currency == 'USD'"

Is there anyway to perform conditions on nested arrays and reference the nested array element in the model? Something like:

"condition": " model.products[parent.parent.arrayIndex].versions[parent.arrayIndex].prices[arrayIndex].currency == 'USD'"

Any help would be greatly appreciated!!

@Anthropic
Copy link
Member

@joelwkent I'm going to close this as it is now handled in your open PR :)

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