Repository: strawberry-graphql/strawberry

Issue:
Add support for field deprecation
I was looking in the code and I couldn't find a way to mark field as deprecated. I also didn't find any issues regarding this.
I know that it is handled by `deprecation_reason` in graphql's `GraphQLField` but how I mark a field as deprecated in strawberry-graphql?

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



Discussion:
We don't support that at the moment, but should be easy to add :)

```python
@strawberry.type
class Query:
    user: User = strawberry.field(deprecation_reason='This is a test')
```

something like this. 

I'm finishing up a rewrite of strawberry, I'll see if I can add this in before finishing that, or after, anyway I don't see this taking too much time to be supported :)
That would be great! Thank you very much :D 

Resolving patch:
diff --git a/strawberry/field.py b/strawberry/field.py
--- a/strawberry/field.py
+++ b/strawberry/field.py
@@ -69,7 +69,8 @@ def field(
     is_subscription: bool = False,
     description: Optional[str] = None,
     permission_classes: Optional[List[Type[BasePermission]]] = None,
-    federation: Optional[FederationFieldParams] = None
+    federation: Optional[FederationFieldParams] = None,
+    deprecation_reason: Optional[str] = None,
 ):
     """Annotates a method or property as a GraphQL field.
 
@@ -97,6 +98,7 @@ def field(
         permission_classes=permission_classes or [],
         arguments=[],  # modified by resolver in __call__
         federation=federation or FederationFieldParams(),
+        deprecation_reason=deprecation_reason,
     )
 
     field_ = StrawberryField(field_definition)
diff --git a/strawberry/schema/types/fields.py b/strawberry/schema/types/fields.py
--- a/strawberry/schema/types/fields.py
+++ b/strawberry/schema/types/fields.py
@@ -41,4 +41,7 @@ def get_field(
         kwargs["args"] = convert_arguments(field.arguments, type_map)
         kwargs["resolve"] = resolver
 
+    if not is_input:
+        kwargs["deprecation_reason"] = field.deprecation_reason
+
     return TypeClass(graphql_type, **kwargs)  # type: ignore
diff --git a/strawberry/types/types.py b/strawberry/types/types.py
--- a/strawberry/types/types.py
+++ b/strawberry/types/types.py
@@ -92,3 +92,4 @@ class FieldDefinition:
         default_factory=list
     )
     default_value: Any = undefined
+    deprecation_reason: Optional[str] = None


Test patch:
diff --git a/tests/schema/test_basic.py b/tests/schema/test_basic.py
--- a/tests/schema/test_basic.py
+++ b/tests/schema/test_basic.py
@@ -166,6 +166,70 @@ def c(self, info, id: int) -> str:
     ]
 
 
+def test_field_deprecated_reason():
+    @strawberry.type
+    class Query:
+        a: str = strawberry.field(deprecation_reason="Deprecated A")
+
+        @strawberry.field
+        def b(self, info, id: int) -> str:
+            return "I'm a resolver"
+
+        @strawberry.field(deprecation_reason="Deprecated B")
+        def c(self, info, id: int) -> str:
+            return "I'm a resolver"
+
+    schema = strawberry.Schema(query=Query)
+
+    query = """{
+        __type(name: "Query") {
+            fields(includeDeprecated: true) {
+                name
+                deprecationReason
+            }
+        }
+    }"""
+
+    result = schema.execute_sync(query)
+
+    assert not result.errors
+    assert result.data["__type"]["fields"] == [
+        {"name": "a", "deprecationReason": "Deprecated A"},
+        {"name": "b", "deprecationReason": None},
+        {"name": "c", "deprecationReason": "Deprecated B"},
+    ]
+
+
+def test_field_deprecated_reason_subscription():
+    @strawberry.type
+    class Query:
+        a: str
+
+    @strawberry.type
+    class Subscription:
+        @strawberry.subscription(deprecation_reason="Deprecated A")
+        def a(self) -> str:
+            return "A"
+
+    schema = strawberry.Schema(query=Query, subscription=Subscription)
+
+    query = """{
+        __type(name: "Subscription") {
+            fields(includeDeprecated: true) {
+                name
+                deprecationReason
+            }
+        }
+    }"""
+
+    result = schema.execute_sync(query)
+
+    assert not result.errors
+    assert result.data["__type"]["fields"] == [
+        {"name": "a", "deprecationReason": "Deprecated A"},
+    ]
+
+
 def test_enum_description():
     @strawberry.enum(description="We love ice-creams")
     class IceCreamFlavour(Enum):