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 adds support for asynchronous hooks to the Strawberry extension-system. All available hooks can now be implemented either synchronously o
This release adds support for asynchronous hooks to the Strawberry extension-system. All available hooks can now be implemented either synchronously or asynchronously.
It’s also possible to mix both synchronous and asynchronous hooks within one extension.
from strawberry.extensions import Extension
class MyExtension ( Extension ):
async def on_request_start ( self ):
print ( "GraphQL request start" )
def on_request_end ( self ):
print ( "GraphQL request end" )
Contributed by Jonathan Ehwald PR #1142
This release refactors the reload feature of the built-in debug server. The refactor made the debug server more responsive and allowed us to remove hu
This release refactors the reload feature of the built-in debug server. The refactor made the debug server more responsive and allowed us to remove hupper from the dependencies.
Contributed by Jonathan Ehwald PR #1114
Your coding agent can read these notes before it upgrades. Set up the MCP server →
This releases pins graphql-core to only accept patch versions in order to prevent breaking changes since graphql-core doesn’t properly follow semantic…
This releases pins graphql-core to only accept patch versions in order to prevent breaking changes since graphql-core doesn’t properly follow semantic versioning.
Contributed by Jonathan Kim PR #1162
This release improves the default logging format for errors to include more information about the errors. For example it will show were an error was o
This release improves the default logging format for errors to include more information about the errors. For example it will show were an error was originated in a request:
GraphQL request:2:5
1 | query {
2 | example
| ^
3 | }
Contributed by Ivan Gonzalez PR #1152
This release adds support for asynchronous permission classes. The only difference to their synchronous counterpart is that the has_permission method
This release adds support for asynchronous permission classes. The only difference to their synchronous counterpart is that the has_permission method is asynchronous.
from strawberry.permission import BasePermission
class IsAuthenticated ( BasePermission ):
message = "User is not authenticated"
async def has_permission ( self , source , info , ** kwargs ):
return True
Contributed by Jonathan Ehwald PR #1125
Get a field resolver correctly when extending from a pydantic model
Get a field resolver correctly when extending from a pydantic model
Contributed by Jonathan Kim PR #1116
This release adds asgi as an extra dependencies group for Strawberry. Now you can install the required dependencies needed to use Strawberry with ASGI
This release adds asgi as an extra dependencies group for Strawberry. Now you can install the required dependencies needed to use Strawberry with ASGI by running:
pip install 'strawberry-graphql[asgi]'
Contributed by A. Coady PR #1036
This releases adds selected_fields on the info objects and it allows to introspect the fields that have been selected in a GraphQL operation.
This releases adds selected_fields on the info objects and it allows to introspect the fields that have been selected in a GraphQL operation.
This can become useful to run optimisation based on the queried fields.
Contributed by A. Coady PR #874
This release adds a query depth limit validation rule so that you can guard against malicious queries:
This release adds a query depth limit validation rule so that you can guard against malicious queries:
import strawberry
from strawberry.schema import default_validation_rules
from strawberry.tools import depth_limit_validator
validation_rules = default_validation_rules + [depth_limit_validator( 3 )]
result = schema.execute_sync(
"""
query MyQuery {
user {
pets {
owner {
pets {
name
}
}
}
}
}
""" ,
validation_rules =validation_rules,
)
assert len (result.errors) == 1
assert result.errors[ 0 ].message == "'MyQuery' exceeds maximum operation depth of 3"
Contributed by Jonathan Kim PR #1021
Addition of app.add_websocket_route("/subscriptions", graphql_app) to FastAPI example docs
Addition of app.add_websocket_route("/subscriptions", graphql_app) to FastAPI example docs
Contributed by Anton Melser PR #1103
This release changes how we map Pydantic fields to types to allow using older version of Pydantic.
This release changes how we map Pydantic fields to types to allow using older version of Pydantic.
Contributed by Patrick Arminio PR #1071
This release makes the strawberry server command inform the user about missing dependencies required by the builtin debug server.
This release makes the strawberry server command inform the user about missing dependencies required by the builtin debug server.
Also hupper a package only used by said command has been made optional.
Contributed by Jonathan Ehwald PR #1107
Switch CDN used to load GraphQLi dependencies from jsdelivr.com to unpkg.com
Switch CDN used to load GraphQLi dependencies from jsdelivr.com to unpkg.com
Contributed by Tim Savage PR #1096
This release adds support for disabling auto camel casing. It does so by introducing a new configuration parameter to the schema.
This release adds support for disabling auto camel casing. It does so by introducing a new configuration parameter to the schema.
You can use it like so:
@strawberry.type
class Query :
example_field: str = "Example"
schema = strawberry.Schema( query =Query, config =StrawberryConfig( auto_camel_case = False ))
Contributed by Patrick Arminio PR #798
Fix for regression when defining inherited types with explicit fields.
Fix for regression when defining inherited types with explicit fields.
Contributed by A. Coady PR #1076
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
This is a continuation of the previous release and fixes for type checking issues.
Contributed by Patrick Arminio PR #1078
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
This releases improves the MyPy plugin to be more forgiving of settings like follow_imports = skip which would break the type checking.
Contributed by Patrick Arminio PR #1077
This release removes a TypeGuard import to prevent errors when using older versions of typing_extensions .
This release removes a TypeGuard import to prevent errors when using older versions of typing_extensions .
Contributed by Patrick Arminio PR #1074
This is a breaking change if you were calling the constructor for StrawberryField , StrawberryArgument , etc. and using arguments such as is_optional…
Refactor of the library’s typing internals. Previously, typing was handled individually by fields, arguments, and objects with a hodgepodge of functions to tie it together. This change creates a unified typing system that the object, fields, and arguments each hook into.
Mainly replaces the attributes that were stored on StrawberryArgument and StrawberryField with a hierarchy of StrawberryTypes.
Introduces StrawberryAnnotation , as well as StrawberryType and some subclasses, including StrawberryList , StrawberryOptional , and StrawberryTypeVar .
This is a breaking change if you were calling the constructor for StrawberryField , StrawberryArgument , etc. and using arguments such as is_optional or child .
@strawberry.field no longer takes an argument called type_ . It instead takes a StrawberryAnnotation called type_annotation .
Contributed by ignormies PR #906
This release fixes an issue with the federation printer that prevented using federation directives with types that were implementing interfaces.
This release fixes an issue with the federation printer that prevented using federation directives with types that were implementing interfaces.
This is now allowed:
@strawberry.interface
class SomeInterface :
id : strawberry.ID
@strawberry.federation.type ( keys =[ "upc" ], extend = True )
class Product ( SomeInterface ):
upc: str = strawberry.federation.field( external = True )
Contributed by Patrick Arminio PR #1068
This release changes our graphiql.html template to use a specific version of js-cookie to prevent a JavaScript error, see:
This release changes our graphiql.html template to use a specific version of js-cookie to prevent a JavaScript error, see:
https://github.com/js-cookie/js-cookie/issues/698
Contributed by 星 PR #1062
This release fixes a regression that broke strawberry-graphql-django.
This release fixes a regression that broke strawberry-graphql-django.
Field.get_results now always receives the info argument.
Contributed by Lauri Hintsala PR #1047
This release only changes some internal code to make future improvements easier.
This release only changes some internal code to make future improvements easier.
Contributed by Patrick Arminio PR #1044
Matching the behaviour of graphql-core , passing an incorrect ISO string value for a Time, Date or DateTime scalar now raises a GraphQLError instead o
Matching the behaviour of graphql-core , passing an incorrect ISO string value for a Time, Date or DateTime scalar now raises a GraphQLError instead of the original parsing error.
The GraphQLError will include the error message raised by the string parser, e.g. Value cannot represent a DateTime: "2021-13-01T09:00:00". month must be in 1..12
Fixes #1022 by making starlette an optional dependency.
Fixes #1022 by making starlette an optional dependency.
Contributed by Marcel Wiegand PR #1027
Add ability to specific the graphql name for a resolver argument. E.g.,
Add ability to specific the graphql name for a resolver argument. E.g.,
from typing import Annotated
import strawberry
@strawberry.input
class HelloInput :
name: str = "world"
@strawberry.type
class Query :
@strawberry.field
def hello (
self , input_ : Annotated[HelloInput, strawberry.argument( name = "input" )]
) -> str :
return f "Hi { input_.name } "
Contributed by Daniel Bowring PR #1024
This release fixes a bug that was preventing the use of an enum member as the default value for an argument.
This release fixes a bug that was preventing the use of an enum member as the default value for an argument.
For example:
@strawberry.enum
class IceCreamFlavour ( Enum ):
VANILLA = "vanilla"
STRAWBERRY = "strawberry"
CHOCOLATE = "chocolate"
PISTACHIO = "pistachio"
@strawberry.mutation
def create_flavour ( self , flavour : IceCreamFlavour = IceCreamFlavour.STRAWBERRY) -> str :
return f " { flavour.name } "
Contributed by Jonathan Kim PR #1015
This release reverts the changes made in v0.65.4 that caused an issue leading to circular imports when using the strawberry-graphql-django extension p
This release reverts the changes made in v0.65.4 that caused an issue leading to circular imports when using the strawberry-graphql-django extension package.
Contributed by Lauri Hintsala PR #1019
This release fixes the IDE integration where package strawberry.django could not be find by some editors like vscode.
This release fixes the IDE integration where package strawberry.django could not be find by some editors like vscode.
Contributed by Lauri Hintsala PR #994
This release fixes the ASGI subscription implementation by handling disconnecting clients properly.
This release fixes the ASGI subscription implementation by handling disconnecting clients properly.
Additionally, the ASGI implementation has been internally refactored to match the AIOHTTP implementation.
Contributed by Jonathan Ehwald PR #1002
This release fixes a bug in the subscription implementations that prevented clients from selecting one of multiple subscription operations from a quer
This release fixes a bug in the subscription implementations that prevented clients from selecting one of multiple subscription operations from a query. Client sent messages like the following one are now handled as expected.
{
"type" : "GQL_START" ,
"id" : "DEMO" ,
"payload" : {
"query" : "subscription Sub1 { sub1 } subscription Sub2 { sub2 }" ,
"operationName" : "Sub2"
}
}
Contributed by Jonathan Ehwald PR #1000
This release fixes the upload of nested file lists. Among other use cases, having an input type like shown below is now working properly.
This release fixes the upload of nested file lists. Among other use cases, having an input type like shown below is now working properly.
import typing
import strawberry
from strawberry.file_uploads import Upload
@strawberry.input
class FolderInput :
files: typing.List[Upload]
Contributed by Jonathan Ehwald PR #989
This release extends the file upload support of all integrations to support the upload of file lists.
This release extends the file upload support of all integrations to support the upload of file lists.
Here is an example how this would work with the ASGI integration.
import typing
import strawberry
from strawberry.file_uploads import Upload
@strawberry.type
class Mutation :
@strawberry.mutation
async def read_files ( self , files : typing.List[Upload]) -> typing.List[ str ]:
contents = []
for file in files:
content = ( await file.read()).decode()
contents.append(content)
return contents
Check out the documentation to learn how the same can be done with other integrations.
Contributed by Jonathan Ehwald PR #979
This release fixes that AIOHTTP subscription requests were not properly separated. This could lead to subscriptions terminating each other.
This release fixes that AIOHTTP subscription requests were not properly separated. This could lead to subscriptions terminating each other.
Contributed by Jonathan Ehwald PR #970
Remove usages of undefined in favour of UNSET
Remove usages of undefined in favour of UNSET
Change the signature of StrawberryField to make it easier to instantiate directly. Also change default_value argument to default
Rename default_value to default in StrawberryArgument
Contributed by Jonathan Kim PR #916
This release integrates the strawberry-graphql-django package into Strawberry core so that it’s possible to use the Django extension package directly
This release integrates the strawberry-graphql-django package into Strawberry core so that it’s possible to use the Django extension package directly via the strawberry.django namespace.
You still need to install strawberry-graphql-django if you want to use the extended Django support.
See: https://github.com/strawberry-graphql/strawberry-graphql-django
Contributed by Lauri Hintsala PR #949
This release fixes that enum values yielded from async generators were not resolved properly.
This release fixes that enum values yielded from async generators were not resolved properly.
Contributed by Jonathan Ehwald PR #969
This release fixes a max recursion depth error in the AIOHTTP subscription implementation.
This release fixes a max recursion depth error in the AIOHTTP subscription implementation.
Contributed by Jonathan Ehwald PR #966
This release adds an extensions field to the GraphQLHTTPResponse type and also exposes it in the view’s response.
This release adds an extensions field to the GraphQLHTTPResponse type and also exposes it in the view’s response.
This field gets populated by Strawberry extensions: https://strawberry.rocks/docs/guides/extensions#get-results
Contributed by lijok PR #903
Add root_value to ExecutionContext type so that it can be accessed in extensions.
Add root_value to ExecutionContext type so that it can be accessed in extensions.
Example:
import strawberry
from strawberry.extensions import Extension
class MyExtension ( Extension ):
def on_request_end ( self ):
root_value = self .execution_context.root_value
Contributed by Jonathan Kim PR #959
New deployment process to release new Strawberry releases
New deployment process to release new Strawberry releases
Marco Acierno PR #957
This release adds extra values to the ExecutionContext object so that it can be used by extensions and the Schema.process_errors function.
This release adds extra values to the ExecutionContext object so that it can be used by extensions and the Schema.process_errors function.
The full ExecutionContext object now looks like this:
from graphql import ExecutionResult as GraphQLExecutionResult
from graphql.error.graphql_error import GraphQLError
from graphql.language import DocumentNode as GraphQLDocumentNode
@dataclasses.dataclass
class ExecutionContext :
query: str
context: Any = None
variables: Optional[Dict[ str , Any]] = None
operation_name: Optional[ str ] = None
graphql_document: Optional[GraphQLDocumentNode] = None
errors: Optional[List[GraphQLError]] = None
result: Optional[GraphQLExecutionResult] = None
and can be accessed in any of the extension hooks:
from strawberry.extensions import Extension
class MyExtension ( Extension ):
def on_request_end ( self ):
result = self .execution_context.result
schema = strawberry.Schema( query =Query, extensions =[MyExtension])
Note: This release also removes the creation of an ExecutionContext object in the web framework views. If you were relying on overriding the get_execution_context function then you should change it to get_request_data and use the strawberry.http.parse_request_data function to extract the pieces of data needed from the incoming request.
This releases fixes an issue with the debug server that prevented the usage of dataloaders, see: https://github.com/strawberry-graphql/strawberry/issu
This releases fixes an issue with the debug server that prevented the usage of dataloaders, see: https://github.com/strawberry-graphql/strawberry/issues/940
This release adds support for GraphQL subscriptions to the AIOHTTP integration. Subscription support works out of the box and does not require any add
This release adds support for GraphQL subscriptions to the AIOHTTP integration. Subscription support works out of the box and does not require any additional configuration.
Here is an example how to get started with subscriptions in general. Note that by specification GraphQL schemas must always define a query, even if only subscriptions are used.
import asyncio
import typing
import strawberry
@strawberry.type
class Subscription :
@strawberry.subscription
async def count ( self , target : int = 100 ) -> typing.AsyncGenerator[ int , None ]:
for i in range (target):
yield i
await asyncio.sleep( 0.5 )
@strawberry.type
class Query :
@strawberry.field
def _unused ( self ) -> str :
return ""
schema = strawberry.Schema( subscription =Subscription, query =Query)
Fix @requires(fields: ["email"]) and @provides(fields: ["name"]) usage on a Federation field
Fix @requires(fields: ["email"]) and @provides(fields: ["name"]) usage on a Federation field
You can use @requires to specify which fields you need to resolve a field
import strawberry
@strawberry.federation.type ( keys =[ "id" ], extend = True )
class Product :
id : strawberry.ID = strawberry.federation.field( external = True )
code: str = strawberry.federation.field( external = True )
@ classmethod
def resolve_reference ( cls , id : strawberry.ID, code : str ):
return cls ( id = id , code =code)
@strawberry.federation.field ( requires =[ "code" ])
def my_code ( self ) -> str :
return self .code
@provides can be used to specify what fields are going to be resolved by the service itself without having the Gateway to contact the external service to resolve them.
This release adds support for the info param in resolve_reference:
This release adds support for the info param in resolve_reference:
@strawberry.federation.type ( keys =[ "upc" ])
class Product :
upc: str
info: str
@ classmethod
def resolve_reference ( cls , info , upc ):
return Product(upc, info)
Note: resolver reference is used when using Federation, similar to Apollo server’s __resolveReference
This release extends the strawberry server command to allow the specification of a schema symbol name within a module:
This release extends the strawberry server command to allow the specification of a schema symbol name within a module:
Terminal window
strawberry server mypackage.mymodule:myschema
The schema symbol name defaults to schema making this change backwards compatible.
This release adds file upload support to the Sanic integration. No additional configuration is required to enable file upload support.
This release adds file upload support to the Sanic integration. No additional configuration is required to enable file upload support.
The following example shows how a file upload based mutation could look like:
import strawberry
from strawberry.file_uploads import Upload
@strawberry.type
class Mutation :
@strawberry.mutation
def read_text ( self , text_file : Upload) -> str :
return text_file.read().decode()
This release adds an export-schema command to the Strawberry CLI. Using the command you can print your schema definition to your console. Pipes and re
This release adds an export-schema command to the Strawberry CLI. Using the command you can print your schema definition to your console. Pipes and redirection can be used to store the schema in a file.
Example usage:
Terminal window
strawberry export-schema mypackage.mymodule:myschema > schema.graphql
This release fixes an issue that prevented using source as name of an argument
This release fixes an issue that prevented using source as name of an argument
This release adds an aiohttp integration for Strawberry. The integration provides a GraphQLView class which can be used to integrate Strawberry with a
This release adds an aiohttp integration for Strawberry. The integration provides a GraphQLView class which can be used to integrate Strawberry with aiohttp:
import strawberry
from aiohttp import web
from strawberry.aiohttp.views import GraphQLView
@strawberry.type
class Query :
pass
schema = strawberry.Schema( query =Query)
app = web.Application()
app.router.add_route( "*" , "/graphql" , GraphQLView( schema =schema))
This release adds a function called create_type to create a Strawberry type from a list of fields.
This release adds a function called create_type to create a Strawberry type from a list of fields.
import strawberry
from strawberry.tools import create_type
@strawberry.field
def hello ( info ) -> str :
return "World"
def get_name ( info ) -> str :
return info.context.user.name
my_name = strawberry.field( name = "myName" , resolver =get_name)
Query = create_type( "Query" , [hello, my_name])
schema = strawberry.Schema( query =Query)
This release fixes an issue when using nested lists, this now works properly:
This release fixes an issue when using nested lists, this now works properly:
def get_polygons () -> List[List[ float ]]:
return [[ 2.0 , 6.0 ]]
@strawberry.type
class Query :
polygons: List[List[ float ]] = strawberry.field( resolver =get_polygons)
schema = strawberry.Schema( query =Query)
query = "{ polygons }"
result = schema.execute_sync(query, root_value =Query())
This release fixes support for generic types so that now we can also use generics for input types:
This release fixes support for generic types so that now we can also use generics for input types:
T = typing.TypeVar( "T" )
@strawberry.input
class Input ( typing .Generic[T]):
field: T
@strawberry.type
class Query :
@strawberry.field
def field ( self , input : Input[ str ]) -> str :
return input .field
This release fixes a bug that prevented from extending a generic type when passing a type, like here:
This release fixes a bug that prevented from extending a generic type when passing a type, like here:
T = typing.TypeVar( "T" )
@strawberry.interface
class Node ( typing .Generic[T]):
id : strawberry.ID
def _resolve ( self ) -> typing.Optional[T]:
return None
@strawberry.type
class Book (Node[ str ]):
name: str
@strawberry.type
class Query :
@strawberry.field
def books ( self ) -> typing.List[Book]:
return list ()
Fix converting pydantic objects to strawberry types using from_pydantic when having a falsy value like 0 or ”.
Fix converting pydantic objects to strawberry types using from_pydantic when having a falsy value like 0 or ”.
Add a process_errors method to strawberry.Schema which logs all exceptions during execution to a strawberry.execution logger.
Add a process_errors method to strawberry.Schema which logs all exceptions during execution to a strawberry.execution logger.
This release fixes the return type value from info argument of resolver.
This release fixes the return type value from info argument of resolver.
This release improves Pydantic support to support default values and factories.
This release improves Pydantic support to support default values and factories.
This release fixes the pydantic integration where you couldn’t convert objects to pydantic instance when they didn’t have a default value.
This release fixes the pydantic integration where you couldn’t convert objects to pydantic instance when they didn’t have a default value.
One column per quarter.