Skip to content

Commit

Permalink
feat(step-functions): changed parameters to a more specific type and…
Browse files Browse the repository at this point in the history
… added a link to the docs

    AWS Step Functions released support for 'Parameters' option in the input definition.

    Closes aws#1480
  • Loading branch information
Guilherme Selau committed Jan 8, 2019
1 parent 39017c0 commit 71c9894
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
5 changes: 4 additions & 1 deletion packages/@aws-cdk/aws-stepfunctions/lib/states/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ export interface StateProps {
/**
* Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
*
* @see
* https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
*
* @default No parameters
*/
parameters?: object;
parameters?: { [name: string]: any };

/**
* JSONPath expression to select part of the state to be the output to this state.
Expand Down
5 changes: 4 additions & 1 deletion packages/@aws-cdk/aws-stepfunctions/lib/states/task.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,12 @@ export interface TaskProps {
/**
* Parameters pass a collection of key-value pairs, either static values or JSONPath expressions that select from the input.
*
* @see
* https://docs.aws.amazon.com/step-functions/latest/dg/input-output-inputpath-params.html#input-output-parameters
*
* @default No parameters
*/
parameters?: object;
parameters?: { [name: string]: any };

/**
* JSONPath expression to select part of the state to be the output to this state.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,20 +103,27 @@ export = {
outputPath: "$.state",
parameters: {
"input.$": "$",
"step": "inital-task"
"stringArgument": "inital-task",
"numberArgument": 123,
"booleanArgument": true,
"arrayArgument": ["a", "b", "c"]
}
});

// WHEN
const taskState = task.toStateJson();

// THEN
test.deepEqual(taskState, {
End: true,
test.deepEqual(taskState, { End: true,
Retry: undefined,
Catch: undefined,
InputPath: '$',
Parameters: { 'input.$': '$', 'step': 'inital-task' },
Parameters:
{ 'input.$': '$',
'stringArgument': 'inital-task',
'numberArgument': 123,
'booleanArgument': true,
'arrayArgument': [ 'a', 'b', 'c' ] },
OutputPath: '$.state',
Type: 'Task',
Comment: undefined,
Expand Down

0 comments on commit 71c9894

Please sign in to comment.