Is there a way to make AWS Step function parameter optional? or accept an expression to say if the value is passed pick the value else default it to a certain value?
Example:
Lets say my Parameters are defined as follows:
"Parameters": {
"comment": "Selecting what I care about.",
"MyDetails": {
"size.$": "$.inputSize"
}
},
If I don't pass inputSize, the step function fails. is there a way to make this an optional parameter or have an expression like inputSize || 10 where 10 would be picked if nothing is passed
Short answer is NO.
Two things to note about Step Function state input/output and state InputPath/OutputPath
Suggestion
My suggestion is to set the inputSize property to zero or a negative number either in previous state or during step function invocation (don't forget to pass it along various intermediate states). Then you can have a choice state where you can take different routes in your workflow depending upon the value of the inputSize property.
Another way could be to have a mandatory boolean property which tells if a particular property is present or not in the input or result. This can be helpful in the case we want to check for nullness of a property and take different routes in the workflow.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With