Rule Variables #658
Replies: 2 comments 1 reply
-
|
I took a stab at this a while back and noticed a very difficult problem. You don't really want to specifically type your variables because that would require a schema change for, what is essentially, just changing data. So when it comes to knowing what variables can be used where (especially in a YAML file) it's very difficult. A solution that is seemingly easier to implement is adding rules within the payload. IE: foo:
rules:
- payload:
a:
b: 123
c:
d:
$rules:
- targeting:
channel: [news]
payload: D'e
- payload: dee
e: 999The only problem with the above is not utilising the idea of "embedded" rules across all rules. |
Beta Was this translation helpful? Give feedback.
-
|
We went for the following in the end: foo:
variables:
d:
- targeting:
channel: [news]
payload: D'e
- payload: dee
rules:
- payload:
a:
b: 123
c:
d: {{ d }}
e: 999 |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
There can be the case where a large structure is used as a payload. For example:
And imagine that we want to change
a.c.dto something else when the target changes.These rules could get very large, especially if there's a lot of properties that might change depending on targeting.
Until now, we've relied on setting external rules and making use of things like
@targetd/expodein the final (or next) stage.Neither of these options are ideal. If anything, they're a flaw in the design. Why not consider using some kind of variables? For example:
The API could look something like:
Beta Was this translation helpful? Give feedback.
All reactions