RFC: Provide an alternate method for overriding ASL objects
Closed this issue · 6 comments
The current method of positionally overriding parameters within ASL gets pretty confusing with larger ASL documents.
It would be awesome to have 1-2 alternate methods of overriding, e.g.
Recursive find and replace
Give the overrides
prop a list of replacement objects, sorta like this:
{ "string" : "MyFunctionNamePlaceholder" , "replaceWith" : myFunction.functionName }
The construct then recurses through the ASL and replaces all occurrences of "MyFunctionNamePlaceholder"
with myFunction.functionName
JSON Path overrides
Give the overrides
prop a list of JSON path elements, and the value to replace them with
{ "path" : "$.States.Branches[0].Parameters.FunctionName" , "replaceWith" : myFunction.functionName }
Let's discuss. I'd like to help implement whatever change we decide on.
Interesting solution here that just does a find/replace against a stringified JSON object, and then converts back to JSON.
This issue is now marked as stale because it hasn't seen activity for a while. Add a comment or it will be closed soon. If you wish to exclude this issue from being marked as stale, add the "backlog" label.
done
@a-bigelow Please take a look at the most recent update. I've added in an AutoDiscover feature for projen, similar to what projen has with Lambda functions and handlers. This will generate a strongly typed interface for providing overrides. I think this is less error prone then the existing method or what you suggested.
Very cool. I will kick the tires on this and open a separate issue if I feel a need.