We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
State Machine types missing Map type
The [current list](https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/rules/resources/stepfunctions/StateMachine.py#L53) of valid types for state machine tasks is missing the recently-announced [`Map`](https://aws.amazon.com/blogs/aws/new-step-functions-support-for-dynamic-parallelism/) type

--- 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 2019 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.rules import CloudFormationLintRule
20 from cfnlint.rules 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         super(StateMachine, self).__init__()
35         self.resource_property_types.append('AWS::StepFunctions::StateMachine')
36 
37     def _check_state_json(self, def_json, state_name, path):
38         """Check State JSON Definition"""
39         matches = []
40 
41         # https://docs.aws.amazon.com/step-functions/latest/dg/amazon-states-language-common-fields.html
42         common_state_keys = [
43             'Next',
44             'End',
45             'Type',
46             'Comment',
47             'InputPath',
48             'OutputPath',
49         ]
50         common_state_required_keys = [
51             'Type',
52         ]
53         state_key_types = {
54             'Pass': ['Result', 'ResultPath', 'Parameters'],
55             'Task': ['Resource', 'ResultPath', 'Retry', 'Catch', 'TimeoutSeconds', 'Parameters', 'HeartbeatSeconds'],
56             'Choice': ['Choices', 'Default'],
57             'Wait': ['Seconds', 'Timestamp', 'SecondsPath', 'TimestampPath'],
58             'Succeed': [],
59             'Fail': ['Cause', 'Error'],
60             'Parallel': ['Branches', 'ResultPath', 'Retry', 'Catch']
61         }
62         state_required_types = {
63             'Pass': [],
64             'Task': ['Resource'],
65             'Choice': ['Choices'],
66             'Wait': [],
67             'Succeed': [],
68             'Fail': [],
69             'Parallel': ['Branches']
70         }
71 
72         for req_key in common_state_required_keys:
73             if req_key not in def_json:
74                 message = 'State Machine Definition required key (%s) for State (%s) is missing' % (req_key, state_name)
75                 matches.append(RuleMatch(path, message))
76                 return matches
77 
78         state_type = def_json.get('Type')
79 
80         if state_type in state_key_types:
81             for state_key, _ in def_json.items():
82                 if state_key not in common_state_keys + state_key_types.get(state_type, []):
83                     message = 'State Machine Definition key (%s) for State (%s) of Type (%s) is not valid' % (state_key, state_name, state_type)
84                     matches.append(RuleMatch(path, message))
85             for req_key in common_state_required_keys + state_required_types.get(state_type, []):
86                 if req_key not in def_json:
87                     message = 'State Machine Definition required key (%s) for State (%s) of Type (%s) is missing' % (req_key, state_name, state_type)
88                     matches.append(RuleMatch(path, message))
89                     return matches
90         else:
91             message = 'State Machine Definition Type (%s) is not valid' % (state_type)
92             matches.append(RuleMatch(path, message))
93 
94         return matches
95 
96     def _check_definition_json(self, def_json, path):
97         """Check JSON Definition"""
98         matches = []
99 
100         top_level_keys = [
101             'Comment',
102             'StartAt',
103             'TimeoutSeconds',
104             'Version',
105             'States'
106         ]
107         top_level_required_keys = [
108             'StartAt',
109             'States'
110         ]
111         for top_key, _ in def_json.items():
112             if top_key not in top_level_keys:
113                 message = 'State Machine Definition key (%s) is not valid' % top_key
114                 matches.append(RuleMatch(path, message))
115 
116         for req_key in top_level_required_keys:
117             if req_key not in def_json:
118                 message = 'State Machine Definition required key (%s) is missing' % req_key
119                 matches.append(RuleMatch(path, message))
120 
121         for state_name, state_value in def_json.get('States', {}).items():
122             matches.extend(self._check_state_json(state_value, state_name, path))
123         return matches
124 
125     def check_value(self, value, path, fail_on_loads=True):
126         """Check Definition Value"""
127         matches = []
128         try:
129             def_json = json.loads(value)
130         # pylint: disable=W0703
131         except Exception as err:
132             if fail_on_loads:
133                 message = 'State Machine Definition needs to be formatted as JSON. Error %s' % err
134                 matches.append(RuleMatch(path, message))
135                 return matches
136 
137             self.logger.debug('State Machine definition could not be parsed. Skipping')
138             return matches
139 
140         matches.extend(self._check_definition_json(def_json, path))
141         return matches
142 
143     def check_sub(self, value, path):
144         """Check Sub Object"""
145         matches = []
146         if isinstance(value, list):
147             matches.extend(self.check_value(value[0], path, False))
148         elif isinstance(value, six.string_types):
149             matches.extend(self.check_value(value, path, False))
150 
151         return matches
152 
153     def match_resource_properties(self, properties, _, path, cfn):
154         """Check CloudFormation Properties"""
155         matches = []
156 
157         matches.extend(
158             cfn.check_value(
159                 obj=properties, key='DefinitionString',
160                 path=path[:],
161                 check_value=self.check_value,
162                 check_sub=self.check_sub
163             ))
164 
165         return matches
166
```
--- 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
@@ -52,7 +52,10 @@
         ]
         state_key_types = {
             'Pass': ['Result', 'ResultPath', 'Parameters'],
-            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch', 'TimeoutSeconds', 'Parameters', 'HeartbeatSeconds'],
+            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch',
+                     'TimeoutSeconds', 'Parameters', 'HeartbeatSeconds'],
+            'Map': ['MaxConcurrency', 'Iterator', 'ItemsPath', 'ResultPath',
+                    'Retry', 'Catch'],
             'Choice': ['Choices', 'Default'],
             'Wait': ['Seconds', 'Timestamp', 'SecondsPath', 'TimestampPath'],
             'Succeed': [],
@@ -71,7 +74,8 @@
 
         for req_key in common_state_required_keys:
             if req_key not in def_json:
-                message = 'State Machine Definition required key (%s) for State (%s) is missing' % (req_key, state_name)
+                message = 'State Machine Definition required key (%s) for State (%s) is missing' % (
+                    req_key, state_name)
                 matches.append(RuleMatch(path, message))
                 return matches
 
@@ -80,11 +84,13 @@
         if state_type in state_key_types:
             for state_key, _ in def_json.items():
                 if state_key not in common_state_keys + state_key_types.get(state_type, []):
-                    message = 'State Machine Definition key (%s) for State (%s) of Type (%s) is not valid' % (state_key, state_name, state_type)
+                    message = 'State Machine Definition key (%s) for State (%s) of Type (%s) is not valid' % (
+                        state_key, state_name, state_type)
                     matches.append(RuleMatch(path, message))
             for req_key in common_state_required_keys + state_required_types.get(state_type, []):
                 if req_key not in def_json:
-                    message = 'State Machine Definition required key (%s) for State (%s) of Type (%s) is missing' % (req_key, state_name, state_type)
+                    message = 'State Machine Definition required key (%s) for State (%s) of Type (%s) is missing' % (
+                        req_key, state_name, state_type)
                     matches.append(RuleMatch(path, message))
                     return matches
         else:

{"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@@ -52,7 +52,10 @@\n         ]\n         state_key_types = {\n             'Pass': ['Result', 'ResultPath', 'Parameters'],\n-            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch', 'TimeoutSeconds', 'Parameters', 'HeartbeatSeconds'],\n+            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch',\n+                     'TimeoutSeconds', 'Parameters', 'HeartbeatSeconds'],\n+            'Map': ['MaxConcurrency', 'Iterator', 'ItemsPath', 'ResultPath',\n+                    'Retry', 'Catch'],\n             'Choice': ['Choices', 'Default'],\n             'Wait': ['Seconds', 'Timestamp', 'SecondsPath', 'TimestampPath'],\n             'Succeed': [],\n@@ -71,7 +74,8 @@\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+                message = 'State Machine Definition required key (%s) for State (%s) is missing' % (\n+                    req_key, state_name)\n                 matches.append(RuleMatch(path, message))\n                 return matches\n \n@@ -80,11 +84,13 @@\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+                    message = 'State Machine Definition key (%s) for State (%s) of Type (%s) is not valid' % (\n+                        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+                    message = 'State Machine Definition required key (%s) for State (%s) of Type (%s) is missing' % (\n+                        req_key, state_name, state_type)\n                     matches.append(RuleMatch(path, message))\n                     return matches\n         else:\n", "issue": "State Machine types missing Map type\nThe [current list](https://github.com/aws-cloudformation/cfn-python-lint/blob/master/src/cfnlint/rules/resources/stepfunctions/StateMachine.py#L53) of valid types for state machine tasks is missing the recently-announced [`Map`](https://aws.amazon.com/blogs/aws/new-step-functions-support-for-dynamic-parallelism/) type\n", "before_files": [{"content": "\"\"\"\n  Copyright 2019 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.rules import CloudFormationLintRule\nfrom cfnlint.rules 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        super(StateMachine, self).__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', 'Parameters'],\n            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch', 'TimeoutSeconds', 'Parameters', '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, fail_on_loads=True):\n        \"\"\"Check Definition Value\"\"\"\n        matches = []\n        try:\n            def_json = json.loads(value)\n        # pylint: disable=W0703\n        except Exception as err:\n            if fail_on_loads:\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            self.logger.debug('State Machine definition could not be parsed. Skipping')\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, False))\n        elif isinstance(value, six.string_types):\n            matches.extend(self.check_value(value, path, False))\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 2019 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.rules import CloudFormationLintRule\nfrom cfnlint.rules 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        super(StateMachine, self).__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', 'Parameters'],\n            'Task': ['Resource', 'ResultPath', 'Retry', 'Catch',\n                     'TimeoutSeconds', 'Parameters', 'HeartbeatSeconds'],\n            'Map': ['MaxConcurrency', 'Iterator', 'ItemsPath', 'ResultPath',\n                    'Retry', 'Catch'],\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' % (\n                    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' % (\n                        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' % (\n                        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, fail_on_loads=True):\n        \"\"\"Check Definition Value\"\"\"\n        matches = []\n        try:\n            def_json = json.loads(value)\n        # pylint: disable=W0703\n        except Exception as err:\n            if fail_on_loads:\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            self.logger.debug('State Machine definition could not be parsed. Skipping')\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, False))\n        elif isinstance(value, six.string_types):\n            matches.extend(self.check_value(value, path, False))\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"}]}