-
Notifications
You must be signed in to change notification settings - Fork 23
Description
Was on call with @lornajane today and we discussed Environment Variables and the topic of string interpolation came up.
Lorna proposed using a $env.VAR_NAME
syntax, and while we were looking around for prior art we found what appears to be an example of string interpolation in the Arazzo examples which I will copy here, specifically "couponCode": "{$inputs.coupon_code}",
:
Example from Arazzo:
contentType: application/json
payload: |
{
"petOrder": {
"petId": "{$inputs.pet_id}",
"couponCode": "{$inputs.coupon_code}",
"quantity": "{$inputs.quantity}",
"status": "placed",
"complete": false
}
}
The above example does not have any suffix or prefix literals, but I can imagine that if could:
Example modified to show suffixes and prefixes:
contentType: application/json
payload: |
{
"petOrder": {
"petId": "{$inputs.pet_id}000",
"couponCode": "coupon-{$inputs.coupon_code}",
"quantity": "{$inputs.quantity}",
"status": "placed",
"complete": false
}
}
We both agreed there was value to incorporating string interpolation although Lorna argued against doing it sooner than later (I will let her elaborate as to why.)
I argued if we were to adopt Arazzo's style of variables (which I support) — e.g. $env.VAR_NAME
— then also supporting string interpolation would be very small incremental lift for implementors with an outsized increase in utility to support more of the 80 percentile of use-cases.
This of course assumes we do not envision that supporting it would block some future capability we plan for in the future.
Lorna asked me to create an issue so that others could weigh in on the idea, and here it is.