NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI, #1553 most downloaded on PyPI
A library for creating GraphQL APIs
Latest stable
0.341.2
Last release 15 days ago
07 Nov 2026
Ships fairly regularly
a new release about every 1 weeks
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
8 years old
1155 releases · first in 2019
Drag across the ruler to compare, or tap a release to open it.
This release fixes an issue where optional lazy types using | None were failing to be correctly resolved inside modules using future annotations, e.g.
This release fixes an issue where optional lazy types using | None were
failing to be correctly resolved inside modules using future annotations, e.g.
from __future__ import annotations
from typing import Annotated, TYPE_CHECKING
import strawberry
if TYPE_CHECKING:
from types import Group
@strawberry.type
class Person:
group: Annotated["Group", strawberry.lazy("types.group")] | None
This should now work as expected.
Releases contributed by @bellini666 via #3576
This release fixes an issue where optional lazy types using | None were
failing to be correctly resolved inside modules using future annotations, e.g.
from __future__ import annotations
from typing import Annotated, TYPE_CHECKING
import strawberry
if TYPE_CHECKING:
from types import Group
@strawberry.type
class Person:
group: Annotated["Group", strawberry.lazy("types.group")] | None
This should now work as expected.
Contributed by Thiago Bellini Ribeiro via PR #3576
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release changes some of the internals of Strawberry, it shouldn't be affecting most of the users, but since we have changed the structure of the
This release changes some of the internals of Strawberry, it shouldn't be affecting most of the users, but since we have changed the structure of the code you might need to update your imports.
Thankfully we also provide a codemod for this, you can run it with:
strawberry upgrade update-imports
This release also includes additional documentation to some of the classes, methods and functions, this is in preparation for having the API reference in the documentation ✨
Releases contributed by @patrick91 via #3546
This release changes some of the internals of Strawberry, it shouldn’t be affecting most of the users, but since we have changed the structure of the code you might need to update your imports.
Thankfully we also provide a codemod for this, you can run it with:
Terminal window
strawberry upgrade update-imports
This release also includes additional documentation to some of the classes, methods and functions, this is in preparation for having the API reference in the documentation ✨
Contributed by Patrick Arminio via PR #3546
This release removes an unnecessary check from our internal GET query parsing logic making it simpler and (insignificantly) faster.
This release removes an unnecessary check from our internal GET query parsing logic making it simpler and (insignificantly) faster.
Releases contributed by @DoctorJohn via #3558
This release removes an unnecessary check from our internal GET query parsing logic making it simpler and (insignificantly) faster.
Contributed by Jonathan Ehwald via PR #3558
This release improves the performance when returning a lot of data, especially when using generic inputs (where we got a 7x speedup in our benchmark!)
This release improves the performance when returning a lot of data, especially when using generic inputs (where we got a 7x speedup in our benchmark!).
Releases contributed by @patrick91 via #3549
This release improves the performance when returning a lot of data, especially when using generic inputs (where we got a 7x speedup in our benchmark!).
Contributed by Patrick Arminio via PR #3549
Nothing published for this version
This release adds a new configuration to disable field suggestions in the error response.
This release adds a new configuration to disable field suggestions in the error response.
@strawberry.type
class Query:
name: str
schema = strawberry.Schema(
query=Query, config=StrawberryConfig(disable_field_suggestions=True)
)
Trying to query { nam } will not suggest to query name instead.
Releases contributed by @patrick91 via #3537
This release adds a new configuration to disable field suggestions in the error response.
@strawberry.type
class Query:
name: str
schema = strawberry.Schema(
query=Query, config=StrawberryConfig(disable_field_suggestions=True)
)
Trying to query { nam } will not suggest to query name instead.
Contributed by Patrick Arminio via PR #3537
Fixes a bug where pydantic models as the default value for an input did not print the proper schema. See this issue.
Fixes a bug where pydantic models as the default value for an input did not print the proper schema. See this issue.
Releases contributed by @ppease via #3499
Fixes a bug where pydantic models as the default value for an input did not print the proper schema. See this issue.
This release fixes an issue when trying to retrieve specialized type vars from a generic type that has been aliased to a name, in cases like:
This release fixes an issue when trying to retrieve specialized type vars from a generic type that has been aliased to a name, in cases like:
@strawberry.type
class Fruit(Generic[T]): ...
SpecializedFruit = Fruit[str]
Releases contributed by @bellini666 via #3535
This release fixes an issue when trying to retrieve specialized type vars from a generic type that has been aliased to a name, in cases like:
@strawberry.type
class Fruit(Generic[T]): ...
SpecializedFruit = Fruit[str]
Contributed by Thiago Bellini Ribeiro via PR #3535
Improved error message when supplying GlobalID with invalid or unknown type name component
Improved error message when supplying GlobalID with invalid or unknown type name component
Releases contributed by @diesieben07 via #3533
Improved error message when supplying GlobalID with invalid or unknown type name component
Contributed by Take Weiland via PR #3533
This release separates the relay.ListConnection logic that calculates the slice of the nodes into a separate function.
This release separates the relay.ListConnection logic that calculates the
slice of the nodes into a separate function.
This allows for easier reuse of that logic for other places/libraries.
The new function lives in the strawberry.relay.utils and can be used by
calling SliceMetadata.from_arguments.
This has no implications to end users.
Releases contributed by @bellini666 via #3530
This release separates the relay.ListConnection logic that calculates the
slice of the nodes into a separate function.
This allows for easier reuse of that logic for other places/libraries.
The new function lives in the strawberry.relay.utils and can be used by
calling SliceMetadata.from_arguments.
This has no implications to end users.
Contributed by Thiago Bellini Ribeiro via PR #3530
This release fixes a typing issue where trying to type a root argument with strawberry.Parent would fail, like in the following example:
This release fixes a typing issue where trying to type a root argument with
strawberry.Parent would fail, like in the following example:
import strawberry
@strawberry.type
class SomeType:
@strawberry.field
def hello(self, root: strawberry.Parent[str]) -> str:
return "world"
This should now work as intended.
Releases contributed by @bellini666 via #3529
This release fixes a typing issue where trying to type a root argument with
strawberry.Parent would fail, like in the following example:
import strawberry
@strawberry.type
class SomeType:
@strawberry.field
def hello(self, root: strawberry.Parent[str]) -> str:
return "world"
This should now work as intended.
Contributed by Thiago Bellini Ribeiro via PR #3529
This release fixes an introspection issue when requesting isOneOf on built-in scalars, like String.
This release fixes an introspection issue when requesting isOneOf on built-in
scalars, like String.
Releases contributed by @patrick91 via #3528
This release fixes an introspection issue when requesting isOneOf on built-in
scalars, like String.
Contributed by Patrick Arminio via PR #3528
This release exposes get_arguments in the schema_converter module to allow integrations, such as strawberry-django, to reuse that functionality if nee
This release exposes get_arguments in the schema_converter module to allow
integrations, such as strawberry-django, to reuse that functionality if needed.
This is an internal change with no impact for end users.
Releases contributed by @bellini666 via #3527
This release exposes get_arguments in the schema_converter module to allow
integrations, such as strawberry-django, to reuse that functionality if needed.
This is an internal change with no impact for end users.
Contributed by Thiago Bellini Ribeiro via PR #3527
…one coming coming from GraphQL-core. This is a breaking change for users that were using the info object directly.
This release refactors our Federation integration to create types using Strawberry directly, instead of using low level types from GraphQL-core.
The only user facing change is that now the info object passed to the
resolve_reference function is the strawberry.Info object instead of the one
coming coming from GraphQL-core. This is a breaking change for users that
were using the info object directly.
If you need to access the original info object you can do so by accessing the
_raw_info attribute.
import strawberry
@strawberry.federation.type(keys=["upc"])
class Product:
upc: str
@classmethod
def resolve_reference(cls, info: strawberry.Info, upc: str) -> "Product":
# Access the original info object
original_info = info._raw_info
return Product(upc=upc)
Releases contributed by @patrick91 via #3525
This release fixes an issue that would prevent using lazy aliased connections to annotate a connection field.
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
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()
)
Contributed by Thiago Bellini Ribeiro via PR #3524
This release fixes an issue where mypy would complain when using a typed async resolver with strawberry.field(resolver=...).
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
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.
Contributed by Patrick Arminio via PR #3516
This release improves type checking for async resolver functions when used as strawberry.field(resolver=resolver_func).
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)
Releases contributed by @bricker via #3241
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)
Contributed by Bryan Ricker via PR #3241
Fixes an issue where lazy annotations raised an error when used together with a List
Fixes an issue where lazy annotations raised an error when used together with a List
Releases contributed by @jeich via #3388
Fixes an issue where lazy annotations raised an error when used together with a List
When calling the CLI without all the necessary dependencies installed, a MissingOptionalDependenciesError will be raised instead of a ModuleNotFoundEr
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
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.
Contributed by Ethan Henderson via PR #3511
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
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
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
Contributed by Patrick Arminio via PR #3429
Nothing published for this version
This release fixes an issue when using Annotated + strawberry.lazy + deferred annotations such as:
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
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!
Contributed by Thiago Bellini Ribeiro via PR #3507
Nothing published for this version
Nothing published for this version
This release fixes a regression from 0.229.0 where using a generic interface inside a union would return an error.
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
This release fixes a regression from 0.229.0 where using a generic interface inside a union would return an error.
Contributed by Patrick Arminio via PR #3502
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 su
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
This releases updates the JSON scalar definition to have the updated specifiedBy URL.
This releases updates the JSON scalar definition to have the updated specifiedBy URL.
The release is marked as minor because it will change the generated schema if you're using the JSON scalar.
Releases contributed by @Birdi7 via #3478
This releases updates the JSON scalar definition to have the updated specifiedBy URL.
The release is marked as minor because it will change the generated schema if you're using the JSON scalar.
Nothing published for this version
This releases updates the field-extensions documentation's StrawberryField stability warning to include stable features.
This releases updates the field-extensions documentation's StrawberryField stability warning to include stable features.
The release is marked as patch because it only changes documentation.
Releases contributed by @fireteam99 via #3496
This releases updates the field-extensions documentation's StrawberryField stability warning to include stable features.
The release is marked as patch because it only changes documentation.
Fix AssertionError caused by the DatadogTracingExtension whenever the query is unavailable.
Fix AssertionError caused by the DatadogTracingExtension whenever the query is unavailable.
The bug in question was reported by issue #3150.
The datadog extension would throw an AssertionError whenever there was no query available. This could happen if,
for example, a user POSTed something to /graphql with a JSON that doesn't contain a query field as per the
GraphQL spec.
The fix consists of adding query_missing to the operation_type tag, and also adding query_missing to the resource name.
It also makes it easier to look for logs of users making invalid queries by searching for query_missing in Datadog.
Releases contributed by @serramatutu via #3483
Deprecations: This release deprecates the Starlite integration in favour of the LiteStar integration. Refer to the LiteStar integration for more infor…
Deprecations: This release deprecates the Starlite integration in favour of the LiteStar integration.
Refer to the LiteStar integration for more information.
LiteStar is a renamed and upgraded version of Starlite.
Before:
from strawberry.starlite import make_graphql_controller
After:
from strawberry.litestar import make_graphql_controller
Releases contributed by @Birdi7 via #3492
Deprecations: This release deprecates the Starlite integration in favour of the LiteStar integration.
Refer to the LiteStar integration for more information.
LiteStar is a renamed and upgraded version of Starlite.
Before:
from strawberry.starlite import make_graphql_controller
After:
from strawberry.litestar import make_graphql_controller
This release fixes a bug in release 0.227.3 where FragmentSpread nodes were not resolving edges.
This release fixes a bug in release 0.227.3 where FragmentSpread nodes were not resolving edges.
Releases contributed by @euriostigue via #3487
This release fixes a bug in release 0.227.3 where FragmentSpread nodes were not resolving edges.
Contributed by Eric Uriostigue via PR #3487
This release adds an optimization to ListConnection such that only queries with edges or pageInfo in their selected fields triggers resolve_edges.
This release adds an optimization to ListConnection such that only queries with
edges or pageInfo in their selected fields triggers resolve_edges.
This change is particularly useful for the strawberry-django extension's
ListConnectionWithTotalCount and the only selected field is totalCount. An
extraneous SQL query is prevented with this optimization.
Releases contributed by @euriostigue via #3480
This release adds an optimization to ListConnection such that only queries with
edges or pageInfo in their selected fields triggers resolve_edges.
This change is particularly useful for the strawberry-django extension's
ListConnectionWithTotalCount and the only selected field is totalCount. An
extraneous SQL query is prevented with this optimization.
Contributed by Eric Uriostigue via PR #3480
This release fixes a minor issue where the docstring for the relay util to_base64 described the return type incorrectly.
This release fixes a minor issue where the docstring for the relay util to_base64 described the return type incorrectly.
Releases contributed by @gbannerman via #3467
This release fixes a minor issue where the docstring for the relay util to_base64 described the return type incorrectly.
Contributed by Gavin Bannerman via PR #3467
This release fixes an issue where annotations on @strawberry.types were overridden by our code. With release all annotations should be preserved.
This release fixes an issue where annotations on @strawberry.types were overridden
by our code. With release all annotations should be preserved.
This is useful for libraries that use annotations to introspect Strawberry types.
Releases contributed by @patrick91 via #3003
This release fixes an issue where annotations on @strawberry.types were overridden
by our code. With release all annotations should be preserved.
This is useful for libraries that use annotations to introspect Strawberry types.
Contributed by Patrick Arminio via PR #3003
This release improves the schema codegen, making it more robust and easier to use.
This release improves the schema codegen, making it more robust and easier to use.
It does this by introducing a directed acyclic graph for the schema codegen, which should reduce the amount of edits needed to make the generated code work, since it will be able to generate the code in the correct order (based on the dependencies of each type).
Releases contributed by @patrick91 via #3116
Nothing published for this version
Nothing published for this version
This release updates our Mypy plugin to add support for Pydantic >= 2.7.0
This release updates our Mypy plugin to add support for Pydantic >= 2.7.0
Releases contributed by @patrick91 via #3462
This release updates our Mypy plugin to add support for Pydantic >= 2.7.0
Contributed by Patrick Arminio via PR #3462
This releases fixes a bug in the mypy plugin where the from_pydantic method was not correctly typed.
This releases fixes a bug in the mypy plugin where the from_pydantic method
was not correctly typed.
Releases contributed by @Corentin-Br via #3368
This releases fixes a bug in the mypy plugin where the from_pydantic method
was not correctly typed.
Contributed by Corentin-Br via PR #3368
Starting with this release, any error raised from within schema extensions will abort the operation and is returned to the client.
Starting with this release, any error raised from within schema extensions will abort the operation and is returned to the client.
This corresponds to the way we already handle field extension errors and resolver errors.
This is particular useful for schema extensions performing checks early in the request lifecycle, for example:
class MaxQueryLengthExtension(SchemaExtension):
MAX_QUERY_LENGTH = 8192
async def on_operation(self):
if len(self.execution_context.query) > self.MAX_QUERY_LENGTH:
raise StrawberryGraphQLError(message="Query too large")
yield
This change fixes GET request queries returning a 400 if a content_type header is supplied
This change fixes GET request queries returning a 400 if a content_type header is supplied
Releases contributed by @vethan via #3452
This change fixes GET request queries returning a 400 if a content_type header is supplied
Contributed by Nathan John via PR #3452
Now you have the opportunity to specify parameters such as tags, route_class, deprecated, include_in_schema, etc:
This release adds support for using FastAPI APIRouter arguments in GraphQLRouter.
Now you have the opportunity to specify parameters such as tags, route_class,
deprecated, include_in_schema, etc:
import strawberry
from fastapi import FastAPI
from strawberry.fastapi import GraphQLRouter
@strawberry.type
class Query:
@strawberry.field
def hello(self) -> str:
return "Hello World"
schema = strawberry.Schema(Query)
graphql_app = GraphQLRouter(schema, tags=["graphql"])
app = FastAPI()
app.include_router(graphql_app, prefix="/graphql")
Releases contributed by @nparamonov via #3442
This releases fixes a bug where schema extensions where not running a LIFO order.
This releases fixes a bug where schema extensions where not running a LIFO order.
Releases contributed by @nrbnlulu via #3416
This releases fixes a bug where schema extensions where not running a LIFO order.
This release fixes a deprecation warning when using the Apollo Tracing Extension.
This release fixes a deprecation warning when using the Apollo Tracing Extension.
Releases contributed by @coady via #3410
This release fixes a deprecation warning when using the Apollo Tracing Extension.
This release adds support for using both Pydantic v1 and v2, when importing from pydantic.v1.
This release adds support for using both Pydantic v1 and v2, when importing from
pydantic.v1.
This is automatically detected and the correct version is used.
Releases contributed by @patrick91 via #3426
This release adds support for using both Pydantic v1 and v2, when importing from
pydantic.v1.
This is automatically detected and the correct version is used.
Contributed by Patrick Arminio via PR #3426
Nothing published for this version
This release adds support for Apollo Federation in the schema codegen. Now you can convert a schema like this:
This release adds support for Apollo Federation in the schema codegen. Now you can convert a schema like this:
extend schema
@link(url: "https://specs.apollo.dev/federation/v2.3",
import: ["@key", "@shareable"])
type Query {
me: User
}
type User @key(fields: "id") {
id: ID!
username: String! @shareable
}
to a Strawberry powered schema like this:
import strawberry
@strawberry.type
class Query:
me: User | None
@strawberry.federation.type(keys=["id"])
class User:
id: strawberry.ID
username: str = strawberry.federation.field(shareable=True)
schema = strawberry.federation.Schema(query=Query, enable_federation_2=True)
By running the following command:
strawberry schema-codegen example.graphql
Releases contributed by @patrick91 via #3417
This release adds support for Apollo Federation in the schema codegen. Now you can convert a schema like this:
extend schema
@link ( url : "https://specs.apollo.dev/federation/v2.3" ,
import : [ "@key" , "@shareable" ])
type Query {
me : User
}
type User @key ( fields : "id" ) {
id : ID !
username : String ! @shareable
}
to a Strawberry powered schema like this:
import strawberry
@strawberry.type
class Query :
me: User | None
@strawberry.federation.type ( keys =[ "id" ])
class User :
id : strawberry.ID
username: str = strawberry.federation.field( shareable = True )
schema = strawberry.federation.Schema( query =Query, enable_federation_2 = True )
By running the following command:
Terminal window
strawberry schema-codegen example.graphql
Contributed by Patrick Arminio via PR #3417
This release adds support for Apollo Federation v2.7 which includes the @authenticated, @requiresScopes, @policy directives, as well as the label argu
This release adds support for Apollo Federation v2.7 which includes the @authenticated, @requiresScopes, @policy directives, as well as the label argument for @override.
As usual, we have first class support for them in the strawberry.federation namespace, here's an example:
from strawberry.federation.schema_directives import Override
@strawberry.federation.type(
authenticated=True,
policy=[["client", "poweruser"], ["admin"]],
requires_scopes=[["client", "poweruser"], ["admin"]],
)
class Product:
upc: str = strawberry.federation.field(
override=Override(override_from="mySubGraph", label="percent(1)")
)
Releases contributed by @TygerTaco via #3420
This release properly allows passing one argument to the Info class.
This release properly allows passing one argument to the Info class.
This is now fully supported:
import strawberry
from typing import TypedDict
class Context(TypedDict):
user_id: str
@strawberry.type
class Query:
@strawberry.field
def info(self, info: strawberry.Info[Context]) -> str:
return info.context["user_id"]
Releases contributed by @patrick91 via #3419
This release properly allows passing one argument to the Info class.
This is now fully supported:
import strawberry
from typing import TypedDict
class Context(TypedDict):
user_id: str
@strawberry.type
class Query:
@strawberry.field
def info(self, info: strawberry.Info[Context]) -> str:
return info.context["user_id"]
Contributed by Patrick Arminio via PR #3419
This release improves the Info type, by adding support for default TypeVars and by exporting it from the main module. This makes it easier to use Info
This release improves the Info type, by adding support for default TypeVars
and by exporting it from the main module. This makes it easier to use Info in
your own code, without having to import it from strawberry.types.info.
By exporting Info from the main module, now you can do the follwing:
import strawberry
@strawberry.type
class Query:
@strawberry.field
def info(self, info: strawberry.Info) -> str:
# do something with info
return "hello"
The Info type now has default TypeVars, so you can use it without having to
specify the type arguments, like we did in the example above. Make sure to use
the latest version of Mypy or Pyright for this. It also means that you can only
pass one value to it if you only care about the context type:
import strawberry
from .context import Context
@strawberry.type
class Query:
@strawberry.field
def info(self, info: strawberry.Info[Context]) -> str:
return info.context.user_id
Releases contributed by @patrick91 via #3418
Nothing published for this version
This release adds support to allow passing connection_params as dictionary to GraphQLWebsocketCommunicator class when testing channels integration
This release adds support to allow passing connection_params as dictionary to GraphQLWebsocketCommunicator class when testing channels integration
GraphQLWebsocketCommunicator(
application=application,
path="/graphql",
connection_params={"username": "strawberry"},
)
Releases contributed by @selvarajrajkanna via #3403
This release adds support to allow passing connection_params as dictionary to GraphQLWebsocketCommunicator class when testing channels integration
GraphQLWebsocketCommunicator(
application=application,
path="/graphql",
connection_params={"username": "strawberry"},
)
Contributed by selvarajrajkanna via PR #3403
Nothing published for this version
This releases updates the dependency of python-multipart to be at least 0.0.7 (which includes a security fix).
This releases updates the dependency of python-multipart to be at least 0.0.7 (which includes a security fix).
It also removes the upper bound for python-multipart so you can always install the latest version (if compatible) 😊
Releases contributed by @XChikuX via #3375
This releases updates the dependency of python-multipart to be at least 0.0.7 (which includes a security fix).
It also removes the upper bound for python-multipart so you can always install the latest version (if compatible) 😊
Improved error message when supplying in incorrect before or after argument with using relay and pagination.
Releases contributed by @sdobbelaere via #3361
This release adds support for litestar.
This release adds support for litestar.
import strawberry
from litestar import Request, Litestar
from strawberry.litestar import make_graphql_controller
from strawberry.types.info import Info
def custom_context_getter(request: Request):
return {"custom": "context"}
@strawberry.type
class Query:
@strawberry.field
def hello(self, info: Info[object, None]) -> str:
return info.context["custom"]
schema = strawberry.Schema(Query)
GraphQLController = make_graphql_controller(
schema,
path="/graphql",
context_getter=custom_context_getter,
)
app = Litestar(
route_handlers=[GraphQLController],
)
Releases contributed by @gazorby via #3213
This release adds support for litestar.
import strawberry
from litestar import Request, Litestar
from strawberry.litestar import make_graphql_controller
from strawberry.types.info import Info
def custom_context_getter(request: Request):
return {"custom": "context"}
@strawberry.type
class Query:
@strawberry.field
def hello(self, info: strawberry.Info[object, None]) -> str:
return info.context["custom"]
schema = strawberry.Schema(Query)
GraphQLController = make_graphql_controller(
schema,
path="/graphql",
context_getter=custom_context_getter,
)
app = Litestar(
route_handlers=[GraphQLController],
)
Contributed by Matthieu MN via PR #3213
This release fixes a small issue in the GraphQL Transport websocket where the connection would fail when receiving extra parameters in the payload sen
This release fixes a small issue in the GraphQL Transport websocket where the connection would fail when receiving extra parameters in the payload sent from the client.
This would happen when using Apollo Sandbox.
Releases contributed by @patrick91 via #3356
This release fixes a small issue in the GraphQL Transport websocket where the connection would fail when receiving extra parameters in the payload sent from the client.
This would happen when using Apollo Sandbox.
Contributed by Patrick Arminio via PR #3356
This release adds a new method get_fields on the Schema class. You can use get_fields to hide certain field based on some conditions, for example:
This release adds a new method get_fields on the Schema class.
You can use get_fields to hide certain field based on some conditions,
for example:
@strawberry.type
class User:
name: str
email: str = strawberry.field(metadata={"tags": ["internal"]})
@strawberry.type
class Query:
user: User
def public_field_filter(field: StrawberryField) -> bool:
return "internal" not in field.metadata.get("tags", [])
class PublicSchema(strawberry.Schema):
def get_fields(
self, type_definition: StrawberryObjectDefinition
) -> List[StrawberryField]:
return list(filter(public_field_filter, type_definition.fields))
schema = PublicSchema(query=Query)
The schema here would only have the name field on the User type.
Releases contributed by @patrick91 via #3274
Nothing published for this version
One column per quarter.