prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Lists being marked as Optional
  When defining a list the resulting schema marks the list as optional (or nullable in GraphQL terms) even if it wasn't wrapped in `typing.Optional`, we should fix that :)
  
  --- 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/type_converter.py`
  Content:
  ```
  1 from collections.abc import AsyncGenerator
  2 
  3 from graphql import (
  4     GraphQLBoolean,
  5     GraphQLFloat,
  6     GraphQLID,
  7     GraphQLInt,
  8     GraphQLList,
  9     GraphQLNonNull,
  10     GraphQLString,
  11     GraphQLUnionType,
  12 )
  13 
  14 from .exceptions import UnallowedReturnTypeForUnion, WrongReturnTypeForUnion
  15 from .scalars import ID
  16 from .utils.typing import is_union
  17 
  18 
  19 REGISTRY = {
  20     str: GraphQLString,
  21     int: GraphQLInt,
  22     float: GraphQLFloat,
  23     bool: GraphQLBoolean,
  24     ID: GraphQLID,
  25 }
  26 
  27 
  28 # TODO: make so that we don't pass force optional
  29 # we use that when trying to get the type for a
  30 # option field (which can either be a scalar or an object type)
  31 def get_graphql_type_for_annotation(
  32     annotation, field_name: str, force_optional: bool = False
  33 ):
  34     # TODO: this might lead to issues with types that have a field value
  35     is_field_optional = force_optional
  36 
  37     if hasattr(annotation, "field"):
  38         graphql_type = annotation.field
  39     else:
  40         annotation_name = getattr(annotation, "_name", None)
  41 
  42         if annotation_name == "List":
  43             list_of_type = get_graphql_type_for_annotation(
  44                 annotation.__args__[0], field_name
  45             )
  46 
  47             return GraphQLList(list_of_type)
  48 
  49         annotation_origin = getattr(annotation, "__origin__", None)
  50 
  51         if annotation_origin == AsyncGenerator:
  52             # async generators are used in subscription, we only need the yield type
  53             # https://docs.python.org/3/library/typing.html#typing.AsyncGenerator
  54             return get_graphql_type_for_annotation(annotation.__args__[0], field_name)
  55 
  56         elif is_union(annotation):
  57             types = annotation.__args__
  58             non_none_types = [x for x in types if x != None.__class__]  # noqa:E721
  59 
  60             # optionals are represented as Union[type, None]
  61             if len(non_none_types) == 1:
  62                 is_field_optional = True
  63                 graphql_type = get_graphql_type_for_annotation(
  64                     non_none_types[0], field_name, force_optional=True
  65                 )
  66             else:
  67                 is_field_optional = None.__class__ in types
  68 
  69                 def _resolve_type(self, value, _type):
  70                     if not hasattr(self, "field"):
  71                         raise WrongReturnTypeForUnion(value.field_name, str(type(self)))
  72 
  73                     if self.field not in _type.types:
  74                         raise UnallowedReturnTypeForUnion(
  75                             value.field_name, str(type(self)), _type.types
  76                         )
  77 
  78                     return self.field
  79 
  80                 # TODO: union types don't work with scalar types
  81                 # so we want to return a nice error
  82                 # also we want to make sure we have been passed
  83                 # strawberry types
  84                 graphql_type = GraphQLUnionType(
  85                     field_name, [type.field for type in types]
  86                 )
  87                 graphql_type.resolve_type = _resolve_type
  88         else:
  89             graphql_type = REGISTRY.get(annotation)
  90 
  91     if not graphql_type:
  92         raise ValueError(f"Unable to get GraphQL type for {annotation}")
  93 
  94     if is_field_optional:
  95         return graphql_type
  96 
  97     return GraphQLNonNull(graphql_type)
  98
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/strawberry/type_converter.py b/strawberry/type_converter.py
  --- a/strawberry/type_converter.py
  +++ b/strawberry/type_converter.py
  @@ -44,7 +44,9 @@
                   annotation.__args__[0], field_name
               )
   
  -            return GraphQLList(list_of_type)
  +            list_type = GraphQLList(list_of_type)
  +
  +            return list_type if is_field_optional else GraphQLNonNull(list_type)
   
           annotation_origin = getattr(annotation, "__origin__", None)
  
verification_info: {"golden_diff": "diff --git a/strawberry/type_converter.py b/strawberry/type_converter.py\n--- a/strawberry/type_converter.py\n+++ b/strawberry/type_converter.py\n@@ -44,7 +44,9 @@\n                 annotation.__args__[0], field_name\n             )\n \n-            return GraphQLList(list_of_type)\n+            list_type = GraphQLList(list_of_type)\n+\n+            return list_type if is_field_optional else GraphQLNonNull(list_type)\n \n         annotation_origin = getattr(annotation, \"__origin__\", None)\n", "issue": "Lists being marked as Optional\nWhen defining a list the resulting schema marks the list as optional (or nullable in GraphQL terms) even if it wasn't wrapped in `typing.Optional`, we should fix that :)\n", "before_files": [{"content": "from collections.abc import AsyncGenerator\n\nfrom graphql import (\n    GraphQLBoolean,\n    GraphQLFloat,\n    GraphQLID,\n    GraphQLInt,\n    GraphQLList,\n    GraphQLNonNull,\n    GraphQLString,\n    GraphQLUnionType,\n)\n\nfrom .exceptions import UnallowedReturnTypeForUnion, WrongReturnTypeForUnion\nfrom .scalars import ID\nfrom .utils.typing import is_union\n\n\nREGISTRY = {\n    str: GraphQLString,\n    int: GraphQLInt,\n    float: GraphQLFloat,\n    bool: GraphQLBoolean,\n    ID: GraphQLID,\n}\n\n\n# TODO: make so that we don't pass force optional\n# we use that when trying to get the type for a\n# option field (which can either be a scalar or an object type)\ndef get_graphql_type_for_annotation(\n    annotation, field_name: str, force_optional: bool = False\n):\n    # TODO: this might lead to issues with types that have a field value\n    is_field_optional = force_optional\n\n    if hasattr(annotation, \"field\"):\n        graphql_type = annotation.field\n    else:\n        annotation_name = getattr(annotation, \"_name\", None)\n\n        if annotation_name == \"List\":\n            list_of_type = get_graphql_type_for_annotation(\n                annotation.__args__[0], field_name\n            )\n\n            return GraphQLList(list_of_type)\n\n        annotation_origin = getattr(annotation, \"__origin__\", None)\n\n        if annotation_origin == AsyncGenerator:\n            # async generators are used in subscription, we only need the yield type\n            # https://docs.python.org/3/library/typing.html#typing.AsyncGenerator\n            return get_graphql_type_for_annotation(annotation.__args__[0], field_name)\n\n        elif is_union(annotation):\n            types = annotation.__args__\n            non_none_types = [x for x in types if x != None.__class__]  # noqa:E721\n\n            # optionals are represented as Union[type, None]\n            if len(non_none_types) == 1:\n                is_field_optional = True\n                graphql_type = get_graphql_type_for_annotation(\n                    non_none_types[0], field_name, force_optional=True\n                )\n            else:\n                is_field_optional = None.__class__ in types\n\n                def _resolve_type(self, value, _type):\n                    if not hasattr(self, \"field\"):\n                        raise WrongReturnTypeForUnion(value.field_name, str(type(self)))\n\n                    if self.field not in _type.types:\n                        raise UnallowedReturnTypeForUnion(\n                            value.field_name, str(type(self)), _type.types\n                        )\n\n                    return self.field\n\n                # TODO: union types don't work with scalar types\n                # so we want to return a nice error\n                # also we want to make sure we have been passed\n                # strawberry types\n                graphql_type = GraphQLUnionType(\n                    field_name, [type.field for type in types]\n                )\n                graphql_type.resolve_type = _resolve_type\n        else:\n            graphql_type = REGISTRY.get(annotation)\n\n    if not graphql_type:\n        raise ValueError(f\"Unable to get GraphQL type for {annotation}\")\n\n    if is_field_optional:\n        return graphql_type\n\n    return GraphQLNonNull(graphql_type)\n", "path": "strawberry/type_converter.py"}], "after_files": [{"content": "from collections.abc import AsyncGenerator\n\nfrom graphql import (\n    GraphQLBoolean,\n    GraphQLFloat,\n    GraphQLID,\n    GraphQLInt,\n    GraphQLList,\n    GraphQLNonNull,\n    GraphQLString,\n    GraphQLUnionType,\n)\n\nfrom .exceptions import UnallowedReturnTypeForUnion, WrongReturnTypeForUnion\nfrom .scalars import ID\nfrom .utils.typing import is_union\n\n\nREGISTRY = {\n    str: GraphQLString,\n    int: GraphQLInt,\n    float: GraphQLFloat,\n    bool: GraphQLBoolean,\n    ID: GraphQLID,\n}\n\n\n# TODO: make so that we don't pass force optional\n# we use that when trying to get the type for a\n# option field (which can either be a scalar or an object type)\ndef get_graphql_type_for_annotation(\n    annotation, field_name: str, force_optional: bool = False\n):\n    # TODO: this might lead to issues with types that have a field value\n    is_field_optional = force_optional\n\n    if hasattr(annotation, \"field\"):\n        graphql_type = annotation.field\n    else:\n        annotation_name = getattr(annotation, \"_name\", None)\n\n        if annotation_name == \"List\":\n            list_of_type = get_graphql_type_for_annotation(\n                annotation.__args__[0], field_name\n            )\n\n            list_type = GraphQLList(list_of_type)\n\n            return list_type if is_field_optional else GraphQLNonNull(list_type)\n\n        annotation_origin = getattr(annotation, \"__origin__\", None)\n\n        if annotation_origin == AsyncGenerator:\n            # async generators are used in subscription, we only need the yield type\n            # https://docs.python.org/3/library/typing.html#typing.AsyncGenerator\n            return get_graphql_type_for_annotation(annotation.__args__[0], field_name)\n\n        elif is_union(annotation):\n            types = annotation.__args__\n            non_none_types = [x for x in types if x != None.__class__]  # noqa:E721\n\n            # optionals are represented as Union[type, None]\n            if len(non_none_types) == 1:\n                is_field_optional = True\n                graphql_type = get_graphql_type_for_annotation(\n                    non_none_types[0], field_name, force_optional=True\n                )\n            else:\n                is_field_optional = None.__class__ in types\n\n                def _resolve_type(self, value, _type):\n                    if not hasattr(self, \"field\"):\n                        raise WrongReturnTypeForUnion(value.field_name, str(type(self)))\n\n                    if self.field not in _type.types:\n                        raise UnallowedReturnTypeForUnion(\n                            value.field_name, str(type(self)), _type.types\n                        )\n\n                    return self.field\n\n                # TODO: union types don't work with scalar types\n                # so we want to return a nice error\n                # also we want to make sure we have been passed\n                # strawberry types\n                graphql_type = GraphQLUnionType(\n                    field_name, [type.field for type in types]\n                )\n                graphql_type.resolve_type = _resolve_type\n        else:\n            graphql_type = REGISTRY.get(annotation)\n\n    if not graphql_type:\n        raise ValueError(f\"Unable to get GraphQL type for {annotation}\")\n\n    if is_field_optional:\n        return graphql_type\n\n    return GraphQLNonNull(graphql_type)\n", "path": "strawberry/type_converter.py"}]}