Skip to content

Commit

Permalink
Support JSONata and Variable fields (#159)
Browse files Browse the repository at this point in the history
Co-authored-by: Elvin Hwang <[email protected]>
  • Loading branch information
elvin-hwang and jayakvv authored Dec 2, 2024
1 parent 73b00a2 commit 332d6a4
Show file tree
Hide file tree
Showing 14 changed files with 1,141 additions and 141 deletions.
483 changes: 364 additions & 119 deletions src/json-schema/bundled.json

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions src/json-schema/partial/base.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
},
"States": {
"$ref": "states.json#/definitions/states"
},
"QueryLanguage": {
"$ref": "common.json#/definitions/queryLanguage"
}
},
"required": [
Expand Down
39 changes: 39 additions & 0 deletions src/json-schema/partial/choice_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
"minItems": 1,
"items": {
"oneOf": [
{
"$ref": "#/definitions/jsonataCondition",
"errorMessage": "Incorrect type. Expected a valid choice state condition."
},
{
"$ref": "#/definitions/topStringEquals"
},
Expand Down Expand Up @@ -155,6 +159,12 @@
"Default": {
"type": "string",
"description": "The name of the state to transition to if none of the Choice Rules match."
},
"Output": {
"$ref": "common.json#/definitions/output"
},
"Assign": {
"$ref": "common.json#/definitions/assign"
}
},
"required": [
Expand All @@ -173,6 +183,35 @@
"description": "The state to transition to if there is an exact match between the input value and the comparison operator for this Choice Rule.",
"minLength": 1
},
"jsonataCondition": {
"type": "object",
"properties": {
"Condition": {
"oneOf": [
{
"type": "boolean",
"errorMessage": "Incorrect type. Expected one of boolean, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
]
},
"Assign": {
"$ref": "common.json#/definitions/assign"
},
"Next": {
"$ref": "#/definitions/next"
},
"Comment": {
"$ref": "common.json#/definitions/comment"
}
},
"required": [
"Condition",
"Next"
]
},
"topStringEquals": {
"type": "object",
"properties": {
Expand Down
49 changes: 49 additions & 0 deletions src/json-schema/partial/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
"Map"
]
},
"QueryLanguage": {
"$ref": "#/definitions/queryLanguage"
},
"Comment": {
"$ref": "#/definitions/comment"
}
Expand Down Expand Up @@ -89,6 +92,15 @@
}
}
},
"queryLanguage": {
"type": "string",
"description": "ASL mode configuration. Specify either JSONata or JSONPath.",
"minLength": 1,
"enum": [
"JSONata",
"JSONPath"
]
},
"comment": {
"type": "string",
"description": "A human-readable comment or description.",
Expand Down Expand Up @@ -143,6 +155,10 @@
"type": "string",
"pattern": "\\$.*"
},
"jsonata": {
"type": "string",
"pattern": "^{%(.*)%}$"
},
"parameters": {
"type": [
"number",
Expand Down Expand Up @@ -231,15 +247,48 @@
}
]
},
"Output": {
"$ref": "#/definitions/output"
},
"Comment": {
"$ref": "#/definitions/comment"
},
"Assign": {
"$ref": "#/definitions/assign"
}
},
"required": [
"ErrorEquals",
"Next"
]
}
},
"arguments": {
"oneOf": [
{
"type": "object",
"errorMessage": "Incorrect type. Expected one of object, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "An object or JSONata expression to define the Argument of this task state."
},
"output": {
"type": [
"number",
"string",
"boolean",
"object",
"array",
"null"
],
"description": "A value to define the Output configuration of this task state."
},
"assign": {
"type": "object",
"description": "An object to define the variables to be assigned."
}
}
}
139 changes: 127 additions & 12 deletions src/json-schema/partial/map_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,16 @@
]
},
"MaxItems": {
"type": "integer",
"description": "An integer that limits the number of data items passed to the Map state.",
"oneOf": [
{
"type": "integer",
"errorMessage": "Incorrect type. Expected one of integer, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "An integer or JSONata expression that limits the number of data items passed to the Map state.",
"minimum": 0
},
"MaxItemsPath": {
Expand All @@ -102,6 +110,22 @@
"arn:aws:states:::s3:listObjectsV2"
]
},
"Arguments": {
"$ref": "common.json#/definitions/arguments",
"description": "A JSON object or JSONata expression that specifies the Amazon S3 bucket name and object key or prefix in which the dataset is stored.",
"properties": {
"Bucket": {
"type": "string",
"description": "A string that specifies the Amazon S3 bucket name in which the dataset is stored.",
"minLength": 1
},
"Key": {
"type": "string",
"description": "A string that specifies Amazon S3 object key in which the dataset is stored.",
"minLength": 1
}
}
},
"Parameters": {
"type": "object",
"description": "A JSON object that specifies the Amazon S3 bucket name and object key or prefix in which the dataset is stored.",
Expand Down Expand Up @@ -131,29 +155,59 @@
}
},
"ItemSelector": {
"type": "object",
"description": "A JSON object that overrides each single element of the item array."
"type": [
"number",
"string",
"boolean",
"object",
"array",
"null"
],
"description": "A JSON object or value that overrides each single element of the item array."
},
"ItemBatcher": {
"type": "object",
"description": "A JSON object that specifies how to batch the items for the ItemProcessor.",
"properties": {
"BatchInput": {
"type": "object",
"type": [
"number",
"string",
"boolean",
"object",
"array",
"null"
],
"description": "Specifies a fixed JSON input to include in each batch passed to each child workflow execution."
},
"MaxItemsPerBatch": {
"type": "integer",
"description": "An integer that limits the maximum number of items of each sub-array.",
"oneOf": [
{
"type": "integer",
"errorMessage": "Incorrect type. Expected one of integer, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "An integer or JSONata expression that limits the maximum number of items of each sub-array.",
"minimum": 1
},
"MaxItemsPerBatchPath": {
"$ref": "common.json#/definitions/referencePath",
"description": "A reference path to an integer that limits the maximum number of items of each sub-array."
},
"MaxInputBytesPerBatch": {
"type": "integer",
"description": "An integer that limits the maximum size in bytes of each sub-array.",
"oneOf": [
{
"type": "integer",
"errorMessage": "Incorrect type. Expected one of integer, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "An integer or JSONata expression that limits the maximum size in bytes of each sub-array.",
"minimum": 1
},
"MaxInputBytesPerBatchPath": {
Expand All @@ -173,6 +227,22 @@
"arn:aws:states:::s3:putObject"
]
},
"Arguments": {
"$ref": "common.json#/definitions/arguments",
"description": "A JSON object that specifies the Amazon S3 resource to export the results to.",
"properties": {
"Bucket": {
"type": "string",
"description": "A string that specifies the Amazon S3 bucket name to export the results to.",
"minLength": 1
},
"Prefix": {
"type": "string",
"description": "A string that specifies the Amazon S3 object prefix to export the results to.",
"minLength": 1
}
}
},
"Parameters": {
"type": "object",
"description": "A JSON object that specifies the Amazon S3 resource to export the results to.",
Expand Down Expand Up @@ -238,21 +308,51 @@
"description": "A string that uniquely identifies a Map state.",
"minLength": 1
},
"ToleratedFailurePercentage": {
"oneOf": [
{
"type": "integer",
"errorMessage": "Incorrect type. Expected one of integer, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "An integer or JSONata expression that provides an upper bound on the percentage of items that may fail.",
"minimum": 0,
"maximum": 100
},
"ToleratedFailurePercentagePath": {
"$ref": "common.json#/definitions/referencePath",
"description": "A reference path to an integer that provides an upper bound on the percentage of items that may fail."
},
"ToleratedFailureCount": {
"type": "integer",
"description": "An integer that provides an upper bound on how many items may fail.",
"oneOf": [
{
"type": "integer",
"errorMessage": "Incorrect type. Expected one of integer, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "An integer or JSONata expression that provides an upper bound on how many items may fail.",
"minimum": 0
},
"ToleratedFailureCountPath": {
"$ref": "common.json#/definitions/referencePath",
"description": "A reference path to an integer that provides an upper bound on how many items may fail."
},
"MaxConcurrency": {
"type": "integer",
"oneOf": [
{
"type": "integer",
"errorMessage": "Incorrect type. Expected one of integer, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "Provides an upper bound on how many invocations of the Iterator may run in parallel.\n\nThe default value is 0, which places no limit on parallelism and iterations are invoked as concurrently as possible.",
"minimum": 0
},
Expand All @@ -268,6 +368,21 @@
"Catch": {
"$ref": "common.json#/definitions/catch",
"description": "Contains an array of objects, called Catchers, that define a fallback state. This state is executed if the state encounters runtime errors and its retry policy is exhausted or isn't defined."
},
"Items": {
"oneOf": [
{
"type": "array",
"errorMessage": "Incorrect type. Expected one of array, JSONata expression."
},
{
"$ref": "common.json#/definitions/jsonata"
}
],
"description": "An array or JSONata expression identifying where in the state input the array field is found."
},
"Output": {
"$ref": "common.json#/definitions/output"
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions src/json-schema/partial/parallel_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
"Catch": {
"$ref": "common.json#/definitions/catch",
"description": "Contains an array of objects, called Catchers, that define a fallback state. This state is executed if the state encounters runtime errors and its retry policy is exhausted or isn't defined."
},
"Arguments": {
"$ref": "common.json#/definitions/arguments"
},
"Output": {
"$ref": "common.json#/definitions/output"
}
},
"required": [
Expand Down
3 changes: 3 additions & 0 deletions src/json-schema/partial/pass_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
"Parameters": {
"$ref": "common.json#/definitions/parameters",
"description": "Used to pass information to the API actions of connected resources. The Parameters can use a mix of static JSON, JsonPath and intrinsic functions."
},
"Output": {
"$ref": "common.json#/definitions/output"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions src/json-schema/partial/succeed_state.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"enum": [
"Succeed"
]
},
"Output": {
"$ref": "common.json#/definitions/output"
}
}
}
Expand Down
Loading

0 comments on commit 332d6a4

Please sign in to comment.