OAI / OAI/Overlay-Specification
String Interpolation for Update Values
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 121
- Forks
- 38
- Avg merge
- 53m
- Merged PRs (30d)
- 6
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the linked Environment Variables issue and the Arazzo examples referenced in this issue, then review the discussion here. Determine whether interpolation with prefixes and suffixes should be supported alongside the proposed $env.VAR_NAME syntax; done requires an agreed design and clear specification changes.
Written by the indexing model from the issue text.
Assessment
- Domain
- backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Quiet
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100