Skip to content

String Interpolation for Update Values #136

@mikeschinkel

Description

@mikeschinkel

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions