We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
E2532 State Machine Definition key (OutputPath) for State of Type (Task) is not valid
cfn-lint version: 0.7.3

I am getting the above error when trying to lint a CF template containing a step function. The step function code is working fine in AWS console though. 

"CreatePublishedRequest": {
                  "Type": "Task",
                  "Resource": "{$createPublishedRequest}",
                  "ResultPath":"$.publishedRequest",
                  "OutputPath":"$.publishedRequest",
                  "Next": "PutRequest"
                },
"PutRequest": {
                  "Type": "Task",
                  "Resource": "{$updateKey}",
                  "ResultPath":"$.response",
                  "Next": "Take Down Mock"
                },

When trying to change to using InputPath in "PutRequest" instead I am getting the same error, but for InputPath instead. 


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `src/cfnlint/rules/resources/stepfunctions/StateMachine.py`
Content:
```
1 """
2   Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 
4   Permission is hereby granted, free of charge, to any person obtaining a copy of this
5   software and associated documentation files (the "Software"), to deal in the Software
6   without restriction, including without limitation the rights to use, copy, modify,
7   merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
8   permit persons to whom the Software is furnished to do so.
9 
10   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
11   INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
12   PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
13   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
14   OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
15   SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
16 """
17 import json
18 import six
19 from cfnlint import CloudFormationLintRule
20 from cfnlint import RuleMatch
21 
22 
23 class StateMachine(CloudFormationLintRule):
24     """Check State Machine Definition"""
25     id = 'E2532'
26     shortdesc = 'Check State Machine Definition for proper syntax'
27     description = 'Check the State Machine String Definition to make sure its JSON. ' \
28                   'Validate basic syntax of the file to determine validity.'
29     source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html'
30     tags = ['resources', 'stepfunctions']
31 
32     def __init__(self):
33         """Init"""
34         self.resource_property_types.append('AWS::StepFunctions::StateMachine')
35 
36     def _check_state_json(self, def_json, state_name, path):
37         """Check State JSON Definition"""
38         matches = []
39 
40         common_state_keys = [
41             'Next',
42             'End',
43             'Type',
44             'Comment',
45             'Input',
46             'Ouptut',
47         ]
48         common_state_required_keys = [
49             'Type',
50         ]
51         state_key_types = {
52             'Pass': ['Result', 'ResultPath'],
53             'Task': ['Resource', 'ResultPath', 'Retry', 'Catch', 'TimeoutSeconds', 'HeartbeatSeconds'],
54             'Choice': ['Choices', 'Default'],
55             'Wait': ['Seconds', 'Timestamp', 'SecondsPath', 'TimestampPath'],
56             'Succeed': [],
57             'Fail': ['Cause', 'Error'],
58             'Parallel': ['Branches', 'ResultPath', 'Retry', 'Catch']
59         }
60         state_required_types = {
61             'Pass': [],
62             'Task': ['Resource'],
63             'Choice': ['Choices'],
64             'Wait': [],
65             'Succeed': [],
66             'Fail': [],
67             'Parallel': ['Branches']
68         }
69 
70         for req_key in common_state_required_keys:
71             if req_key not in def_json:
72                 message = 'State Machine Definition required key (%s) for State (%s) is missing' % (req_key, state_name)
73                 matches.append(RuleMatch(path, message))
74                 return matches
75 
76         state_type = def_json.get('Type')
77 
78         if state_type in state_key_types:
79             for state_key, _ in def_json.items():
80                 if state_key not in common_state_keys + state_key_types.get(state_type, []):
81                     message = 'State Machine Definition key (%s) for State (%s) of Type (%s) is not valid' % (state_key, state_name, state_type)
82                     matches.append(RuleMatch(path, message))
83             for req_key in common_state_required_keys + state_required_types.get(state_type, []):
84                 if req_key not in def_json:
85                     message = 'State Machine Definition required key (%s) for State (%s) of Type (%s) is missing' % (req_key, state_name, state_type)
86                     matches.append(RuleMatch(path, message))
87                     return matches
88         else:
89             message = 'State Machine Definition Type (%s) is not valid' % (state_type)
90             matches.append(RuleMatch(path, message))
91 
92         return matches
93 
94     def _check_definition_json(self, def_json, path):
95         """Check JSON Definition"""
96         matches = []
97 
98         top_level_keys = [
99             'Comment',
100             'StartAt',
101             'TimeoutSeconds',
102             'Version',
103             'States'
104         ]
105         top_level_required_keys = [
106             'StartAt',
107             'States'
108         ]
109         for top_key, _ in def_json.items():
110             if top_key not in top_level_keys:
111                 message = 'State Machine Definition key (%s) is not valid' % top_key
112                 matches.append(RuleMatch(path, message))
113 
114         for req_key in top_level_required_keys:
115             if req_key not in def_json:
116                 message = 'State Machine Definition required key (%s) is missing' % req_key
117                 matches.append(RuleMatch(path, message))
118 
119         for state_name, state_value in def_json.get('States', {}).items():
120             matches.extend(self._check_state_json(state_value, state_name, path))
121         return matches
122 
123     def check_value(self, value, path):
124         """Check Definition Value"""
125         matches = []
126         try:
127             def_json = json.loads(value)
128         # pylint: disable=W0703
129         except Exception as err:
130             message = 'State Machine Definition needs to be formatted as JSON. Error %s' % err
131             matches.append(RuleMatch(path, message))
132             return matches
133 
134         matches.extend(self._check_definition_json(def_json, path))
135         return matches
136 
137     def check_sub(self, value, path):
138         """Check Sub Object"""
139         matches = []
140         if isinstance(value, list):
141             matches.extend(self.check_value(value[0], path))
142         elif isinstance(value, six.string_types):
143             matches.extend(self.check_value(value, path))
144 
145         return matches
146 
147     def match_resource_properties(self, properties, _, path, cfn):
148         """Check CloudFormation Properties"""
149         matches = []
150 
151         matches.extend(
152             cfn.check_value(
153                 obj=properties, key='DefinitionString',
154                 path=path[:],
155                 check_value=self.check_value,
156                 check_sub=self.check_sub
157             ))
158 
159         return matches
160
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/src/cfnlint/rules/resources/stepfunctions/StateMachine.py b/src/cfnlint/rules/resources/stepfunctions/StateMachine.py
--- a/src/cfnlint/rules/resources/stepfunctions/StateMachine.py
+++ b/src/cfnlint/rules/resources/stepfunctions/StateMachine.py
@@ -37,13 +37,14 @@
         """Check State JSON Definition"""
         matches = []
 
+        # https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-common-fields.html
         common_state_keys = [
             'Next',
             'End',
             'Type',
             'Comment',
-            'Input',
-            'Ouptut',
+            'InputPath',
+            'OutputPath',
         ]
         common_state_required_keys = [
             'Type',

{"golden_diff": "diff --git a/src/cfnlint/rules/resources/stepfunctions/StateMachine.py b/src/cfnlint/rules/resources/stepfunctions/StateMachine.py\n--- a/src/cfnlint/rules/resources/stepfunctions/StateMachine.py\n+++ b/src/cfnlint/rules/resources/stepfunctions/StateMachine.py\n@@ -37,13 +37,14 @@\n         \"\"\"Check State JSON Definition\"\"\"\n         matches = []\n \n+        # https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-common-fields.html\n         common_state_keys = [\n             'Next',\n             'End',\n             'Type',\n             'Comment',\n-            'Input',\n-            'Ouptut',\n+            'InputPath',\n+            'OutputPath',\n         ]\n         common_state_required_keys = [\n             'Type',\n", "issue": "E2532 State Machine Definition key (OutputPath) for State of Type (Task) is not valid\ncfn-lint version: 0.7.3\r\n\r\nI am getting the above error when trying to lint a CF template containing a step function. The step function code is working fine in AWS console though. \r\n\r\n\"CreatePublishedRequest\": {\r\n                  \"Type\": \"Task\",\r\n                  \"Resource\": \"{$createPublishedRequest}\",\r\n                  \"ResultPath\":\"$.publishedRequest\",\r\n                  \"OutputPath\":\"$.publishedRequest\",\r\n                  \"Next\": \"PutRequest\"\r\n                },\r\n\"PutRequest\": {\r\n                  \"Type\": \"Task\",\r\n                  \"Resource\": \"{$updateKey}\",\r\n                  \"ResultPath\":\"$.response\",\r\n                  \"Next\": \"Take Down Mock\"\r\n                },\r\n\r\nWhen trying to change to using InputPath in \"PutRequest\" instead I am getting the same error, but for InputPath instead. \r\n\n", "before_files": [{"content": "\"\"\"\n  Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this\n  software and associated documentation files (the \"Software\"), to deal in the Software\n  without restriction, including without limitation the rights to use, copy, modify,\n  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\nimport json\nimport six\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\n\nclass StateMachine(CloudFormationLintRule):\n    \"\"\"Check State Machine Definition\"\"\"\n    id = 'E2532'\n    shortdesc = 'Check State Machine Definition for proper syntax'\n    description = 'Check the State Machine String Definition to make sure its JSON. ' \\\n                  'Validate basic syntax of the file to determine validity.'\n    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html'\n    tags = ['resources', 'stepfunctions']\n\n    def __init__(self):\n        \"\"\"Init\"\"\"\n        self.resource_property_types.append('AWS::StepFunctions::StateMachine')\n\n    def _check_state_json(self, def_json, state_name, path):\n        \"\"\"Check State JSON Definition\"\"\"\n        matches = []\n\n        common_state_keys = [\n            'Next',\n            'End',\n            'Type',\n            'Comment',\n            'Input',\n            'Ouptut',\n        ]\n        common_state_required_keys = [\n            'Type',\n        ]\n        state_key_types = {\n            'Pass': ['Result', 'ResultPath'],\n            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch', 'TimeoutSeconds', 'HeartbeatSeconds'],\n            'Choice': ['Choices', 'Default'],\n            'Wait': ['Seconds', 'Timestamp', 'SecondsPath', 'TimestampPath'],\n            'Succeed': [],\n            'Fail': ['Cause', 'Error'],\n            'Parallel': ['Branches', 'ResultPath', 'Retry', 'Catch']\n        }\n        state_required_types = {\n            'Pass': [],\n            'Task': ['Resource'],\n            'Choice': ['Choices'],\n            'Wait': [],\n            'Succeed': [],\n            'Fail': [],\n            'Parallel': ['Branches']\n        }\n\n        for req_key in common_state_required_keys:\n            if req_key not in def_json:\n                message = 'State Machine Definition required key (%s) for State (%s) is missing' % (req_key, state_name)\n                matches.append(RuleMatch(path, message))\n                return matches\n\n        state_type = def_json.get('Type')\n\n        if state_type in state_key_types:\n            for state_key, _ in def_json.items():\n                if state_key not in common_state_keys + state_key_types.get(state_type, []):\n                    message = 'State Machine Definition key (%s) for State (%s) of Type (%s) is not valid' % (state_key, state_name, state_type)\n                    matches.append(RuleMatch(path, message))\n            for req_key in common_state_required_keys + state_required_types.get(state_type, []):\n                if req_key not in def_json:\n                    message = 'State Machine Definition required key (%s) for State (%s) of Type (%s) is missing' % (req_key, state_name, state_type)\n                    matches.append(RuleMatch(path, message))\n                    return matches\n        else:\n            message = 'State Machine Definition Type (%s) is not valid' % (state_type)\n            matches.append(RuleMatch(path, message))\n\n        return matches\n\n    def _check_definition_json(self, def_json, path):\n        \"\"\"Check JSON Definition\"\"\"\n        matches = []\n\n        top_level_keys = [\n            'Comment',\n            'StartAt',\n            'TimeoutSeconds',\n            'Version',\n            'States'\n        ]\n        top_level_required_keys = [\n            'StartAt',\n            'States'\n        ]\n        for top_key, _ in def_json.items():\n            if top_key not in top_level_keys:\n                message = 'State Machine Definition key (%s) is not valid' % top_key\n                matches.append(RuleMatch(path, message))\n\n        for req_key in top_level_required_keys:\n            if req_key not in def_json:\n                message = 'State Machine Definition required key (%s) is missing' % req_key\n                matches.append(RuleMatch(path, message))\n\n        for state_name, state_value in def_json.get('States', {}).items():\n            matches.extend(self._check_state_json(state_value, state_name, path))\n        return matches\n\n    def check_value(self, value, path):\n        \"\"\"Check Definition Value\"\"\"\n        matches = []\n        try:\n            def_json = json.loads(value)\n        # pylint: disable=W0703\n        except Exception as err:\n            message = 'State Machine Definition needs to be formatted as JSON. Error %s' % err\n            matches.append(RuleMatch(path, message))\n            return matches\n\n        matches.extend(self._check_definition_json(def_json, path))\n        return matches\n\n    def check_sub(self, value, path):\n        \"\"\"Check Sub Object\"\"\"\n        matches = []\n        if isinstance(value, list):\n            matches.extend(self.check_value(value[0], path))\n        elif isinstance(value, six.string_types):\n            matches.extend(self.check_value(value, path))\n\n        return matches\n\n    def match_resource_properties(self, properties, _, path, cfn):\n        \"\"\"Check CloudFormation Properties\"\"\"\n        matches = []\n\n        matches.extend(\n            cfn.check_value(\n                obj=properties, key='DefinitionString',\n                path=path[:],\n                check_value=self.check_value,\n                check_sub=self.check_sub\n            ))\n\n        return matches\n", "path": "src/cfnlint/rules/resources/stepfunctions/StateMachine.py"}], "after_files": [{"content": "\"\"\"\n  Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n\n  Permission is hereby granted, free of charge, to any person obtaining a copy of this\n  software and associated documentation files (the \"Software\"), to deal in the Software\n  without restriction, including without limitation the rights to use, copy, modify,\n  merge, publish, distribute, sublicense, and/or sell copies of the Software, and to\n  permit persons to whom the Software is furnished to do so.\n\n  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,\n  INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A\n  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT\n  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\n  OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\n  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\"\"\"\nimport json\nimport six\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\n\nclass StateMachine(CloudFormationLintRule):\n    \"\"\"Check State Machine Definition\"\"\"\n    id = 'E2532'\n    shortdesc = 'Check State Machine Definition for proper syntax'\n    description = 'Check the State Machine String Definition to make sure its JSON. ' \\\n                  'Validate basic syntax of the file to determine validity.'\n    source_url = 'https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-stepfunctions-statemachine.html'\n    tags = ['resources', 'stepfunctions']\n\n    def __init__(self):\n        \"\"\"Init\"\"\"\n        self.resource_property_types.append('AWS::StepFunctions::StateMachine')\n\n    def _check_state_json(self, def_json, state_name, path):\n        \"\"\"Check State JSON Definition\"\"\"\n        matches = []\n\n        # https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-common-fields.html\n        common_state_keys = [\n            'Next',\n            'End',\n            'Type',\n            'Comment',\n            'InputPath',\n            'OutputPath',\n        ]\n        common_state_required_keys = [\n            'Type',\n        ]\n        state_key_types = {\n            'Pass': ['Result', 'ResultPath'],\n            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch', 'TimeoutSeconds', 'HeartbeatSeconds'],\n            'Choice': ['Choices', 'Default'],\n            'Wait': ['Seconds', 'Timestamp', 'SecondsPath', 'TimestampPath'],\n            'Succeed': [],\n            'Fail': ['Cause', 'Error'],\n            'Parallel': ['Branches', 'ResultPath', 'Retry', 'Catch']\n        }\n        state_required_types = {\n            'Pass': [],\n            'Task': ['Resource'],\n            'Choice': ['Choices'],\n            'Wait': [],\n            'Succeed': [],\n            'Fail': [],\n            'Parallel': ['Branches']\n        }\n\n        for req_key in common_state_required_keys:\n            if req_key not in def_json:\n                message = 'State Machine Definition required key (%s) for State (%s) is missing' % (req_key, state_name)\n                matches.append(RuleMatch(path, message))\n                return matches\n\n        state_type = def_json.get('Type')\n\n        if state_type in state_key_types:\n            for state_key, _ in def_json.items():\n                if state_key not in common_state_keys + state_key_types.get(state_type, []):\n                    message = 'State Machine Definition key (%s) for State (%s) of Type (%s) is not valid' % (state_key, state_name, state_type)\n                    matches.append(RuleMatch(path, message))\n            for req_key in common_state_required_keys + state_required_types.get(state_type, []):\n                if req_key not in def_json:\n                    message = 'State Machine Definition required key (%s) for State (%s) of Type (%s) is missing' % (req_key, state_name, state_type)\n                    matches.append(RuleMatch(path, message))\n                    return matches\n        else:\n            message = 'State Machine Definition Type (%s) is not valid' % (state_type)\n            matches.append(RuleMatch(path, message))\n\n        return matches\n\n    def _check_definition_json(self, def_json, path):\n        \"\"\"Check JSON Definition\"\"\"\n        matches = []\n\n        top_level_keys = [\n            'Comment',\n            'StartAt',\n            'TimeoutSeconds',\n            'Version',\n            'States'\n        ]\n        top_level_required_keys = [\n            'StartAt',\n            'States'\n        ]\n        for top_key, _ in def_json.items():\n            if top_key not in top_level_keys:\n                message = 'State Machine Definition key (%s) is not valid' % top_key\n                matches.append(RuleMatch(path, message))\n\n        for req_key in top_level_required_keys:\n            if req_key not in def_json:\n                message = 'State Machine Definition required key (%s) is missing' % req_key\n                matches.append(RuleMatch(path, message))\n\n        for state_name, state_value in def_json.get('States', {}).items():\n            matches.extend(self._check_state_json(state_value, state_name, path))\n        return matches\n\n    def check_value(self, value, path):\n        \"\"\"Check Definition Value\"\"\"\n        matches = []\n        try:\n            def_json = json.loads(value)\n        # pylint: disable=W0703\n        except Exception as err:\n            message = 'State Machine Definition needs to be formatted as JSON. Error %s' % err\n            matches.append(RuleMatch(path, message))\n            return matches\n\n        matches.extend(self._check_definition_json(def_json, path))\n        return matches\n\n    def check_sub(self, value, path):\n        \"\"\"Check Sub Object\"\"\"\n        matches = []\n        if isinstance(value, list):\n            matches.extend(self.check_value(value[0], path))\n        elif isinstance(value, six.string_types):\n            matches.extend(self.check_value(value, path))\n\n        return matches\n\n    def match_resource_properties(self, properties, _, path, cfn):\n        \"\"\"Check CloudFormation Properties\"\"\"\n        matches = []\n\n        matches.extend(\n            cfn.check_value(\n                obj=properties, key='DefinitionString',\n                path=path[:],\n                check_value=self.check_value,\n                check_sub=self.check_sub\n            ))\n\n        return matches\n", "path": "src/cfnlint/rules/resources/stepfunctions/StateMachine.py"}]}