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.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
This release restricts the backports.cached_property dependency to only be installed when Python < 3.8. Since version 3.8 cached_property is included
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This release restricts the backports.cached_property dependency to only be installed when Python < 3.8. Since version 3.8 cached_property is included in the builtin functools . The code is updated to use the builtin version when Python >= 3.8.
Contributed by ljnsn via PR #2114
Keep extra discovered types sorted so that each schema printing is always the same.
Keep extra discovered types sorted so that each schema printing is always the same.
Contributed by Thiago Bellini Ribeiro via PR #2115
This release adds support for adding descriptions to enum values.
This release adds support for adding descriptions to enum values.
@strawberry.enum
class IceCreamFlavour ( Enum ):
VANILLA = strawberry.enum_value( "vanilla" )
STRAWBERRY = strawberry.enum_value(
"strawberry" ,
description = "Our favourite" ,
)
CHOCOLATE = "chocolate"
@strawberry.type
class Query :
favorite_ice_cream: IceCreamFlavour = IceCreamFlavour.STRAWBERRY
schema = strawberry.Schema( query =Query)
This produces the following schema
enum IceCreamFlavour {
VANILLA
"""Our favourite."""
STRAWBERRY
CHOCOLATE
}
type Query {
favoriteIceCream : IceCreamFlavour !
}
Contributed by Felipe Gonzalez via PR #2106
This release hides resolvable: True in @keys directives when using Apollo Federation 1, to preserve compatibility with older Gateways.
This release hides resolvable: True in @keys directives when using Apollo Federation 1, to preserve compatibility with older Gateways.
Contributed by Patrick Arminio via PR #2099
Nothing published for this version
This release adds an integration with Django Channels. The integration will allow you to use GraphQL subscriptions via Django Channels.
This release adds an integration with Django Channels. The integration will allow you to use GraphQL subscriptions via Django Channels.
Contributed by Dan Sloan via PR #1407
Nothing published for this version
This release adds full support for Apollo Federation 2.0. To opt-in you need to pass enable_federation_2=True to strawberry.federation.Schema , like i
This release adds full support for Apollo Federation 2.0. To opt-in you need to pass enable_federation_2=True to strawberry.federation.Schema , like in the following example:
@strawberry.federation.type ( keys =[ "id" ])
class User :
id : strawberry.ID
@strawberry.type
class Query :
user: User
schema = strawberry.federation.Schema( query =Query, enable_federation_2 = True )
This release also improves type checker support for the federation.
Contributed by Patrick Arminio via PR #2047
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
This release fixes a regression introduced in version 0.118.2 which was preventing using circular dependencies in Strawberry django and Strawberry dja
This release fixes a regression introduced in version 0.118.2 which was preventing using circular dependencies in Strawberry django and Strawberry django plus.
Contributed by Thiago Bellini Ribeiro via PR #2062
This release adds support for priting custom enums used only on schema directives, for example the following schema:
This release adds support for priting custom enums used only on schema directives, for example the following schema:
@strawberry.enum
class Reason ( str , Enum ):
EXAMPLE = "example"
@strawberry.schema_directive ( locations =[Location.FIELD_DEFINITION])
class Sensitive :
reason: Reason
@strawberry.type
class Query :
first_name: str = strawberry.field( directives =[Sensitive( reason =Reason.EXAMPLE)])
prints the following:
directive @sensitive ( reason : Reason !) on FIELD_DEFINITION
type Query {
firstName : String ! @sensitive ( reason : EXAMPLE )
}
enum Reason {
EXAMPLE
}
while previously it would omit the definition of the enum.
Contributed by Patrick Arminio via PR #2059
This release adds support for priting custom scalar used only on schema directives, for example the following schema:
This release adds support for priting custom scalar used only on schema directives, for example the following schema:
SensitiveConfiguration = strawberry.scalar( str , name = "SensitiveConfiguration" )
@strawberry.schema_directive ( locations =[Location.FIELD_DEFINITION])
class Sensitive :
config: SensitiveConfiguration
@strawberry.type
class Query :
first_name: str = strawberry.field( directives =[Sensitive( config = "Some config" )])
prints the following:
directive @sensitive ( config : SensitiveConfiguration !) on FIELD_DEFINITION
type Query {
firstName : String ! @sensitive ( config : "Some config" )
}
scalar SensitiveConfiguration
while previously it would omit the definition of the scalar.
Contributed by Patrick Arminio via PR #2058
This PR adds support for adding schema directives to the schema of your GraphQL API. For printing the following schema:
This PR adds support for adding schema directives to the schema of your GraphQL API. For printing the following schema:
@strawberry.schema_directive ( locations =[Location.SCHEMA])
class Tag :
name: str
@strawberry.type
class Query :
first_name: str = strawberry.field( directives =[Tag( name = "team-1" )])
schema = strawberry.Schema( query =Query, schema_directives =[Tag( name = "team-1" )])
will print the following:
directive @tag ( name : String !) on SCHEMA
schema @tag ( name : "team-1" ) {
query : Query
}
type Query {
firstName : String !
}
"""
Contributed by Patrick Arminio via PR #2054
This release fixes that the AIOHTTP integration ignored the operationName of query operations. This behaviour is a regression introduced in version 0.
This release fixes that the AIOHTTP integration ignored the operationName of query operations. This behaviour is a regression introduced in version 0.107.0.
Contributed by Jonathan Ehwald via PR #2055
This release adds support for printing default values for scalars like JSON.
This release adds support for printing default values for scalars like JSON.
For example the following:
import strawberry
from strawberry.scalars import JSON
@strawberry.input
class MyInput :
j: JSON = strawberry.field( default_factory = dict )
j2: JSON = strawberry.field( default_factory = lambda : { "hello" : "world" })
will print the following schema:
input MyInput {
j : JSON ! = {}
j2 : JSON ! = { hello : "world" }
}
Contributed by Patrick Arminio via PR #2048
This release adds a backward compatibility layer with libraries that specify a custom get_result .
This release adds a backward compatibility layer with libraries that specify a custom get_result .
Contributed by Patrick Arminio via PR #2038
Nothing published for this version
This release adds support for overriding the default resolver for fields.
This release adds support for overriding the default resolver for fields.
Currently the default resolver is getattr , but now you can change it to any function you like, for example you can allow returning dictionaries:
@strawberry.type
class User :
name: str
@strawberry.type
class Query :
@strawberry.field
def user ( self ) -> User:
return { "name" : "Patrick" } # type: ignore
schema = strawberry.Schema(
query =Query,
config =StrawberryConfig( default_resolver =getitem),
)
query = "{ user { name } }"
result = schema.execute_sync(query)
Contributed by Patrick Arminio via PR #2037
This release add a new DatadogTracingExtension that can be used to instrument your application with Datadog.
This release add a new DatadogTracingExtension that can be used to instrument your application with Datadog.
import strawberry
from strawberry.extensions.tracing import DatadogTracingExtension
schema = strawberry.Schema(
Query,
extensions =[
DatadogTracingExtension,
],
)
Contributed by Patrick Arminio via PR #2001
Nothing published for this version
Nothing published for this version
Fixed edge case where Union types raised an UnallowedReturnTypeForUnion error when returning the correct type from the resolver. This also improves pe
Fixed edge case where Union types raised an UnallowedReturnTypeForUnion error when returning the correct type from the resolver. This also improves performance of StrawberryUnion’s _resolve_union_type from O(n) to O(1) in the majority of cases where n is the number of types in the schema.
For example the below ) would previously raise the error when querying two as StrawberryUnion would incorrectly determine that the resolver returns Container[TypeOne] .
import strawberry
from typing import TypeVar, Generic, Union, List, Type
T = TypeVar( "T" )
@strawberry.type
class Container (Generic[T]):
items: List[T]
@strawberry.type
class TypeOne :
attr: str
@strawberry.type
class TypeTwo :
attr: str
def resolver_one ():
return Container( items =[TypeOne( "one" )])
def resolver_two ():
return Container( items =[TypeTwo( "two" )])
@strawberry.type
class Query :
one: Union[Container[TypeOne], TypeOne] = strawberry.field(resolver_one)
two: Union[Container[TypeTwo], TypeTwo] = strawberry.field(resolver_two)
schema = strawberry.Schema( query =Query)
Contributed by Tim OSullivan via PR #2029
An explanatory custom exception is raised when union of GraphQL input types is attempted.
An explanatory custom exception is raised when union of GraphQL input types is attempted.
Contributed by Dhanshree Arora via PR #2019
This release changes when we add the custom directives extension, previously the extension was always enabled, now it is only enabled if you pass cust
This release changes when we add the custom directives extension, previously the extension was always enabled, now it is only enabled if you pass custom directives to strawberry.Schema .
Contributed by bomtall via PR #2020
Nothing published for this version
This release adds an initial fix to make strawberry.auto work when using from __future__ import annotations .
This release adds an initial fix to make strawberry.auto work when using from future import annotations .
Contributed by Patrick Arminio via PR #1994
Nothing published for this version
Fixes issue where users without pydantic were not able to use the mypy plugin.
Fixes issue where users without pydantic were not able to use the mypy plugin.
Contributed by James Chua via PR #2016
Nothing published for this version
You can now pass keyword arguments to to_pydantic
You can now pass keyword arguments to to_pydantic
from pydantic import BaseModel
import strawberry
class MyModel ( BaseModel ):
email: str
password: str
@strawberry.experimental.pydantic.input ( model =MyModel)
class MyModelStrawberry :
email: strawberry.auto
MyModelStrawberry( email = "" ).to_pydantic( password = "hunter" )
Also if you forget to pass password, mypy will complain
MyModelStrawberry( email = "" ).to_pydantic()
Contributed by James Chua via PR #2012
Nothing published for this version
Allow to add alias to fields generated from pydantic with strawberry.field(name="ageAlias") .
Allow to add alias to fields generated from pydantic with strawberry.field(name="ageAlias") .
class User(pydantic.BaseModel):
age: int
@strawberry.experimental.pydantic.type(User)
class UserType:
age: strawberry.auto = strawberry.field(name="ageAlias")
Contributed by Alex via PR #1986
This release fixes an issue that required installing opentelemetry when trying to use the ApolloTracing extension
This release fixes an issue that required installing opentelemetry when trying to use the ApolloTracing extension
Contributed by Patrick Arminio via PR #1977
Nothing published for this version
Fix regression caused by the new resolver argument handling mechanism introduced in v0.115.0. This release restores the ability to use unhashable defa
Fix regression caused by the new resolver argument handling mechanism introduced in v0.115.0. This release restores the ability to use unhashable default values in resolvers such as dict and list. See example below:
@strawberry.type
class Query :
@strawberry.field
def field ( self , x : List[ str ] = [ "foo" ], y : JSON = { "foo" : 42 }) -> str : # noqa: B006
return f " { x } { y } "
Thanks to @coady for the regression report!
Contributed by San Kilkis via PR #1985
This release fixes the following error when trying to use Strawberry with Apollo Federation:
This release fixes the following error when trying to use Strawberry with Apollo Federation:
Error: A valid schema couldn't be composed. The following composition errors were found:
[burro-api] Unknown type _FieldSet
Contributed by Patrick Arminio via PR #1988
Reimplement StrawberryResolver.annotations property after removal in v0.115.
Reimplement StrawberryResolver.annotations property after removal in v0.115.
Library authors who previously relied on the public annotations property can continue to do so after this fix.
Contributed by San Kilkis via PR #1990
Nothing published for this version
Nothing published for this version
This release fixes a breaking internal error in mypy plugin for the following case.
This release fixes a breaking internal error in mypy plugin for the following case.
failed: str = strawberry.field(resolver)
successed: str = strawberry.field( resolver =resolver)
now mypy returns an error with "field()" or "mutation()" only takes keyword arguments message rather than an internal error.
Contributed by cake-monotone via PR #1987
This release adds a link from generated GraphQLCore types to the Strawberry type that generated them.
This release adds a link from generated GraphQLCore types to the Strawberry type that generated them.
From a GraphQLCore type you can now access the Strawberry type by doing:
strawberry_type: TypeDefinition = graphql_core_type.extensions[
GraphQLCoreConverter.DEFINITION_BACKREF
]
Contributed by Paulo Costa via PR #1766
Note: the old way of passing arguments by name is deprecated and will be removed in future releases of Strawberry.
This release changes how we declare the info argument in resolvers and the value argument in directives.
Previously we’d use the name of the argument to determine its value. Now we use the type annotation of the argument to determine its value.
Here’s an example of how the old syntax works:
def some_resolver ( info ) -> str :
return info.context.get( "some_key" , "default" )
@strawberry.type
class Example :
a_field: str = strawberry.resolver(some_resolver)
and here’s an example of how the new syntax works:
from strawberry.types import Info
def some_resolver ( info : strawberry.Info) -> str :
return info.context.get( "some_key" , "default" )
@strawberry.type
class Example :
a_field: str = strawberry.resolver(some_resolver)
This means that you can now use a different name for the info argument in your resolver and the value argument in your directive.
Here’s an example that uses a custom name for both the value and the info parameter in directives:
from strawberry.types import Info
from strawberry.directive import DirectiveLocation, DirectiveValue
@strawberry.type
class Cake :
frosting: Optional[ str ] = None
flavor: str = "Chocolate"
@strawberry.type
class Query :
@strawberry.field
def cake ( self ) -> Cake:
return Cake()
@strawberry.directive (
locations =[DirectiveLocation.FIELD],
description = "Add frosting with value to a cake." ,
)
def add_frosting ( value : str , v : DirectiveValue[Cake], my_info : strawberry.Info):
DirectiveValue is supported!assert isinstance (v, Cake)
if (
value in my_info.context[ "allergies" ]
): # Info can now be accessed from directives!
raise AllergyError( "You are allergic to this frosting!" )
else :
v.frosting = value # Value can now be used as a GraphQL argument name!
return v
Note: the old way of passing arguments by name is deprecated and will be removed in future releases of Strawberry.
Contributed by San Kilkis via PR #1713
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.