Repository: strawberry-graphql/strawberry

Issue:
App breaking when using Enum as field for Generic
<!-- Provide a general summary of the bug in the title above. -->
When using an Enum as a field on a Generic, the app breaks, throwing a `NotImplementedError`.

<!--- This template is entirely optional and can be removed, but is here to help both you and us. -->
<!--- Anything on lines wrapped in comments like these will not show up in the final text. -->

## Describe the Bug
The below code is an example of the error.
```python
from enum import Enum
from typing import Generic, Optional, TypeVar

import strawberry

T = TypeVar("T")


@strawberry.enum
class EstimatedValueEnum(Enum):
    test = "test"
    testtest = "testtest"


@strawberry.type
class EstimatedValue(Generic[T]):
    value: T
    type: EstimatedValueEnum


@strawberry.type
class Query:
    id_translations: Optional[EstimatedValue[int]]


schema = strawberry.Schema(query=Query)
```
Are we doing something wrong and this is intended or is this a bug?
<!-- A clear and concise description of what the bug is. -->

## System Information

 - Operating system: Docker
 - Strawberry version (if applicable): Since [0.149.2](https://github.com/strawberry-graphql/strawberry/blob/main/CHANGELOG.md#01492---2022-12-09)

<!-- Add any other relevant information about the problem here. -->



Discussion:
Hi @iamkhav this is a bug! I'll try to make a fix for it soon :)
Thanks a lot @patrick91 🙏

Resolving patch:
diff --git a/strawberry/enum.py b/strawberry/enum.py
--- a/strawberry/enum.py
+++ b/strawberry/enum.py
@@ -41,7 +41,8 @@ def __hash__(self) -> int:
     def copy_with(
         self, type_var_map: Mapping[TypeVar, Union[StrawberryType, type]]
     ) -> Union[StrawberryType, type]:
-        return super().copy_with(type_var_map)  # type: ignore[safe-super]
+        # enum don't support type parameters, so we can safely return self
+        return self
 
     @property
     def is_generic(self) -> bool:


Test patch:
diff --git a/tests/schema/test_generics.py b/tests/schema/test_generics.py
--- a/tests/schema/test_generics.py
+++ b/tests/schema/test_generics.py
@@ -395,6 +395,47 @@ def result(self) -> Union[Pet, ErrorNode[Codes]]:
     assert result.data == {"result": {"__typename": "CodesErrorNode", "code": "a"}}
 
 
+def test_generic_with_enum():
+    T = TypeVar("T")
+
+    @strawberry.enum
+    class EstimatedValueEnum(Enum):
+        test = "test"
+        testtest = "testtest"
+
+    @strawberry.type
+    class EstimatedValue(Generic[T]):
+        value: T
+        type: EstimatedValueEnum
+
+    @strawberry.type
+    class Query:
+        @strawberry.field
+        def estimated_value(self) -> Optional[EstimatedValue[int]]:
+            return EstimatedValue(value=1, type=EstimatedValueEnum.test)
+
+    schema = strawberry.Schema(query=Query)
+
+    query = """{
+        estimatedValue {
+            __typename
+            value
+            type
+        }
+    }"""
+
+    result = schema.execute_sync(query)
+
+    assert not result.errors
+    assert result.data == {
+        "estimatedValue": {
+            "__typename": "IntEstimatedValue",
+            "value": 1,
+            "type": "test",
+        }
+    }
+
+
 def test_supports_generic_in_unions_multiple_vars():
     A = TypeVar("A")
     B = TypeVar("B")