feat(stepfunctions): implement States.JsonMerge intrinsic#1662
Open
abanna wants to merge 5 commits into
Open
Conversation
The DPS provisioning state machine uses States.JsonMerge, which AslExecutor rejected with "Unsupported intrinsic function: States.JsonMerge". Implement the shallow merge (second object's top-level fields win on conflict); reject the deep-merge form (third argument true) and non-object arguments, as AWS does. Also resolve boolean/null literal intrinsic arguments so the third argument evaluates correctly. Covered by AslExecutorJsonMergeTest.
4 tasks
The third (deep) argument was read with JsonNode.asBoolean(), which silently coerces null/number/string/object nodes to false, so States.JsonMerge($.a,$.b,$.x) with a non-boolean $.x quietly performed a shallow merge instead of failing. Validate that the resolved third argument is a boolean and raise States.Runtime otherwise. Covered by AslExecutorJsonMergeTest.nonBooleanThirdArgumentRejected.
…-merge flag AWS validates the argument types of States.JsonMerge before evaluating the deep-merge flag, so two non-objects passed with true should report "requires two JSON objects" rather than "shallow merge only". Reorder the object-type check ahead of the deep-flag rejection and add a precedence test.
Contributor
Author
|
Applied the Greptile P2 on error precedence: the object-type check now runs before the deep-merge-flag rejection, so |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the
States.JsonMergeintrinsic function to the Step Functions executor. Previously any state using it failed withUnsupported intrinsic function: States.JsonMerge.States.JsonMerge($.a, $.b, false): the result isa's top-level fields withb's top-level fields merged in, andbwins on a key conflict.true) and non-object arguments, matching AWS (which only supportsfalse).true/false/nullliteral intrinsic arguments inresolveIntrinsicArg, so the third argument evaluates to a real boolean rather than falling through to path resolution.Type of change
feat:)AWS Compatibility
States.JsonMerge(json1, json2, isDeepMerge)performs a shallow merge of two JSON objects; the only supportedisDeepMergevalue isfalse, and conflicting top-level keys take the value from the second object. Deep merge (true) is rejected. Verified against the documented AWS intrinsic behavior and covered byAslExecutorJsonMergeTest.Checklist
./mvnw testpasses locally (AslExecutorJsonMergeTest: 4 tests; siblingAslExecutorCatchTestregression green — run in aneclipse-temurin:25-jdkcontainer)AslExecutorJsonMergeTest)