We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Raise ValueError when `field` or `source` decorator was called incorrectly
Currently there's no error when the developer forgets to follow the `field` or `source` decorator with `("name")`, tricking them into thinking that decorated function has been registered while in fact it wasn't.

We could update implementation for those functions to raise ValueError when `name` attr is not `str`.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ariadne/objects.py`
Content:
```
1 from typing import Callable, Dict, Optional, cast
2 
3 from graphql.type import GraphQLNamedType, GraphQLObjectType, GraphQLSchema
4 
5 from .resolvers import resolve_to
6 from .types import Resolver, SchemaBindable
7 
8 
9 class ObjectType(SchemaBindable):
10     _resolvers: Dict[str, Resolver]
11 
12     def __init__(self, name: str) -> None:
13         self.name = name
14         self._resolvers = {}
15 
16     def field(self, name: str) -> Callable[[Resolver], Resolver]:
17         return self.create_register_resolver(name)
18 
19     def create_register_resolver(self, name: str) -> Callable[[Resolver], Resolver]:
20         def register_resolver(f: Resolver) -> Resolver:
21             self._resolvers[name] = f
22             return f
23 
24         return register_resolver
25 
26     def set_field(self, name, resolver: Resolver) -> Resolver:
27         self._resolvers[name] = resolver
28         return resolver
29 
30     def set_alias(self, name: str, to: str) -> None:
31         self._resolvers[name] = resolve_to(to)
32 
33     def bind_to_schema(self, schema: GraphQLSchema) -> None:
34         graphql_type = schema.type_map.get(self.name)
35         self.validate_graphql_type(graphql_type)
36         graphql_type = cast(GraphQLObjectType, graphql_type)
37         self.bind_resolvers_to_graphql_type(graphql_type)
38 
39     def validate_graphql_type(self, graphql_type: Optional[GraphQLNamedType]) -> None:
40         if not graphql_type:
41             raise ValueError("Type %s is not defined in the schema" % self.name)
42         if not isinstance(graphql_type, GraphQLObjectType):
43             raise ValueError(
44                 "%s is defined in the schema, but it is instance of %s (expected %s)"
45                 % (self.name, type(graphql_type).__name__, GraphQLObjectType.__name__)
46             )
47 
48     def bind_resolvers_to_graphql_type(self, graphql_type, replace_existing=True):
49         for field, resolver in self._resolvers.items():
50             if field not in graphql_type.fields:
51                 raise ValueError(
52                     "Field %s is not defined on type %s" % (field, self.name)
53                 )
54             if graphql_type.fields[field].resolve is None or replace_existing:
55                 graphql_type.fields[field].resolve = resolver
56 
57 
58 class QueryType(ObjectType):
59     """Convenience class for defining Query type"""
60 
61     def __init__(self):
62         super().__init__("Query")
63 
64 
65 class MutationType(ObjectType):
66     """Convenience class for defining Mutation type"""
67 
68     def __init__(self):
69         super().__init__("Mutation")
70
```

Path: `ariadne/subscriptions.py`
Content:
```
1 from typing import Callable, Dict
2 
3 from graphql.type import GraphQLSchema
4 
5 from .objects import ObjectType
6 from .types import Subscriber
7 
8 
9 class SubscriptionType(ObjectType):
10     _subscribers: Dict[str, Subscriber]
11 
12     def __init__(self) -> None:
13         super().__init__("Subscription")
14         self._subscribers = {}
15 
16     def source(self, name: str) -> Callable[[Subscriber], Subscriber]:
17         return self.create_register_subscriber(name)
18 
19     def create_register_subscriber(
20         self, name: str
21     ) -> Callable[[Subscriber], Subscriber]:
22         def register_subscriber(generator: Subscriber) -> Subscriber:
23             self._subscribers[name] = generator
24             return generator
25 
26         return register_subscriber
27 
28     def set_source(self, name, generator: Subscriber) -> Subscriber:
29         self._subscribers[name] = generator
30         return generator
31 
32     def bind_to_schema(self, schema: GraphQLSchema) -> None:
33         graphql_type = schema.type_map.get(self.name)
34         self.validate_graphql_type(graphql_type)
35         self.bind_resolvers_to_graphql_type(graphql_type)
36         self.bind_subscribers_to_graphql_type(graphql_type)
37 
38     def bind_subscribers_to_graphql_type(self, graphql_type):
39         for field, subscriber in self._subscribers.items():
40             if field not in graphql_type.fields:
41                 raise ValueError(
42                     "Field %s is not defined on type %s" % (field, self.name)
43                 )
44 
45             graphql_type.fields[field].subscribe = subscriber
46
```
--- 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/ariadne/objects.py b/ariadne/objects.py
--- a/ariadne/objects.py
+++ b/ariadne/objects.py
@@ -14,6 +14,10 @@
         self._resolvers = {}
 
     def field(self, name: str) -> Callable[[Resolver], Resolver]:
+        if not isinstance(name, str):
+            raise ValueError(
+                'field decorator should be passed a field name: @foo.field("name")'
+            )
         return self.create_register_resolver(name)
 
     def create_register_resolver(self, name: str) -> Callable[[Resolver], Resolver]:
diff --git a/ariadne/subscriptions.py b/ariadne/subscriptions.py
--- a/ariadne/subscriptions.py
+++ b/ariadne/subscriptions.py
@@ -14,6 +14,10 @@
         self._subscribers = {}
 
     def source(self, name: str) -> Callable[[Subscriber], Subscriber]:
+        if not isinstance(name, str):
+            raise ValueError(
+                'source decorator should be passed a field name: @foo.source("name")'
+            )
         return self.create_register_subscriber(name)
 
     def create_register_subscriber(

{"golden_diff": "diff --git a/ariadne/objects.py b/ariadne/objects.py\n--- a/ariadne/objects.py\n+++ b/ariadne/objects.py\n@@ -14,6 +14,10 @@\n         self._resolvers = {}\n \n     def field(self, name: str) -> Callable[[Resolver], Resolver]:\n+        if not isinstance(name, str):\n+            raise ValueError(\n+                'field decorator should be passed a field name: @foo.field(\"name\")'\n+            )\n         return self.create_register_resolver(name)\n \n     def create_register_resolver(self, name: str) -> Callable[[Resolver], Resolver]:\ndiff --git a/ariadne/subscriptions.py b/ariadne/subscriptions.py\n--- a/ariadne/subscriptions.py\n+++ b/ariadne/subscriptions.py\n@@ -14,6 +14,10 @@\n         self._subscribers = {}\n \n     def source(self, name: str) -> Callable[[Subscriber], Subscriber]:\n+        if not isinstance(name, str):\n+            raise ValueError(\n+                'source decorator should be passed a field name: @foo.source(\"name\")'\n+            )\n         return self.create_register_subscriber(name)\n \n     def create_register_subscriber(\n", "issue": "Raise ValueError when `field` or `source` decorator was called incorrectly\nCurrently there's no error when the developer forgets to follow the `field` or `source` decorator with `(\"name\")`, tricking them into thinking that decorated function has been registered while in fact it wasn't.\r\n\r\nWe could update implementation for those functions to raise ValueError when `name` attr is not `str`.\n", "before_files": [{"content": "from typing import Callable, Dict, Optional, cast\n\nfrom graphql.type import GraphQLNamedType, GraphQLObjectType, GraphQLSchema\n\nfrom .resolvers import resolve_to\nfrom .types import Resolver, SchemaBindable\n\n\nclass ObjectType(SchemaBindable):\n    _resolvers: Dict[str, Resolver]\n\n    def __init__(self, name: str) -> None:\n        self.name = name\n        self._resolvers = {}\n\n    def field(self, name: str) -> Callable[[Resolver], Resolver]:\n        return self.create_register_resolver(name)\n\n    def create_register_resolver(self, name: str) -> Callable[[Resolver], Resolver]:\n        def register_resolver(f: Resolver) -> Resolver:\n            self._resolvers[name] = f\n            return f\n\n        return register_resolver\n\n    def set_field(self, name, resolver: Resolver) -> Resolver:\n        self._resolvers[name] = resolver\n        return resolver\n\n    def set_alias(self, name: str, to: str) -> None:\n        self._resolvers[name] = resolve_to(to)\n\n    def bind_to_schema(self, schema: GraphQLSchema) -> None:\n        graphql_type = schema.type_map.get(self.name)\n        self.validate_graphql_type(graphql_type)\n        graphql_type = cast(GraphQLObjectType, graphql_type)\n        self.bind_resolvers_to_graphql_type(graphql_type)\n\n    def validate_graphql_type(self, graphql_type: Optional[GraphQLNamedType]) -> None:\n        if not graphql_type:\n            raise ValueError(\"Type %s is not defined in the schema\" % self.name)\n        if not isinstance(graphql_type, GraphQLObjectType):\n            raise ValueError(\n                \"%s is defined in the schema, but it is instance of %s (expected %s)\"\n                % (self.name, type(graphql_type).__name__, GraphQLObjectType.__name__)\n            )\n\n    def bind_resolvers_to_graphql_type(self, graphql_type, replace_existing=True):\n        for field, resolver in self._resolvers.items():\n            if field not in graphql_type.fields:\n                raise ValueError(\n                    \"Field %s is not defined on type %s\" % (field, self.name)\n                )\n            if graphql_type.fields[field].resolve is None or replace_existing:\n                graphql_type.fields[field].resolve = resolver\n\n\nclass QueryType(ObjectType):\n    \"\"\"Convenience class for defining Query type\"\"\"\n\n    def __init__(self):\n        super().__init__(\"Query\")\n\n\nclass MutationType(ObjectType):\n    \"\"\"Convenience class for defining Mutation type\"\"\"\n\n    def __init__(self):\n        super().__init__(\"Mutation\")\n", "path": "ariadne/objects.py"}, {"content": "from typing import Callable, Dict\n\nfrom graphql.type import GraphQLSchema\n\nfrom .objects import ObjectType\nfrom .types import Subscriber\n\n\nclass SubscriptionType(ObjectType):\n    _subscribers: Dict[str, Subscriber]\n\n    def __init__(self) -> None:\n        super().__init__(\"Subscription\")\n        self._subscribers = {}\n\n    def source(self, name: str) -> Callable[[Subscriber], Subscriber]:\n        return self.create_register_subscriber(name)\n\n    def create_register_subscriber(\n        self, name: str\n    ) -> Callable[[Subscriber], Subscriber]:\n        def register_subscriber(generator: Subscriber) -> Subscriber:\n            self._subscribers[name] = generator\n            return generator\n\n        return register_subscriber\n\n    def set_source(self, name, generator: Subscriber) -> Subscriber:\n        self._subscribers[name] = generator\n        return generator\n\n    def bind_to_schema(self, schema: GraphQLSchema) -> None:\n        graphql_type = schema.type_map.get(self.name)\n        self.validate_graphql_type(graphql_type)\n        self.bind_resolvers_to_graphql_type(graphql_type)\n        self.bind_subscribers_to_graphql_type(graphql_type)\n\n    def bind_subscribers_to_graphql_type(self, graphql_type):\n        for field, subscriber in self._subscribers.items():\n            if field not in graphql_type.fields:\n                raise ValueError(\n                    \"Field %s is not defined on type %s\" % (field, self.name)\n                )\n\n            graphql_type.fields[field].subscribe = subscriber\n", "path": "ariadne/subscriptions.py"}], "after_files": [{"content": "from typing import Callable, Dict, Optional, cast\n\nfrom graphql.type import GraphQLNamedType, GraphQLObjectType, GraphQLSchema\n\nfrom .resolvers import resolve_to\nfrom .types import Resolver, SchemaBindable\n\n\nclass ObjectType(SchemaBindable):\n    _resolvers: Dict[str, Resolver]\n\n    def __init__(self, name: str) -> None:\n        self.name = name\n        self._resolvers = {}\n\n    def field(self, name: str) -> Callable[[Resolver], Resolver]:\n        if not isinstance(name, str):\n            raise ValueError(\n                'field decorator should be passed a field name: @foo.field(\"name\")'\n            )\n        return self.create_register_resolver(name)\n\n    def create_register_resolver(self, name: str) -> Callable[[Resolver], Resolver]:\n        def register_resolver(f: Resolver) -> Resolver:\n            self._resolvers[name] = f\n            return f\n\n        return register_resolver\n\n    def set_field(self, name, resolver: Resolver) -> Resolver:\n        self._resolvers[name] = resolver\n        return resolver\n\n    def set_alias(self, name: str, to: str) -> None:\n        self._resolvers[name] = resolve_to(to)\n\n    def bind_to_schema(self, schema: GraphQLSchema) -> None:\n        graphql_type = schema.type_map.get(self.name)\n        self.validate_graphql_type(graphql_type)\n        graphql_type = cast(GraphQLObjectType, graphql_type)\n        self.bind_resolvers_to_graphql_type(graphql_type)\n\n    def validate_graphql_type(self, graphql_type: Optional[GraphQLNamedType]) -> None:\n        if not graphql_type:\n            raise ValueError(\"Type %s is not defined in the schema\" % self.name)\n        if not isinstance(graphql_type, GraphQLObjectType):\n            raise ValueError(\n                \"%s is defined in the schema, but it is instance of %s (expected %s)\"\n                % (self.name, type(graphql_type).__name__, GraphQLObjectType.__name__)\n            )\n\n    def bind_resolvers_to_graphql_type(self, graphql_type, replace_existing=True):\n        for field, resolver in self._resolvers.items():\n            if field not in graphql_type.fields:\n                raise ValueError(\n                    \"Field %s is not defined on type %s\" % (field, self.name)\n                )\n            if graphql_type.fields[field].resolve is None or replace_existing:\n                graphql_type.fields[field].resolve = resolver\n\n\nclass QueryType(ObjectType):\n    \"\"\"Convenience class for defining Query type\"\"\"\n\n    def __init__(self):\n        super().__init__(\"Query\")\n\n\nclass MutationType(ObjectType):\n    \"\"\"Convenience class for defining Mutation type\"\"\"\n\n    def __init__(self):\n        super().__init__(\"Mutation\")\n", "path": "ariadne/objects.py"}, {"content": "from typing import Callable, Dict\n\nfrom graphql.type import GraphQLSchema\n\nfrom .objects import ObjectType\nfrom .types import Subscriber\n\n\nclass SubscriptionType(ObjectType):\n    _subscribers: Dict[str, Subscriber]\n\n    def __init__(self) -> None:\n        super().__init__(\"Subscription\")\n        self._subscribers = {}\n\n    def source(self, name: str) -> Callable[[Subscriber], Subscriber]:\n        if not isinstance(name, str):\n            raise ValueError(\n                'source decorator should be passed a field name: @foo.source(\"name\")'\n            )\n        return self.create_register_subscriber(name)\n\n    def create_register_subscriber(\n        self, name: str\n    ) -> Callable[[Subscriber], Subscriber]:\n        def register_subscriber(generator: Subscriber) -> Subscriber:\n            self._subscribers[name] = generator\n            return generator\n\n        return register_subscriber\n\n    def set_source(self, name, generator: Subscriber) -> Subscriber:\n        self._subscribers[name] = generator\n        return generator\n\n    def bind_to_schema(self, schema: GraphQLSchema) -> None:\n        graphql_type = schema.type_map.get(self.name)\n        self.validate_graphql_type(graphql_type)\n        self.bind_resolvers_to_graphql_type(graphql_type)\n        self.bind_subscribers_to_graphql_type(graphql_type)\n\n    def bind_subscribers_to_graphql_type(self, graphql_type):\n        for field, subscriber in self._subscribers.items():\n            if field not in graphql_type.fields:\n                raise ValueError(\n                    \"Field %s is not defined on type %s\" % (field, self.name)\n                )\n\n            graphql_type.fields[field].subscribe = subscriber\n", "path": "ariadne/subscriptions.py"}]}