-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Analytics array variable substitutions #26157
Conversation
9d44b5a
to
41f289b
Compare
41f289b
to
de2b73f
Compare
thanks for fixing this! |
@lannka Should we worry about nested array expansion? |
0bdc323
to
3aaa5db
Compare
LGTM Two questions
are we also supporting nested arrays like
Thanks. |
Do you mean using nested arrays in Also just to clarify, expanding extraUrlParams does not work:
|
That should be fine. What about nested array within the array. For example
Or it doesn't matter given the way we handle |
Yes, it handle nested arrays in the request body. |
Sounds good, thanks for confirming |
@zhouyx What I am worried about is arrays expanding arrays:
Should we worry about this? To fix it would take a good amount of effort, I believe. |
Discussed offline. We will leave as is and document that this is not the intended behavior. If requested, we will fix. |
SGTM. I'll let @lannka approve the PR since they've started the review : ) |
value = this.expandValue_(value, options); | ||
} else if (isArray(value)) { | ||
// Treat each value as a template and expand | ||
for (let i = 0; i < value.length; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code breaks with an array like ["test", 123]
, because we are checking if the value type of string for items from the array.
This breaks use case like:
"request": "example.com?data=${data1}"
"vars": {
"abc": "${timestamp}.${requestCount}",
"data1": ["ds", 123]
},
Let's fix before next canary cut, thanks.
For #21224
Variable substitutions can now be handled in arrays:
${array} -> 'bar,hello'
This will not work for nested arrays (see test case). Should we allow/disallow nested arrays? Or leave as is?