Repository: strawberry-graphql/strawberry

Issue:
Regression using interfaces with generic types.
## Describe the Bug
If a generic type implements an interface, and is registered as an extra type, it is not being recognized in the schema.

```python
from typing import Generic, TypeVar
import strawberry

T = TypeVar('T')

@strawberry.interface
class Abstract:
    x: str = ''

@strawberry.type
class Real(Generic[T], Abstract):
    y: T

@strawberry.type
class Query:
    @strawberry.field
    def real(self) -> Abstract:
        return Real[int](y=0)

schema = strawberry.Schema(Query, types=[Real[int]])
print(schema.execute_sync('{ real { __typename } }'))
```
raises `Abstract type 'Abstract' was resolved to a type 'Real' that does not exist inside the schema.`.

## System Information

 - Operating system: not applicable
 - Strawberry version (if applicable): 0.195

## Additional Context
This worked prior to v0.195. `IntReal` is present in the schema, but the error references type `Real`.

<!-- POLAR PLEDGE BADGE START -->
## Upvote & Fund

- We're using [Polar.sh](https://polar.sh/strawberry-graphql) so you can upvote and help fund this issue.
- We receive the funding once the issue is completed & confirmed by you.
- Thank you in advance for helping prioritize & fund our backlog.

<a href="https://polar.sh/strawberry-graphql/strawberry/issues/2954">
<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://polar.sh/api/github/strawberry-graphql/strawberry/issues/2954/pledge.svg?darkmode=1">
  <img alt="Fund with Polar" src="https://polar.sh/api/github/strawberry-graphql/strawberry/issues/2954/pledge.svg">
</picture>
</a>
<!-- POLAR PLEDGE BADGE END -->



Discussion:
Thanks for the report @coady, I'll take a look 😊

Resolving patch:
diff --git a/strawberry/schema/schema_converter.py b/strawberry/schema/schema_converter.py
--- a/strawberry/schema/schema_converter.py
+++ b/strawberry/schema/schema_converter.py
@@ -60,6 +60,7 @@
     StrawberryList,
     StrawberryOptional,
     StrawberryType,
+    get_object_definition,
     has_object_definition,
 )
 from strawberry.types.info import Info
@@ -435,11 +436,16 @@ def resolve_type(
                 obj: Any, info: GraphQLResolveInfo, abstract_type: GraphQLAbstractType
             ) -> Union[Awaitable[Optional[str]], str, None]:
                 if isinstance(obj, interface.origin):
-                    return obj.__strawberry_definition__.name
-                else:
-                    # Revert to calling is_type_of for cases where a direct subclass
-                    # of the interface is not returned (i.e. an ORM object)
-                    return default_type_resolver(obj, info, abstract_type)
+                    type_definition = get_object_definition(obj, strict=True)
+
+                    # TODO: we should find the correct type here from the
+                    # generic
+                    if not type_definition.is_generic:
+                        return obj.__strawberry_definition__.name
+
+                # Revert to calling is_type_of for cases where a direct subclass
+                # of the interface is not returned (i.e. an ORM object)
+                return default_type_resolver(obj, info, abstract_type)
 
             return resolve_type
 


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
@@ -1180,3 +1180,48 @@ def foo(self) -> GenericObject[str]:
             "repr": "foo",
         }
     }
+
+
+def test_generic_interface_extra_types():
+    T = TypeVar("T")
+
+    @strawberry.interface
+    class Abstract:
+        x: str = ""
+
+    @strawberry.type
+    class Real(Generic[T], Abstract):
+        y: T
+
+    @strawberry.type
+    class Query:
+        @strawberry.field
+        def real(self) -> Abstract:
+            return Real[int](y=0)
+
+    schema = strawberry.Schema(Query, types=[Real[int]])
+
+    assert (
+        str(schema)
+        == textwrap.dedent(
+            """
+            interface Abstract {
+              x: String!
+            }
+
+            type IntReal implements Abstract {
+              x: String!
+              y: Int!
+            }
+
+            type Query {
+              real: Abstract!
+            }
+            """
+        ).strip()
+    )
+
+    query_result = schema.execute_sync("{ real { __typename x } }")
+
+    assert not query_result.errors
+    assert query_result.data == {"real": {"__typename": "IntReal", "x": ""}}