Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Release type: minor

Remove deprecated `info.field_nodes` property, deprecated since [0.73.1](https://github.com/strawberry-graphql/strawberry/releases/tag/0.73.1).

### Migration guide

**Before (deprecated):**
```python
@strawberry.type
class Query:
@strawberry.field
def example(self, info: strawberry.Info) -> str:
field_nodes = info.field_nodes
...
```

**After:**
```python
@strawberry.type
class Query:
@strawberry.field
def example(self, info: strawberry.Info) -> str:
selected_fields = info.selected_fields
...
```
12 changes: 0 additions & 12 deletions strawberry/types/info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import dataclasses
import warnings
from functools import cached_property
from typing import (
TYPE_CHECKING,
Expand All @@ -14,7 +13,6 @@

if TYPE_CHECKING:
from graphql import GraphQLResolveInfo, OperationDefinitionNode
from graphql.language import FieldNode
from graphql.pyutils.path import Path

from strawberry.schema import Schema
Expand Down Expand Up @@ -86,16 +84,6 @@ def schema(self) -> Schema:
"""The schema of the current execution."""
return self._raw_info.schema._strawberry_schema # type: ignore

@property
def field_nodes(self) -> list[FieldNode]: # deprecated
warnings.warn(
"`info.field_nodes` is deprecated, use `selected_fields` instead",
DeprecationWarning,
stacklevel=2,
)

return self._raw_info.field_nodes

@cached_property
def selected_fields(self) -> list[Selection]:
"""The fields that were selected on the current field's type."""
Expand Down
19 changes: 0 additions & 19 deletions tests/schema/test_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,25 +337,6 @@ class Query:
assert result.data["field"] == 0


def test_field_nodes_deprecation():
def resolver(info: strawberry.Info):
info.field_nodes
return 0

@strawberry.type
class Query:
field: int = strawberry.field(resolver=resolver)

schema = strawberry.Schema(query=Query)

with pytest.deprecated_call():
result = schema.execute_sync("{ field }")

assert not result.errors
assert result.data
assert result.data["field"] == 0


def test_get_argument_defintion_helper():
@strawberry.input
class TestInput:
Expand Down
Loading