Brightspace / serverless-plugin-for-each

Serverless plugin that adds $forEach syntax to reduce code duplication and allow creating dynamic templates
Apache License 2.0
1 stars 5 forks source link

No escape in interpolate value #62

Open throrin19 opened 1 year ago

throrin19 commented 1 year ago

Hello,

I have a problem with forEach in a case the string contains special chars for JSON (like ").

If we try to use the $forEach with one of this value, we have the error Interpolated template is not a valid JSON :

Example :

$forEach:
  iterator: 
    - test: '{"example": "example"}'
  template:
    $forEach.key: $forEach.value

to avoid that, I think we should make a JSON.stringify on the value part of interpolated