Releases: strawberry-graphql/strawberry
馃崜 0.232.2
This release fixes an issue that would prevent using lazy aliased connections to
annotate a connection field.
For example, this should now work correctly:
# types.py
@strawberry.type
class Fruit: ...
FruitConnection: TypeAlias = ListConnection[Fruit]
# schema.py
@strawberry.type
class Query:
fruits: Annotated["FruitConnection", strawberry.lazy("types")] = (
strawberry.connection()
)
Releases contributed by @bellini666 via #3524
馃崜 0.232.1
This release fixes an issue where mypy would complain when using a typed async
resolver with strawberry.field(resolver=...)
.
Now the code will type check correctly. We also updated our test suite to make
we catch similar issues in the future.
Releases contributed by @patrick91 via #3516
馃崜 0.232.0
This release improves type checking for async resolver functions when used as
strawberry.field(resolver=resolver_func)
.
Now doing this will raise a type error:
import strawberry
def some_resolver() -> int:
return 0
@strawberry.type
class User:
# Note the field being typed as str instead of int
name: str = strawberry.field(resolver=some_resolver)
馃崜 0.231.1
馃崜 0.231.0
When calling the CLI without all the necessary dependencies installed,
a MissingOptionalDependenciesError
will be raised instead of a
ModuleNotFoundError
. This new exception will provide a more helpful
hint regarding how to fix the problem.
Releases contributed by @parafoxia via #3511
馃崜 0.230.0
This release adds support for @oneOf
on input types! 馃帀 You can use
one_of=True
on input types to create an input type that should only have one
of the fields set.
import strawberry
@strawberry.input(one_of=True)
class ExampleInputTagged:
a: str | None = strawberry.UNSET
b: int | None = strawberry.UNSET
Releases contributed by @patrick91 via #3429
馃崜 0.229.2
This release fixes an issue when using Annotated
+ strawberry.lazy
+
deferred annotations such as:
from __future__ import annotations
import strawberry
from typing import Annotated
@strawberry.type
class Query:
a: Annotated["datetime", strawberry.lazy("datetime")]
schema = strawberry.Schema(Query)
Before this would only work if datetime
was not inside quotes. Now it should
work as expected!
Releases contributed by @bellini666 via #3507
馃崜 0.229.1
This release fixes a regression from 0.229.0 where using a generic interface
inside a union would return an error.
Releases contributed by @patrick91 via #3502
馃崜 0.229.0
This release improves our support for generic types, now using the same the same
generic multiple times with a list inside an interface or union is supported,
for example the following will work:
import strawberry
@strawberry.type
class BlockRow[T]:
items: list[T]
@strawberry.type
class Query:
@strawberry.field
def blocks(self) -> list[BlockRow[str] | BlockRow[int]]:
return [
BlockRow(items=["a", "b", "c"]),
BlockRow(items=[1, 2, 3, 4]),
]
schema = strawberry.Schema(query=Query)
Releases contributed by @patrick91 via #3463