prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Error adding more than one implementation of an interface
  **Observed Behaviour**: When i try to add two implementations of an interface, i get a duplicated type name exception
  
  **Expected Behaviour**: Instead of trying to recreate the interface type again, reuse it.
  
  **Steps to reproduce**:
  1. Create an interface
  2. Create two types which implement the interface
  3. Launch `strawberry server app`
  4. See it fails with ` Schema must contain uniquely named types but contains multiple types named '<InterfaceName>'`
  
  **Snippet to reproduce the issue**
  ````python
  from typing import List, Optional, Union
  import strawberry
  from strawberry import field
  
  
  @strawberry.interface
  class Person:
      name: str
      email: str
  
  
  @strawberry.type
  class Speaker(Person):
      job: str 
  
  
  @strawberry.type
  class Attendee(Person):
      interests: List[str]
  
  
  def get_people_by_name(name: str): 
      return []
  
  
  @strawberry.type
  class Query:
      searchPeopleByName: List[Union[Speaker, Attendee]] = field(resolver=get_people_by_name)
  
  schema = strawberry.Schema(query=Query)
  ````
  **Full traceback:**
  ```
    File "/mnt/c/Users/<User>/code/nerdearla/test_app.py", line 30, in <module>
      schema = strawberry.Schema(query=Query)
    File "/home/crow/.virtualenvs/venv/lib/python3.8/site-packages/strawberry/schema/schema.py", line 42, in __init__
      self._schema = GraphQLSchema(
    File "/home/crow/.virtualenvs/venv/lib/python3.8/site-packages/graphql/type/schema.py", line 240, in __init__
      raise TypeError(
  TypeError: Schema must contain uniquely named types but contains multiple types named 'Person'.
  ```
  
  </issue>
  <code>
  [start of strawberry/schema/types/object_type.py]
  1 from typing import Type, cast
  2 
  3 from graphql import GraphQLInputObjectType, GraphQLObjectType
  4 from graphql.type.definition import GraphQLInterfaceType
  5 from strawberry.type import TypeDefinition
  6 
  7 from .fields import get_field
  8 from .types import ConcreteType, GraphQLType, TypeMap
  9 
  10 
  11 def _get_object_type_for_type_definition(
  12     type_definition: TypeDefinition, type_map: TypeMap
  13 ) -> GraphQLType:
  14 
  15     TypeClass: Type = GraphQLObjectType
  16 
  17     kwargs = {}
  18 
  19     if type_definition.is_input:
  20         TypeClass = GraphQLInputObjectType
  21     elif type_definition.is_interface:
  22         TypeClass = GraphQLInterfaceType
  23 
  24     if type_definition.interfaces:
  25         kwargs["interfaces"] = [
  26             _get_object_type_for_type_definition(interface, type_map)
  27             for interface in type_definition.interfaces
  28         ]
  29 
  30     assert not type_definition.is_generic
  31 
  32     return TypeClass(
  33         name=type_definition.name,
  34         fields=lambda: {
  35             field.name: get_field(field, type_definition.is_input, type_map)
  36             for field in type_definition.fields
  37         },
  38         description=type_definition.description,
  39         **kwargs,
  40     )
  41 
  42 
  43 def get_object_type(origin: Type, type_map: TypeMap) -> GraphQLObjectType:
  44     """Returns a root type (Query, Mutation, Subscription) from a decorated type"""
  45 
  46     if not hasattr(origin, "_type_definition"):
  47         raise ValueError(f"Wrong type passed to get object type {origin}")
  48 
  49     type_definition: TypeDefinition = origin._type_definition
  50 
  51     name = type_definition.name
  52 
  53     if name not in type_map:
  54         object_type = _get_object_type_for_type_definition(type_definition, type_map)
  55 
  56         type_map[name] = ConcreteType(
  57             definition=type_definition, implementation=object_type
  58         )
  59 
  60     return cast(GraphQLObjectType, type_map[name].implementation)
  61
  [end of strawberry/schema/types/object_type.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/strawberry/schema/types/object_type.py b/strawberry/schema/types/object_type.py
  --- a/strawberry/schema/types/object_type.py
  +++ b/strawberry/schema/types/object_type.py
  @@ -12,32 +12,43 @@
       type_definition: TypeDefinition, type_map: TypeMap
   ) -> GraphQLType:
   
  -    TypeClass: Type = GraphQLObjectType
  -
  -    kwargs = {}
  -
  -    if type_definition.is_input:
  -        TypeClass = GraphQLInputObjectType
  -    elif type_definition.is_interface:
  -        TypeClass = GraphQLInterfaceType
  -
  -    if type_definition.interfaces:
  -        kwargs["interfaces"] = [
  -            _get_object_type_for_type_definition(interface, type_map)
  -            for interface in type_definition.interfaces
  -        ]
  -
  -    assert not type_definition.is_generic
  -
  -    return TypeClass(
  -        name=type_definition.name,
  -        fields=lambda: {
  -            field.name: get_field(field, type_definition.is_input, type_map)
  -            for field in type_definition.fields
  -        },
  -        description=type_definition.description,
  -        **kwargs,
  -    )
  +    if type_definition.name not in type_map:
  +        TypeClass: Type = GraphQLObjectType
  +
  +        kwargs = {}
  +
  +        if type_definition.is_input:
  +            TypeClass = GraphQLInputObjectType
  +        elif type_definition.is_interface:
  +            TypeClass = GraphQLInterfaceType
  +
  +        if type_definition.interfaces:
  +            kwargs["interfaces"] = [
  +                _get_object_type_for_type_definition(interface, type_map)
  +                for interface in type_definition.interfaces
  +            ]
  +            # this tells GraphQL core what the returned object's actual type is
  +            kwargs["is_type_of"] = lambda obj, _: isinstance(  # type: ignore
  +                obj, type_definition.origin
  +            )
  +
  +        assert not type_definition.is_generic
  +
  +        object_type = TypeClass(
  +            name=type_definition.name,
  +            fields=lambda: {
  +                field.name: get_field(field, type_definition.is_input, type_map)
  +                for field in type_definition.fields
  +            },
  +            description=type_definition.description,
  +            **kwargs,
  +        )
  +
  +        type_map[type_definition.name] = ConcreteType(
  +            definition=type_definition, implementation=object_type
  +        )
  +
  +    return type_map[type_definition.name].implementation
   
   
   def get_object_type(origin: Type, type_map: TypeMap) -> GraphQLObjectType:
  @@ -48,13 +59,7 @@
   
       type_definition: TypeDefinition = origin._type_definition
   
  -    name = type_definition.name
  -
  -    if name not in type_map:
  -        object_type = _get_object_type_for_type_definition(type_definition, type_map)
  -
  -        type_map[name] = ConcreteType(
  -            definition=type_definition, implementation=object_type
  -        )
  -
  -    return cast(GraphQLObjectType, type_map[name].implementation)
  +    return cast(
  +        GraphQLObjectType,
  +        _get_object_type_for_type_definition(type_definition, type_map),
  +    )
  
verification_info: {"golden_diff": "diff --git a/strawberry/schema/types/object_type.py b/strawberry/schema/types/object_type.py\n--- a/strawberry/schema/types/object_type.py\n+++ b/strawberry/schema/types/object_type.py\n@@ -12,32 +12,43 @@\n     type_definition: TypeDefinition, type_map: TypeMap\n ) -> GraphQLType:\n \n-    TypeClass: Type = GraphQLObjectType\n-\n-    kwargs = {}\n-\n-    if type_definition.is_input:\n-        TypeClass = GraphQLInputObjectType\n-    elif type_definition.is_interface:\n-        TypeClass = GraphQLInterfaceType\n-\n-    if type_definition.interfaces:\n-        kwargs[\"interfaces\"] = [\n-            _get_object_type_for_type_definition(interface, type_map)\n-            for interface in type_definition.interfaces\n-        ]\n-\n-    assert not type_definition.is_generic\n-\n-    return TypeClass(\n-        name=type_definition.name,\n-        fields=lambda: {\n-            field.name: get_field(field, type_definition.is_input, type_map)\n-            for field in type_definition.fields\n-        },\n-        description=type_definition.description,\n-        **kwargs,\n-    )\n+    if type_definition.name not in type_map:\n+        TypeClass: Type = GraphQLObjectType\n+\n+        kwargs = {}\n+\n+        if type_definition.is_input:\n+            TypeClass = GraphQLInputObjectType\n+        elif type_definition.is_interface:\n+            TypeClass = GraphQLInterfaceType\n+\n+        if type_definition.interfaces:\n+            kwargs[\"interfaces\"] = [\n+                _get_object_type_for_type_definition(interface, type_map)\n+                for interface in type_definition.interfaces\n+            ]\n+            # this tells GraphQL core what the returned object's actual type is\n+            kwargs[\"is_type_of\"] = lambda obj, _: isinstance(  # type: ignore\n+                obj, type_definition.origin\n+            )\n+\n+        assert not type_definition.is_generic\n+\n+        object_type = TypeClass(\n+            name=type_definition.name,\n+            fields=lambda: {\n+                field.name: get_field(field, type_definition.is_input, type_map)\n+                for field in type_definition.fields\n+            },\n+            description=type_definition.description,\n+            **kwargs,\n+        )\n+\n+        type_map[type_definition.name] = ConcreteType(\n+            definition=type_definition, implementation=object_type\n+        )\n+\n+    return type_map[type_definition.name].implementation\n \n \n def get_object_type(origin: Type, type_map: TypeMap) -> GraphQLObjectType:\n@@ -48,13 +59,7 @@\n \n     type_definition: TypeDefinition = origin._type_definition\n \n-    name = type_definition.name\n-\n-    if name not in type_map:\n-        object_type = _get_object_type_for_type_definition(type_definition, type_map)\n-\n-        type_map[name] = ConcreteType(\n-            definition=type_definition, implementation=object_type\n-        )\n-\n-    return cast(GraphQLObjectType, type_map[name].implementation)\n+    return cast(\n+        GraphQLObjectType,\n+        _get_object_type_for_type_definition(type_definition, type_map),\n+    )\n", "issue": "Error adding more than one implementation of an interface\n**Observed Behaviour**: When i try to add two implementations of an interface, i get a duplicated type name exception\r\n\r\n**Expected Behaviour**: Instead of trying to recreate the interface type again, reuse it.\r\n\r\n**Steps to reproduce**:\r\n1. Create an interface\r\n2. Create two types which implement the interface\r\n3. Launch `strawberry server app`\r\n4. See it fails with ` Schema must contain uniquely named types but contains multiple types named '<InterfaceName>'`\r\n\r\n**Snippet to reproduce the issue**\r\n````python\r\nfrom typing import List, Optional, Union\r\nimport strawberry\r\nfrom strawberry import field\r\n\r\n\r\n@strawberry.interface\r\nclass Person:\r\n    name: str\r\n    email: str\r\n\r\n\r\n@strawberry.type\r\nclass Speaker(Person):\r\n    job: str \r\n\r\n\r\n@strawberry.type\r\nclass Attendee(Person):\r\n    interests: List[str]\r\n\r\n\r\ndef get_people_by_name(name: str): \r\n    return []\r\n\r\n\r\n@strawberry.type\r\nclass Query:\r\n    searchPeopleByName: List[Union[Speaker, Attendee]] = field(resolver=get_people_by_name)\r\n\r\nschema = strawberry.Schema(query=Query)\r\n````\r\n**Full traceback:**\r\n```\r\n  File \"/mnt/c/Users/<User>/code/nerdearla/test_app.py\", line 30, in <module>\r\n    schema = strawberry.Schema(query=Query)\r\n  File \"/home/crow/.virtualenvs/venv/lib/python3.8/site-packages/strawberry/schema/schema.py\", line 42, in __init__\r\n    self._schema = GraphQLSchema(\r\n  File \"/home/crow/.virtualenvs/venv/lib/python3.8/site-packages/graphql/type/schema.py\", line 240, in __init__\r\n    raise TypeError(\r\nTypeError: Schema must contain uniquely named types but contains multiple types named 'Person'.\r\n```\n", "before_files": [{"content": "from typing import Type, cast\n\nfrom graphql import GraphQLInputObjectType, GraphQLObjectType\nfrom graphql.type.definition import GraphQLInterfaceType\nfrom strawberry.type import TypeDefinition\n\nfrom .fields import get_field\nfrom .types import ConcreteType, GraphQLType, TypeMap\n\n\ndef _get_object_type_for_type_definition(\n    type_definition: TypeDefinition, type_map: TypeMap\n) -> GraphQLType:\n\n    TypeClass: Type = GraphQLObjectType\n\n    kwargs = {}\n\n    if type_definition.is_input:\n        TypeClass = GraphQLInputObjectType\n    elif type_definition.is_interface:\n        TypeClass = GraphQLInterfaceType\n\n    if type_definition.interfaces:\n        kwargs[\"interfaces\"] = [\n            _get_object_type_for_type_definition(interface, type_map)\n            for interface in type_definition.interfaces\n        ]\n\n    assert not type_definition.is_generic\n\n    return TypeClass(\n        name=type_definition.name,\n        fields=lambda: {\n            field.name: get_field(field, type_definition.is_input, type_map)\n            for field in type_definition.fields\n        },\n        description=type_definition.description,\n        **kwargs,\n    )\n\n\ndef get_object_type(origin: Type, type_map: TypeMap) -> GraphQLObjectType:\n    \"\"\"Returns a root type (Query, Mutation, Subscription) from a decorated type\"\"\"\n\n    if not hasattr(origin, \"_type_definition\"):\n        raise ValueError(f\"Wrong type passed to get object type {origin}\")\n\n    type_definition: TypeDefinition = origin._type_definition\n\n    name = type_definition.name\n\n    if name not in type_map:\n        object_type = _get_object_type_for_type_definition(type_definition, type_map)\n\n        type_map[name] = ConcreteType(\n            definition=type_definition, implementation=object_type\n        )\n\n    return cast(GraphQLObjectType, type_map[name].implementation)\n", "path": "strawberry/schema/types/object_type.py"}]}