We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
W2030 - Number expected as String 
cfn-lint 0.19.0

W2030 - Number expected as String

The following warning has started to appear in the latest version:
W2030 You must specify a valid allowed value for NAME_OF_THE_PARAMETER

Template example:
```
  LogsRetentionLength:
    AllowedValues:
      - 1
      - 3
    Default: 1
    Description: The retention length of the logs.
    Type: Number
```

```
  LogGroup:
    Type: AWS::Logs::LogGroup
    Properties:
      RetentionInDays: !Ref LogsRetentionLength
      LogGroupName: '/name'
```

Error:
```
W2030 You must specify a valid allowed value for LogsRetentionLength (1).
Valid values are ['1', '3', '5', '7', '14', '30', '60', '90', '120', '150', '180', '365', '400', '545', '731', '1827', '3653']
W2030 You must specify a valid allowed value for LogsRetentionLength (3).
Valid values are ['1', '3', '5', '7', '14', '30', '60', '90', '120', '150', '180', '365', '400', '545', '731', '1827', '3653']
W2030 You must specify a valid Default value for LogsRetentionLength (1).
Valid values are ['1', '3', '5', '7', '14', '30', '60', '90', '120', '150', '180', '365', '400', '545', '731', '1827', '3653']
```

Changing the templates as follow fixes the issue but it's incorrect:

```
  LogsRetentionLength:
    AllowedValues:
      - '1'
      - '3'
    Default: '1'
    Description: The retention length of the logs.
    Type: Number
```

--- 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/parameters/AllowedValue.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 six
18 from cfnlint import CloudFormationLintRule
19 from cfnlint import RuleMatch
20 
21 from cfnlint.helpers import RESOURCE_SPECS
22 
23 
24 class AllowedValue(CloudFormationLintRule):
25     """Check if parameters have a valid value"""
26     id = 'W2030'
27     shortdesc = 'Check if parameters have a valid value'
28     description = 'Check if parameters have a valid value in case of an enumator. The Parameter''s allowed values is based on the usages in property (Ref)'
29     source_url = 'https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#allowedvalue'
30     tags = ['resources', 'property', 'allowed value']
31 
32     def initialize(self, cfn):
33         """Initialize the rule"""
34         for resource_type_spec in RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes'):
35             self.resource_property_types.append(resource_type_spec)
36         for property_type_spec in RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes'):
37             self.resource_sub_property_types.append(property_type_spec)
38 
39     def check_value_ref(self, value, **kwargs):
40         """Check Ref"""
41         matches = []
42 
43         allowed_value_specs = kwargs.get('value_specs', {}).get('AllowedValues', {})
44         cfn = kwargs.get('cfn')
45 
46         if allowed_value_specs:
47             if value in cfn.template.get('Parameters', {}):
48                 param = cfn.template.get('Parameters').get(value, {})
49                 parameter_values = param.get('AllowedValues')
50                 default_value = param.get('Default')
51                 parameter_type = param.get('Type')
52                 if isinstance(parameter_type, six.string_types):
53                     if ((not parameter_type.startswith('List<')) and
54                             (not parameter_type.startswith('AWS::SSM::Parameter::Value<')) and
55                             parameter_type not in ['CommaDelimitedList']):
56                         # Check Allowed Values
57                         if parameter_values:
58                             for index, allowed_value in enumerate(parameter_values):
59                                 if allowed_value not in allowed_value_specs:
60                                     param_path = ['Parameters', value, 'AllowedValues', index]
61                                     message = 'You must specify a valid allowed value for {0} ({1}).\nValid values are {2}'
62                                     matches.append(RuleMatch(param_path, message.format(value, allowed_value, allowed_value_specs)))
63                         elif default_value:
64                             # Check Default, only if no allowed Values are specified in the parameter (that's covered by E2015)
65                             if default_value not in allowed_value_specs:
66                                 param_path = ['Parameters', value, 'Default']
67                                 message = 'You must specify a valid Default value for {0} ({1}).\nValid values are {2}'
68                                 matches.append(RuleMatch(param_path, message.format(value, default_value, allowed_value_specs)))
69 
70         return matches
71 
72     def check(self, cfn, properties, value_specs, property_specs, path):
73         """Check itself"""
74         matches = list()
75         for p_value, p_path in properties.items_safe(path[:]):
76             for prop in p_value:
77                 if prop in value_specs:
78                     value = value_specs.get(prop).get('Value', {})
79                     if value:
80                         value_type = value.get('ValueType', '')
81                         property_type = property_specs.get('Properties').get(prop).get('Type')
82                         matches.extend(
83                             cfn.check_value(
84                                 p_value, prop, p_path,
85                                 check_ref=self.check_value_ref,
86                                 value_specs=RESOURCE_SPECS.get(cfn.regions[0]).get('ValueTypes').get(value_type, {}),
87                                 cfn=cfn, property_type=property_type, property_name=prop
88                             )
89                         )
90 
91         return matches
92 
93     def match_resource_sub_properties(self, properties, property_type, path, cfn):
94         """Match for sub properties"""
95         matches = list()
96 
97         specs = RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes').get(property_type, {}).get('Properties', {})
98         property_specs = RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes').get(property_type)
99         matches.extend(self.check(cfn, properties, specs, property_specs, path))
100 
101         return matches
102 
103     def match_resource_properties(self, properties, resource_type, path, cfn):
104         """Check CloudFormation Properties"""
105         matches = list()
106 
107         specs = RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes').get(resource_type, {}).get('Properties', {})
108         resource_specs = RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes').get(resource_type)
109         matches.extend(self.check(cfn, properties, specs, resource_specs, path))
110 
111         return matches
112
```
--- 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/parameters/AllowedValue.py b/src/cfnlint/rules/parameters/AllowedValue.py
--- a/src/cfnlint/rules/parameters/AllowedValue.py
+++ b/src/cfnlint/rules/parameters/AllowedValue.py
@@ -56,13 +56,13 @@
                         # Check Allowed Values
                         if parameter_values:
                             for index, allowed_value in enumerate(parameter_values):
-                                if allowed_value not in allowed_value_specs:
+                                if str(allowed_value) not in allowed_value_specs:
                                     param_path = ['Parameters', value, 'AllowedValues', index]
                                     message = 'You must specify a valid allowed value for {0} ({1}).\nValid values are {2}'
                                     matches.append(RuleMatch(param_path, message.format(value, allowed_value, allowed_value_specs)))
-                        elif default_value:
+                        if default_value:
                             # Check Default, only if no allowed Values are specified in the parameter (that's covered by E2015)
-                            if default_value not in allowed_value_specs:
+                            if str(default_value) not in allowed_value_specs:
                                 param_path = ['Parameters', value, 'Default']
                                 message = 'You must specify a valid Default value for {0} ({1}).\nValid values are {2}'
                                 matches.append(RuleMatch(param_path, message.format(value, default_value, allowed_value_specs)))

{"golden_diff": "diff --git a/src/cfnlint/rules/parameters/AllowedValue.py b/src/cfnlint/rules/parameters/AllowedValue.py\n--- a/src/cfnlint/rules/parameters/AllowedValue.py\n+++ b/src/cfnlint/rules/parameters/AllowedValue.py\n@@ -56,13 +56,13 @@\n                         # Check Allowed Values\n                         if parameter_values:\n                             for index, allowed_value in enumerate(parameter_values):\n-                                if allowed_value not in allowed_value_specs:\n+                                if str(allowed_value) not in allowed_value_specs:\n                                     param_path = ['Parameters', value, 'AllowedValues', index]\n                                     message = 'You must specify a valid allowed value for {0} ({1}).\\nValid values are {2}'\n                                     matches.append(RuleMatch(param_path, message.format(value, allowed_value, allowed_value_specs)))\n-                        elif default_value:\n+                        if default_value:\n                             # Check Default, only if no allowed Values are specified in the parameter (that's covered by E2015)\n-                            if default_value not in allowed_value_specs:\n+                            if str(default_value) not in allowed_value_specs:\n                                 param_path = ['Parameters', value, 'Default']\n                                 message = 'You must specify a valid Default value for {0} ({1}).\\nValid values are {2}'\n                                 matches.append(RuleMatch(param_path, message.format(value, default_value, allowed_value_specs)))\n", "issue": "W2030 - Number expected as String \ncfn-lint 0.19.0\r\n\r\nW2030 - Number expected as String\r\n\r\nThe following warning has started to appear in the latest version:\r\nW2030 You must specify a valid allowed value for NAME_OF_THE_PARAMETER\r\n\r\nTemplate example:\r\n```\r\n  LogsRetentionLength:\r\n    AllowedValues:\r\n      - 1\r\n      - 3\r\n    Default: 1\r\n    Description: The retention length of the logs.\r\n    Type: Number\r\n```\r\n\r\n```\r\n  LogGroup:\r\n    Type: AWS::Logs::LogGroup\r\n    Properties:\r\n      RetentionInDays: !Ref LogsRetentionLength\r\n      LogGroupName: '/name'\r\n```\r\n\r\nError:\r\n```\r\nW2030 You must specify a valid allowed value for LogsRetentionLength (1).\r\nValid values are ['1', '3', '5', '7', '14', '30', '60', '90', '120', '150', '180', '365', '400', '545', '731', '1827', '3653']\r\nW2030 You must specify a valid allowed value for LogsRetentionLength (3).\r\nValid values are ['1', '3', '5', '7', '14', '30', '60', '90', '120', '150', '180', '365', '400', '545', '731', '1827', '3653']\r\nW2030 You must specify a valid Default value for LogsRetentionLength (1).\r\nValid values are ['1', '3', '5', '7', '14', '30', '60', '90', '120', '150', '180', '365', '400', '545', '731', '1827', '3653']\r\n```\r\n\r\nChanging the templates as follow fixes the issue but it's incorrect:\r\n\r\n```\r\n  LogsRetentionLength:\r\n    AllowedValues:\r\n      - '1'\r\n      - '3'\r\n    Default: '1'\r\n    Description: The retention length of the logs.\r\n    Type: Number\r\n```\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 six\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\nfrom cfnlint.helpers import RESOURCE_SPECS\n\n\nclass AllowedValue(CloudFormationLintRule):\n    \"\"\"Check if parameters have a valid value\"\"\"\n    id = 'W2030'\n    shortdesc = 'Check if parameters have a valid value'\n    description = 'Check if parameters have a valid value in case of an enumator. The Parameter''s allowed values is based on the usages in property (Ref)'\n    source_url = 'https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#allowedvalue'\n    tags = ['resources', 'property', 'allowed value']\n\n    def initialize(self, cfn):\n        \"\"\"Initialize the rule\"\"\"\n        for resource_type_spec in RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes'):\n            self.resource_property_types.append(resource_type_spec)\n        for property_type_spec in RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes'):\n            self.resource_sub_property_types.append(property_type_spec)\n\n    def check_value_ref(self, value, **kwargs):\n        \"\"\"Check Ref\"\"\"\n        matches = []\n\n        allowed_value_specs = kwargs.get('value_specs', {}).get('AllowedValues', {})\n        cfn = kwargs.get('cfn')\n\n        if allowed_value_specs:\n            if value in cfn.template.get('Parameters', {}):\n                param = cfn.template.get('Parameters').get(value, {})\n                parameter_values = param.get('AllowedValues')\n                default_value = param.get('Default')\n                parameter_type = param.get('Type')\n                if isinstance(parameter_type, six.string_types):\n                    if ((not parameter_type.startswith('List<')) and\n                            (not parameter_type.startswith('AWS::SSM::Parameter::Value<')) and\n                            parameter_type not in ['CommaDelimitedList']):\n                        # Check Allowed Values\n                        if parameter_values:\n                            for index, allowed_value in enumerate(parameter_values):\n                                if allowed_value not in allowed_value_specs:\n                                    param_path = ['Parameters', value, 'AllowedValues', index]\n                                    message = 'You must specify a valid allowed value for {0} ({1}).\\nValid values are {2}'\n                                    matches.append(RuleMatch(param_path, message.format(value, allowed_value, allowed_value_specs)))\n                        elif default_value:\n                            # Check Default, only if no allowed Values are specified in the parameter (that's covered by E2015)\n                            if default_value not in allowed_value_specs:\n                                param_path = ['Parameters', value, 'Default']\n                                message = 'You must specify a valid Default value for {0} ({1}).\\nValid values are {2}'\n                                matches.append(RuleMatch(param_path, message.format(value, default_value, allowed_value_specs)))\n\n        return matches\n\n    def check(self, cfn, properties, value_specs, property_specs, path):\n        \"\"\"Check itself\"\"\"\n        matches = list()\n        for p_value, p_path in properties.items_safe(path[:]):\n            for prop in p_value:\n                if prop in value_specs:\n                    value = value_specs.get(prop).get('Value', {})\n                    if value:\n                        value_type = value.get('ValueType', '')\n                        property_type = property_specs.get('Properties').get(prop).get('Type')\n                        matches.extend(\n                            cfn.check_value(\n                                p_value, prop, p_path,\n                                check_ref=self.check_value_ref,\n                                value_specs=RESOURCE_SPECS.get(cfn.regions[0]).get('ValueTypes').get(value_type, {}),\n                                cfn=cfn, property_type=property_type, property_name=prop\n                            )\n                        )\n\n        return matches\n\n    def match_resource_sub_properties(self, properties, property_type, path, cfn):\n        \"\"\"Match for sub properties\"\"\"\n        matches = list()\n\n        specs = RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes').get(property_type, {}).get('Properties', {})\n        property_specs = RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes').get(property_type)\n        matches.extend(self.check(cfn, properties, specs, property_specs, path))\n\n        return matches\n\n    def match_resource_properties(self, properties, resource_type, path, cfn):\n        \"\"\"Check CloudFormation Properties\"\"\"\n        matches = list()\n\n        specs = RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes').get(resource_type, {}).get('Properties', {})\n        resource_specs = RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes').get(resource_type)\n        matches.extend(self.check(cfn, properties, specs, resource_specs, path))\n\n        return matches\n", "path": "src/cfnlint/rules/parameters/AllowedValue.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 six\nfrom cfnlint import CloudFormationLintRule\nfrom cfnlint import RuleMatch\n\nfrom cfnlint.helpers import RESOURCE_SPECS\n\n\nclass AllowedValue(CloudFormationLintRule):\n    \"\"\"Check if parameters have a valid value\"\"\"\n    id = 'W2030'\n    shortdesc = 'Check if parameters have a valid value'\n    description = 'Check if parameters have a valid value in case of an enumator. The Parameter''s allowed values is based on the usages in property (Ref)'\n    source_url = 'https://github.com/aws-cloudformation/cfn-python-lint/blob/master/docs/cfn-resource-specification.md#allowedvalue'\n    tags = ['resources', 'property', 'allowed value']\n\n    def initialize(self, cfn):\n        \"\"\"Initialize the rule\"\"\"\n        for resource_type_spec in RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes'):\n            self.resource_property_types.append(resource_type_spec)\n        for property_type_spec in RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes'):\n            self.resource_sub_property_types.append(property_type_spec)\n\n    def check_value_ref(self, value, **kwargs):\n        \"\"\"Check Ref\"\"\"\n        matches = []\n\n        allowed_value_specs = kwargs.get('value_specs', {}).get('AllowedValues', {})\n        cfn = kwargs.get('cfn')\n\n        if allowed_value_specs:\n            if value in cfn.template.get('Parameters', {}):\n                param = cfn.template.get('Parameters').get(value, {})\n                parameter_values = param.get('AllowedValues')\n                default_value = param.get('Default')\n                parameter_type = param.get('Type')\n                if isinstance(parameter_type, six.string_types):\n                    if ((not parameter_type.startswith('List<')) and\n                            (not parameter_type.startswith('AWS::SSM::Parameter::Value<')) and\n                            parameter_type not in ['CommaDelimitedList']):\n                        # Check Allowed Values\n                        if parameter_values:\n                            for index, allowed_value in enumerate(parameter_values):\n                                if str(allowed_value) not in allowed_value_specs:\n                                    param_path = ['Parameters', value, 'AllowedValues', index]\n                                    message = 'You must specify a valid allowed value for {0} ({1}).\\nValid values are {2}'\n                                    matches.append(RuleMatch(param_path, message.format(value, allowed_value, allowed_value_specs)))\n                        if default_value:\n                            # Check Default, only if no allowed Values are specified in the parameter (that's covered by E2015)\n                            if str(default_value) not in allowed_value_specs:\n                                param_path = ['Parameters', value, 'Default']\n                                message = 'You must specify a valid Default value for {0} ({1}).\\nValid values are {2}'\n                                matches.append(RuleMatch(param_path, message.format(value, default_value, allowed_value_specs)))\n\n        return matches\n\n    def check(self, cfn, properties, value_specs, property_specs, path):\n        \"\"\"Check itself\"\"\"\n        matches = list()\n        for p_value, p_path in properties.items_safe(path[:]):\n            for prop in p_value:\n                if prop in value_specs:\n                    value = value_specs.get(prop).get('Value', {})\n                    if value:\n                        value_type = value.get('ValueType', '')\n                        property_type = property_specs.get('Properties').get(prop).get('Type')\n                        matches.extend(\n                            cfn.check_value(\n                                p_value, prop, p_path,\n                                check_ref=self.check_value_ref,\n                                value_specs=RESOURCE_SPECS.get(cfn.regions[0]).get('ValueTypes').get(value_type, {}),\n                                cfn=cfn, property_type=property_type, property_name=prop\n                            )\n                        )\n\n        return matches\n\n    def match_resource_sub_properties(self, properties, property_type, path, cfn):\n        \"\"\"Match for sub properties\"\"\"\n        matches = list()\n\n        specs = RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes').get(property_type, {}).get('Properties', {})\n        property_specs = RESOURCE_SPECS.get(cfn.regions[0]).get('PropertyTypes').get(property_type)\n        matches.extend(self.check(cfn, properties, specs, property_specs, path))\n\n        return matches\n\n    def match_resource_properties(self, properties, resource_type, path, cfn):\n        \"\"\"Check CloudFormation Properties\"\"\"\n        matches = list()\n\n        specs = RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes').get(resource_type, {}).get('Properties', {})\n        resource_specs = RESOURCE_SPECS.get(cfn.regions[0]).get('ResourceTypes').get(resource_type)\n        matches.extend(self.check(cfn, properties, specs, resource_specs, path))\n\n        return matches\n", "path": "src/cfnlint/rules/parameters/AllowedValue.py"}]}