-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Description
Contextually there is a huge difference with Paths with null and being omitted. By not allowing null paths to be deserialized into JSON the StateMachine does not comply with the users intent.
Is there, or can there be a way to make this behavior configurable?
Details
To give some additional clarity, hopefully, the documentation states the following regarding ResultPath:
- If the ResultPath has the default value of $, it matches the entire input. In this case, the results of the state execution overwrite the input entirely and the input becomes available to pass along.
- If the ResultPath is null, the results of executing the state are discarded and the input is untouched.
If I explicitly set result path to null, via the API, the resultant JSON has it completely omitted. Thus my state machine goes from ignoring the results completely to overwriting the input with the results.
The code causing this behavior is here (I think): https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-stepfunctions/src/main/java/com/amazonaws/services/stepfunctions/builder/StateMachine.java#L39
Here's some example code:
.state("my-state-name", taskState()
.resource("my-lambda-function-arn")
.inputPath("$.metadata")
.resultPath(null)
.outputPath("$")
.transition(next("my-next-state")))
Results in the following JSON:
"my-state-name" : {
"Next" : "my-next-state",
"Resource" : "my-lambda-function-arn",
"InputPath" : "$.metadata",
"OutputPath" : "$",
"Type" : "Task"
}
Where what I would actually want here is the following JSON:
"my-state-name" : {
"Next" : "my-next-state",
"Resource" : "my-lambda-function-arn",
"InputPath" : "$.metadata",
"ResultPath" : null,
"OutputPath" : "$",
"Type" : "Task"
}