We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Fix enum_value handling for inputs
A clean and easy solution for fixing the broken enum_value handling for inputs

Closes https://github.com/strawberry-graphql/strawberry/issues/2305
Closes https://github.com/strawberry-graphql/strawberry/pull/2203
Closes https://github.com/strawberry-graphql/strawberry/pull/2185
Closes https://github.com/strawberry-graphql/strawberry/pull/2306

@patrick91 sorry for stealing your release file and tests

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `strawberry/enum.py`
Content:
```
1 import dataclasses
2 from enum import EnumMeta
3 from typing import (
4     Any,
5     Callable,
6     Iterable,
7     List,
8     Mapping,
9     Optional,
10     TypeVar,
11     Union,
12     overload,
13 )
14 
15 from strawberry.type import StrawberryType
16 
17 from .exceptions import ObjectIsNotAnEnumError
18 
19 
20 @dataclasses.dataclass
21 class EnumValue:
22     name: str
23     value: Any
24     deprecation_reason: Optional[str] = None
25     directives: Iterable[object] = ()
26     description: Optional[str] = None
27 
28 
29 @dataclasses.dataclass
30 class EnumDefinition(StrawberryType):
31     wrapped_cls: EnumMeta
32     name: str
33     values: List[EnumValue]
34     description: Optional[str]
35     directives: Iterable[object] = ()
36 
37     def __hash__(self) -> int:
38         # TODO: Is this enough for unique-ness?
39         return hash(self.name)
40 
41     def copy_with(
42         self, type_var_map: Mapping[TypeVar, Union[StrawberryType, type]]
43     ) -> Union[StrawberryType, type]:
44         return super().copy_with(type_var_map)
45 
46     @property
47     def is_generic(self) -> bool:
48         return False
49 
50 
51 # TODO: remove duplication of EnumValueDefinition and EnumValue
52 @dataclasses.dataclass
53 class EnumValueDefinition:
54     value: Any
55     deprecation_reason: Optional[str] = None
56     directives: Iterable[object] = ()
57     description: Optional[str] = None
58 
59 
60 def enum_value(
61     value: Any,
62     deprecation_reason: Optional[str] = None,
63     directives: Iterable[object] = (),
64     description: Optional[str] = None,
65 ) -> EnumValueDefinition:
66     return EnumValueDefinition(
67         value=value,
68         deprecation_reason=deprecation_reason,
69         directives=directives,
70         description=description,
71     )
72 
73 
74 EnumType = TypeVar("EnumType", bound=EnumMeta)
75 
76 
77 def _process_enum(
78     cls: EnumType,
79     name: Optional[str] = None,
80     description: Optional[str] = None,
81     directives: Iterable[object] = (),
82 ) -> EnumType:
83     if not isinstance(cls, EnumMeta):
84         raise ObjectIsNotAnEnumError(cls)
85 
86     if not name:
87         name = cls.__name__
88 
89     description = description
90 
91     values = []
92     for item in cls:  # type: ignore
93         item_value = item.value
94         item_name = item.name
95         deprecation_reason = None
96         item_directives: Iterable[object] = ()
97         enum_value_description = None
98 
99         if isinstance(item_value, EnumValueDefinition):
100             item_directives = item_value.directives
101             enum_value_description = item_value.description
102             deprecation_reason = item_value.deprecation_reason
103             item_value = item_value.value
104 
105         value = EnumValue(
106             item_name,
107             item_value,
108             deprecation_reason=deprecation_reason,
109             directives=item_directives,
110             description=enum_value_description,
111         )
112         values.append(value)
113 
114     cls._enum_definition = EnumDefinition(  # type: ignore
115         wrapped_cls=cls,
116         name=name,
117         values=values,
118         description=description,
119         directives=directives,
120     )
121 
122     return cls
123 
124 
125 @overload
126 def enum(
127     _cls: EnumType,
128     *,
129     name: Optional[str] = None,
130     description: Optional[str] = None,
131     directives: Iterable[object] = ()
132 ) -> EnumType:
133     ...
134 
135 
136 @overload
137 def enum(
138     _cls: None = None,
139     *,
140     name: Optional[str] = None,
141     description: Optional[str] = None,
142     directives: Iterable[object] = ()
143 ) -> Callable[[EnumType], EnumType]:
144     ...
145 
146 
147 def enum(
148     _cls: Optional[EnumType] = None,
149     *,
150     name: Optional[str] = None,
151     description: Optional[str] = None,
152     directives: Iterable[object] = ()
153 ) -> Union[EnumType, Callable[[EnumType], EnumType]]:
154     """Registers the enum in the GraphQL type system.
155 
156     If name is passed, the name of the GraphQL type will be
157     the value passed of name instead of the Enum class name.
158     """
159 
160     def wrap(cls: EnumType) -> EnumType:
161         return _process_enum(cls, name, description, directives=directives)
162 
163     if not _cls:
164         return wrap
165 
166     return wrap(_cls)
167
```
--- 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/strawberry/enum.py b/strawberry/enum.py
--- a/strawberry/enum.py
+++ b/strawberry/enum.py
@@ -102,6 +102,11 @@
             deprecation_reason = item_value.deprecation_reason
             item_value = item_value.value
 
+            # update _value2member_map_ so that doing `MyEnum.MY_VALUE` and
+            # `MyEnum['MY_VALUE']` both work
+            cls._value2member_map_[item_value] = item
+            cls._member_map_[item_name]._value_ = item_value
+
         value = EnumValue(
             item_name,
             item_value,

{"golden_diff": "diff --git a/strawberry/enum.py b/strawberry/enum.py\n--- a/strawberry/enum.py\n+++ b/strawberry/enum.py\n@@ -102,6 +102,11 @@\n             deprecation_reason = item_value.deprecation_reason\n             item_value = item_value.value\n \n+            # update _value2member_map_ so that doing `MyEnum.MY_VALUE` and\n+            # `MyEnum['MY_VALUE']` both work\n+            cls._value2member_map_[item_value] = item\n+            cls._member_map_[item_name]._value_ = item_value\n+\n         value = EnumValue(\n             item_name,\n             item_value,\n", "issue": "Fix enum_value handling for inputs\nA clean and easy solution for fixing the broken enum_value handling for inputs\r\n\r\nCloses https://github.com/strawberry-graphql/strawberry/issues/2305\r\nCloses https://github.com/strawberry-graphql/strawberry/pull/2203\r\nCloses https://github.com/strawberry-graphql/strawberry/pull/2185\r\nCloses https://github.com/strawberry-graphql/strawberry/pull/2306\r\n\r\n@patrick91 sorry for stealing your release file and tests\n", "before_files": [{"content": "import dataclasses\nfrom enum import EnumMeta\nfrom typing import (\n    Any,\n    Callable,\n    Iterable,\n    List,\n    Mapping,\n    Optional,\n    TypeVar,\n    Union,\n    overload,\n)\n\nfrom strawberry.type import StrawberryType\n\nfrom .exceptions import ObjectIsNotAnEnumError\n\n\n@dataclasses.dataclass\nclass EnumValue:\n    name: str\n    value: Any\n    deprecation_reason: Optional[str] = None\n    directives: Iterable[object] = ()\n    description: Optional[str] = None\n\n\n@dataclasses.dataclass\nclass EnumDefinition(StrawberryType):\n    wrapped_cls: EnumMeta\n    name: str\n    values: List[EnumValue]\n    description: Optional[str]\n    directives: Iterable[object] = ()\n\n    def __hash__(self) -> int:\n        # TODO: Is this enough for unique-ness?\n        return hash(self.name)\n\n    def copy_with(\n        self, type_var_map: Mapping[TypeVar, Union[StrawberryType, type]]\n    ) -> Union[StrawberryType, type]:\n        return super().copy_with(type_var_map)\n\n    @property\n    def is_generic(self) -> bool:\n        return False\n\n\n# TODO: remove duplication of EnumValueDefinition and EnumValue\n@dataclasses.dataclass\nclass EnumValueDefinition:\n    value: Any\n    deprecation_reason: Optional[str] = None\n    directives: Iterable[object] = ()\n    description: Optional[str] = None\n\n\ndef enum_value(\n    value: Any,\n    deprecation_reason: Optional[str] = None,\n    directives: Iterable[object] = (),\n    description: Optional[str] = None,\n) -> EnumValueDefinition:\n    return EnumValueDefinition(\n        value=value,\n        deprecation_reason=deprecation_reason,\n        directives=directives,\n        description=description,\n    )\n\n\nEnumType = TypeVar(\"EnumType\", bound=EnumMeta)\n\n\ndef _process_enum(\n    cls: EnumType,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = (),\n) -> EnumType:\n    if not isinstance(cls, EnumMeta):\n        raise ObjectIsNotAnEnumError(cls)\n\n    if not name:\n        name = cls.__name__\n\n    description = description\n\n    values = []\n    for item in cls:  # type: ignore\n        item_value = item.value\n        item_name = item.name\n        deprecation_reason = None\n        item_directives: Iterable[object] = ()\n        enum_value_description = None\n\n        if isinstance(item_value, EnumValueDefinition):\n            item_directives = item_value.directives\n            enum_value_description = item_value.description\n            deprecation_reason = item_value.deprecation_reason\n            item_value = item_value.value\n\n        value = EnumValue(\n            item_name,\n            item_value,\n            deprecation_reason=deprecation_reason,\n            directives=item_directives,\n            description=enum_value_description,\n        )\n        values.append(value)\n\n    cls._enum_definition = EnumDefinition(  # type: ignore\n        wrapped_cls=cls,\n        name=name,\n        values=values,\n        description=description,\n        directives=directives,\n    )\n\n    return cls\n\n\n@overload\ndef enum(\n    _cls: EnumType,\n    *,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = ()\n) -> EnumType:\n    ...\n\n\n@overload\ndef enum(\n    _cls: None = None,\n    *,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = ()\n) -> Callable[[EnumType], EnumType]:\n    ...\n\n\ndef enum(\n    _cls: Optional[EnumType] = None,\n    *,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = ()\n) -> Union[EnumType, Callable[[EnumType], EnumType]]:\n    \"\"\"Registers the enum in the GraphQL type system.\n\n    If name is passed, the name of the GraphQL type will be\n    the value passed of name instead of the Enum class name.\n    \"\"\"\n\n    def wrap(cls: EnumType) -> EnumType:\n        return _process_enum(cls, name, description, directives=directives)\n\n    if not _cls:\n        return wrap\n\n    return wrap(_cls)\n", "path": "strawberry/enum.py"}], "after_files": [{"content": "import dataclasses\nfrom enum import EnumMeta\nfrom typing import (\n    Any,\n    Callable,\n    Iterable,\n    List,\n    Mapping,\n    Optional,\n    TypeVar,\n    Union,\n    overload,\n)\n\nfrom strawberry.type import StrawberryType\n\nfrom .exceptions import ObjectIsNotAnEnumError\n\n\n@dataclasses.dataclass\nclass EnumValue:\n    name: str\n    value: Any\n    deprecation_reason: Optional[str] = None\n    directives: Iterable[object] = ()\n    description: Optional[str] = None\n\n\n@dataclasses.dataclass\nclass EnumDefinition(StrawberryType):\n    wrapped_cls: EnumMeta\n    name: str\n    values: List[EnumValue]\n    description: Optional[str]\n    directives: Iterable[object] = ()\n\n    def __hash__(self) -> int:\n        # TODO: Is this enough for unique-ness?\n        return hash(self.name)\n\n    def copy_with(\n        self, type_var_map: Mapping[TypeVar, Union[StrawberryType, type]]\n    ) -> Union[StrawberryType, type]:\n        return super().copy_with(type_var_map)\n\n    @property\n    def is_generic(self) -> bool:\n        return False\n\n\n# TODO: remove duplication of EnumValueDefinition and EnumValue\n@dataclasses.dataclass\nclass EnumValueDefinition:\n    value: Any\n    deprecation_reason: Optional[str] = None\n    directives: Iterable[object] = ()\n    description: Optional[str] = None\n\n\ndef enum_value(\n    value: Any,\n    deprecation_reason: Optional[str] = None,\n    directives: Iterable[object] = (),\n    description: Optional[str] = None,\n) -> EnumValueDefinition:\n    return EnumValueDefinition(\n        value=value,\n        deprecation_reason=deprecation_reason,\n        directives=directives,\n        description=description,\n    )\n\n\nEnumType = TypeVar(\"EnumType\", bound=EnumMeta)\n\n\ndef _process_enum(\n    cls: EnumType,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = (),\n) -> EnumType:\n    if not isinstance(cls, EnumMeta):\n        raise ObjectIsNotAnEnumError(cls)\n\n    if not name:\n        name = cls.__name__\n\n    description = description\n\n    values = []\n    for item in cls:  # type: ignore\n        item_value = item.value\n        item_name = item.name\n        deprecation_reason = None\n        item_directives: Iterable[object] = ()\n        enum_value_description = None\n\n        if isinstance(item_value, EnumValueDefinition):\n            item_directives = item_value.directives\n            enum_value_description = item_value.description\n            deprecation_reason = item_value.deprecation_reason\n            item_value = item_value.value\n\n            # update _value2member_map_ so that doing `MyEnum.MY_VALUE` and\n            # `MyEnum['MY_VALUE']` both work\n            cls._value2member_map_[item_value] = item\n            cls._member_map_[item_name]._value_ = item_value\n\n        value = EnumValue(\n            item_name,\n            item_value,\n            deprecation_reason=deprecation_reason,\n            directives=item_directives,\n            description=enum_value_description,\n        )\n        values.append(value)\n\n    cls._enum_definition = EnumDefinition(  # type: ignore\n        wrapped_cls=cls,\n        name=name,\n        values=values,\n        description=description,\n        directives=directives,\n    )\n\n    return cls\n\n\n@overload\ndef enum(\n    _cls: EnumType,\n    *,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = ()\n) -> EnumType:\n    ...\n\n\n@overload\ndef enum(\n    _cls: None = None,\n    *,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = ()\n) -> Callable[[EnumType], EnumType]:\n    ...\n\n\ndef enum(\n    _cls: Optional[EnumType] = None,\n    *,\n    name: Optional[str] = None,\n    description: Optional[str] = None,\n    directives: Iterable[object] = ()\n) -> Union[EnumType, Callable[[EnumType], EnumType]]:\n    \"\"\"Registers the enum in the GraphQL type system.\n\n    If name is passed, the name of the GraphQL type will be\n    the value passed of name instead of the Enum class name.\n    \"\"\"\n\n    def wrap(cls: EnumType) -> EnumType:\n        return _process_enum(cls, name, description, directives=directives)\n\n    if not _cls:\n        return wrap\n\n    return wrap(_cls)\n", "path": "strawberry/enum.py"}]}