{
    "$id": "http://asl-validator.cloud/task.json#",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "Type": {
            "type": "string",
            "enum": ["Task"]
        },
        "Next": {
            "type": "string"
        },
        "End": {
            "enum": [true]
        },
        "Comment": {
            "type": "string"
        },
        "OutputPath": {
            "$ref": "paths.json#/definitions/asl_path"
        },
        "InputPath": {
            "$ref": "paths.json#/definitions/asl_path"
        },
        "Resource": {
            "oneOf": [
                {
                    "type": "string",
                    "$comment": "defers validation to the registered formatter",
                    "format": "asl_arn"
                },
                {
                    "type": "string",
                    "$comment": "extension that allows for variable substitution before deployment",
                    "pattern": "^\\$\\{[^\\}]+\\}$"
                },
                {
                    "type": "object",
                    "$comment": "extensions that allows for variable substitution via cloud function",
                    "properties": {
                        "Ref": {
                            "type": "string"
                        }
                    },
                    "patternProperties": {
                        "^Fn::[A-Za-z\\d]+$": {
                            "type": ["object", "string", "array"]
                        }
                    }
                }
            ]
        },
        "ResultPath": {
            "$ref": "paths.json#/definitions/asl_result_path"
        },
        "Retry": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "ErrorEquals": {
                        "type": "array",
                        "items": {
                            "$ref": "errors.json#"
                        }
                    },
                    "IntervalSeconds": {
                        "type": "number",
                        "minimum": 0
                    },
                    "MaxAttempts": {
                        "type": "number",
                        "minimum": 0
                    },
                    "BackoffRate": {
                        "type": "number",
                        "minimum": 0
                    }
                },
                "required": ["ErrorEquals"]
            }
        },
        "Catch": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "ErrorEquals": {
                        "type": "array",
                        "items": {
                            "$ref": "errors.json#"
                        }
                    },
                    "Next": {
                        "type": "string"
                    },
                    "ResultPath": {
                        "$ref": "paths.json#/definitions/asl_result_path"
                    }
                },
                "required": ["ErrorEquals", "Next"]
            }
        },
        "TimeoutSeconds": {
            "type": "number",
            "minimum": 1
        },
        "TimeoutSecondsPath": {
            "$ref": "paths.json#/definitions/asl_ref_path"
        },
        "HeartbeatSeconds": {
            "type": "number",
            "minimum": 1
        },
        "HeartbeatSecondsPath": {
            "$ref": "paths.json#/definitions/asl_ref_path"
        },
        "ResultSelector": {
            "$ref": "paths.json#/definitions/asl_payload_template"
        },
        "Parameters": {
            "$ref": "paths.json#/definitions/asl_payload_template"
        },
        "Credentials": {
            "$ref": "paths.json#/definitions/asl_payload_template"
        },
        "Output": {
            "$ref": "jsonata.json#/definitions/output"
        },
        "Assign": {
            "$ref": "jsonata.json#/definitions/assign"
        },
        "Arguments": {
            "$ref": "jsonata.json#/definitions/arguments"
        },
        "QueryLanguage": {
            "$ref": "jsonata.json#/definitions/queryLanguage"
        }
    },
    "required": ["Type", "Resource"],
    "additionalProperties": false
}
