Skip to content

Commit

Permalink
fix: semantics for item processor
Browse files Browse the repository at this point in the history
  • Loading branch information
massfords authored and ChristopheBougere committed Jun 1, 2023
1 parent ba82c9e commit c3b34b3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 16 deletions.
45 changes: 45 additions & 0 deletions src/__tests__/definitions/valid-map-noconfig.asl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"Comment": "Valid example of Map without ProcessorConfig",
"StartAt": "Map",
"States": {
"Map": {
"Type": "Map",
"ItemReader": {
"ReaderConfig": {
"InputType": "CSV",
"CSVHeaderLocation": "FIRST_ROW",
"MaxItems": 1
},
"Resource": "arn:aws:states:::s3:getObject",
"Parameters": {
"Bucket": "Database",
"Key": "csv-dataset/ratings.csv"
}
},
"ItemProcessor": {
"StartAt": "LambdaTask",
"States": {
"LambdaTask": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
"OutputPath": "$.Payload",
"Parameters": {
"Payload.$": "$",
"FunctionName": "arn:aws:lambda:us-east-2:123456789012:function:processCSVData"
},
"End": true
}
}
},
"Label": "Map",
"End": true,
"ResultWriter": {
"Resource": "arn:aws:states:::s3:putObject",
"Parameters": {
"Bucket": "myOutputBucket",
"Prefix": "csvProcessJobs"
}
}
}
}
}
30 changes: 14 additions & 16 deletions src/schemas/map.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,21 @@
"ItemProcessor": {
"type": "object",
"allOf": [{ "$ref": "base-state-machine.json#" }],
"oneOf": [
{
"properties": {
"ProcessorConfig": {
"type": "object",
"$comment": "The \"ItemProcessor\" field MAY contain a field named \"ProcessorConfig\", whose value MUST be a JSON object whose value is defined by the interpreter.",
"properties": {
"ProcessorConfig": {
"type": "object",
"oneOf": [
{
"properties": {
"Mode": {
"type": "string",
"enum": ["INLINE"]
}
}
}
}
},
{
"properties": {
"ProcessorConfig": {
"type": "object",
},
"required": ["Mode"]
},
{
"properties": {
"Mode": {
"type": "string",
Expand All @@ -99,11 +96,12 @@
"type": "string",
"enum": ["EXPRESS", "STANDARD"]
}
}
},
"required": ["Mode", "ExecutionType"]
}
}
]
}
]
}
},
"Iterator": {
"$ref": "base-state-machine.json#"
Expand Down

0 comments on commit c3b34b3

Please sign in to comment.