NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #1573 most downloaded on PyPI
A library for creating GraphQL APIs
Last release today
04 Oct 2026
Ships fairly regularly
a new release about every 3 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
1125 releases · first in 2019
This release fixes a bug in the codegen that marked optional unions as non optional.
This release fixes a bug in the codegen that marked optional unions as non optional.
Contributed by Patrick Arminio via PR #1806
This release adds support for passing json_encoder and json_dumps_params to Sanic’s view.
This release adds support for passing json_encoder and json_dumps_params to Sanic’s view.
from strawberry.sanic.views import GraphQLView
from api.schema import Schema
app = Sanic( name )
app.add_route(
GraphQLView.as_view(
schema =schema,
graphiql = True ,
json_encoder =CustomEncoder,
json_dumps_params ={},
),
"/graphql" ,
)
Contributed by Patrick Arminio via PR #1797
One column per quarter.
Allow use of AsyncIterator and AsyncIterable generics to annotate return type of subscription resolvers.
Allow use of AsyncIterator and AsyncIterable generics to annotate return type of subscription resolvers.
Contributed by San Kilkis via PR #1771
Exeptions from handler functions in graphql_transport_ws are no longer incorrectly caught and classified as message parsing errors.
Exeptions from handler functions in graphql_transport_ws are no longer incorrectly caught and classified as message parsing errors.
Contributed by Kristján Valur Jónsson via PR #1761
Contributed by Guillaume Andreu Sabater via PR #1787
Drop support for Django < 3.2.
Contributed by Guillaume Andreu Sabater via PR #1787
This release adds support for aliased fields when doing codegen.
This release adds support for aliased fields when doing codegen.
Contributed by Patrick Arminio via PR #1772
Add is_auto utility for checking if a type is strawberry.auto , considering the possibility of it being a StrawberryAnnotation or even being used insi
Add is_auto utility for checking if a type is strawberry.auto , considering the possibility of it being a StrawberryAnnotation or even being used inside Annotated .
Contributed by Thiago Bellini Ribeiro via PR #1721
This release moves the console plugin for the codegen command to be last one, allowing to run code before writing files to disk.
This release moves the console plugin for the codegen command to be last one, allowing to run code before writing files to disk.
Contributed by Patrick Arminio via PR #1760
This release adds a python_type to the codegen GraphQLEnum class to allow access to the original python enum when generating code
This release adds a python_type to the codegen GraphQLEnum class to allow access to the original python enum when generating code
Contributed by Patrick Arminio via PR #1752
Fix an issue where there was no clean way to mark a Pydantic field as deprecated, add permission classes, or add directives. Now you can use the short…
Fix an issue where there was no clean way to mark a Pydantic field as deprecated, add permission classes, or add directives. Now you can use the short field syntax to do all three.
import pydantic
import strawberry
class MyModel ( pydantic . BaseModel ):
age: int
name: str
@strawberry.experimental.pydantic.type (MyModel)
class MyType :
age: strawberry.auto
name: strawberry.auto = strawberry.field(
deprecation_reason = "Because" ,
permission_classes =[MyPermission],
directives =[MyDirective],
)
Contributed by Matt Allen via PR #1748
This release adds a missing __init__.py inside cli/commands
This release adds a missing init.py inside cli/commands
Contributed by Patrick Arminio via PR #1751
This release fixes an issue that prevented using generic types with interfaces.
This release fixes an issue that prevented using generic types with interfaces.
Contributed by Patrick Arminio via PR #1701
This release fixes a couple of more issues with codegen:
This release fixes a couple of more issues with codegen:
Adds support for boolean values in input fields
Changes how we unwrap types in order to add full support for LazyTypes, Optionals and Lists
Improve also how we generate types for unions, now we don’t generate a Union type if the selection is for only one type
Contributed by Patrick Arminio via PR #1746
The return type annotation for DataLoader.load and load_many no longer includes any exceptions directly returned by the load_fn . The ability to handl
The return type annotation for DataLoader.load and load_many no longer includes any exceptions directly returned by the load_fn . The ability to handle errors by returning them as elements from load_fn is now documented too.
Contributed by Huon Wilson via PR #1737
Nothing published for this version
Nothing published for this version
This release add supports for LazyType s in the codegen command
This release add supports for LazyType s in the codegen command
Contributed by Patrick Arminio via PR #1745
This release adds support for MyPy 0.941 under Python 3.10
This release adds support for MyPy 0.941 under Python 3.10
Contributed by dependabot via PR #1728
This release adds an experimental codegen feature for queries. It allows to combine a graphql query and Strawberry schema to generate Python types or
This release adds an experimental codegen feature for queries. It allows to combine a graphql query and Strawberry schema to generate Python types or TypeScript types.
You can use the following command:
Terminal window
strawberry codegen --schema schema --output-dir ./output -p python query.graphql
to generate python types that correspond to your GraphQL query.
Contributed by Patrick Arminio via PR #1655
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 makes StrawberryOptional and StrawberryList hashable, allowing to use strawberry types with libraries like dacite and dataclasses_json.
This release makes StrawberryOptional and StrawberryList hashable, allowing to use strawberry types with libraries like dacite and dataclasses_json.
Contributed by Patrick Arminio via PR #1726
Add support for postponed evaluation of annotations ( PEP-563 ) to strawberry.Private annotated fields.
Add support for postponed evaluation of annotations ( PEP-563 ) to strawberry.Private annotated fields.
This PR improves the support for scalars when using MyPy.
This PR improves the support for scalars when using MyPy.
Contributed by Patrick Arminio via PR #1205
Added the response object to get_context on the flask view. This means that in fields, something like this can be used;
Added the response object to get_context on the flask view. This means that in fields, something like this can be used;
@strawberry.field
def response_check ( self , info : strawberry.Info) -> bool :
response: Response = info.context[ "response" ]
response.status_code = 401
return True
This release adds support for graphql-transport-ws single result operations.
This release adds support for graphql-transport-ws single result operations.
Single result operations allow clients to execute queries and mutations over an existing WebSocket connection.
Contributed by Jonathan Ehwald PR #1698
Change strawberry.auto to be a type instead of a sentinel. This not only removes the dependency on sentinel from the project, but also fixes some rela
Change strawberry.auto to be a type instead of a sentinel. This not only removes the dependency on sentinel from the project, but also fixes some related issues, like the fact that only types can be used with Annotated .
Also, custom scalars will now trick static type checkers into thinking they returned their wrapped type. This should fix issues with pyright 1.1.224+ where it doesn’t allow non-type objects to be used as annotations for dataclasses and dataclass-alike classes (which is strawberry’s case). The change to strawberry.auto also fixes this issue for it.
Contributed by Thiago Bellini Ribeiro PR #1690
This release adds support for flask 2.x and also relaxes the requirements for Django, allowing to install newer version of Django without having to wa
This release adds support for flask 2.x and also relaxes the requirements for Django, allowing to install newer version of Django without having to wait for Strawberry to update its supported dependencies list.
Contributed by Guillaume Andreu Sabater PR #1687
This fixes the schema printer to add support for schema directives on input types.
This fixes the schema printer to add support for schema directives on input types.
Contributed by Patrick Arminio PR #1697
This release fixed a false positive deprecation warning related to our AIOHTTP class based view.
This release fixed a false positive deprecation warning related to our AIOHTTP class based view.
Contributed by Jonathan Ehwald PR #1691
This release adds the following scalar types:
This release adds the following scalar types:
JSON
Base16
Base32
Base64
they can be used like so:
from strawberry.scalar import Base16, Base32, Base64, JSON
@strawberry.type
class Example :
a: Base16
b: Base32
c: Base64
d: JSON
Contributed by Paulo Costa PR #1647
Adds support for converting pydantic conlist. Note that constraint is not enforced in the graphql type. Thus, we recommend always working on the pydan
Adds support for converting pydantic conlist. Note that constraint is not enforced in the graphql type. Thus, we recommend always working on the pydantic type such that the validation is enforced.
import strawberry
from pydantic import BaseModel, conlist
class Example ( BaseModel ):
friends: conlist( str , min_items = 1 )
@strawberry.experimental.pydantic.input ( model =Example, all_fields = True )
class ExampleGQL : ...
@strawberry.type
class Query :
@strawberry.field ()
def test ( self , example : ExampleGQL) -> None :
print (example.friends)
print (example.to_pydantic().friends)
schema = strawberry.Schema( query =Query)
The converted graphql type is
input ExampleGQL {
friends: [String!]!
}
Contributed by James Chua PR #1656
Make sure you take a look at graphql-core ’s release notes for any potential breaking change that might affect you if you’re importing things from the…
This release updates graphql-core to 3.2.0
Make sure you take a look at graphql-core ’s release notes for any potential breaking change that might affect you if you’re importing things from the graphql package directly.
Contributed by Patrick Arminio PR #1601
It is now possible to have a resolver that returns “None”. Strawberry will automatically assign the new Void scalar in the schema and will always send
Support “void” functions
It is now possible to have a resolver that returns “None”. Strawberry will automatically assign the new Void scalar in the schema and will always send null in the response
Add better support for custom Pydantic conversion logic and standardize the behavior when not using strawberry.auto as the type.
Add better support for custom Pydantic conversion logic and standardize the behavior when not using strawberry.auto as the type.
See https://strawberry.rocks/docs/integrations/pydantic#custom-conversion-logic for details and examples.
Note that this release fixes a bug related to Pydantic aliases in schema generation. If you have a field with the same name as an aliased Pydantic field but with a different type than strawberry.auto , the generated field will now use the alias name. This may cause schema changes on upgrade in these cases, so care should be taken. The alias behavior can be disabled by setting the use_pydantic_alias option of the decorator to false.
Contributed by Matt Allen PR #1629
Adds support for use_pydantic_alias parameter in pydantic model conversion. Decides if the all the GraphQL field names for the generated type should u
Adds support for use_pydantic_alias parameter in pydantic model conversion. Decides if the all the GraphQL field names for the generated type should use the alias name or not.
from pydantic import BaseModel, Field
import strawberry
class UserModel ( BaseModel ):
id : int = Field(..., alias = "my_alias_name" )
@strawberry.experimental.pydantic.type (UserModel, use_pydantic_alias = False )
class User :
id : strawberry.auto
If use_pydantic_alias is False , the GraphQL type User will use id for the name of the id field coming from the Pydantic model.
type User {
id: Int!
}
With use_pydantic_alias set to True (the default behaviour) the GraphQL type user will use myAliasName for the id field coming from the Pydantic models (since the field has a alias specified`)
type User {
myAliasName: Int!
}
use_pydantic_alias is set to True for backwards compatibility.
Contributed by James Chua PR #1546
This release adds compatibility with uvicorn 0.17
This release adds compatibility with uvicorn 0.17
Contributed by dependabot PR #1627
This release fixes an issue with FastAPI context dependency injection that causes class-based custom contexts to no longer be permitted.
This release fixes an issue with FastAPI context dependency injection that causes class-based custom contexts to no longer be permitted.
Contributed by Tommy Smith PR #1564
This release fixes an issue with the name generation for nested generics, the following:
This release fixes an issue with the name generation for nested generics, the following:
T = TypeVar( "T" )
K = TypeVar( "K" )
V = TypeVar( "V" )
@strawberry.type
class Value (Generic[T]):
value: T
@strawberry.type
class DictItem (Generic[K, V]):
key: K
value: V
@strawberry.type
class Query :
d: Value[List[DictItem[ int , str ]]]
now yields the correct schema:
type IntStrDictItem {
key : Int !
value : String !
}
type IntStrDictItemListValue {
value : [ IntStrDictItem !]!
}
type Query {
d : IntStrDictItemListValue !
}
Contributed by Patrick Arminio PR #1621
Fix bug #1504 in the Pydantic integration, where it was impossible to define both an input and output type based on the same Pydantic base class.
Fix bug #1504 in the Pydantic integration, where it was impossible to define both an input and output type based on the same Pydantic base class.
Contributed by Matt Allen PR #1592
Adds to_pydantic and from_pydantic type hints for IDE support.
Adds to_pydantic and from_pydantic type hints for IDE support.
Adds mypy extension support as well.
from pydantic import BaseModel
import strawberry
class UserPydantic ( BaseModel ):
age: int
@strawberry.experimental.pydantic.type (UserPydantic)
class UserStrawberry :
age: strawberry.auto
reveal_type(UserStrawberry( age = 123 ).to_pydantic())
Mypy will infer the type as “UserPydantic”. Previously it would be “Any”
Contributed by James Chua PR #1544
This release replaces cached_property with backports.cached_property to improve the typing of the library.
This release replaces cached_property with backports.cached_property to improve the typing of the library.
Contributed by Rishi Kumar Ray PR #1582
Nothing published for this version
Nothing published for this version
Improve typing of @strawberry.enum() by:
Improve typing of @strawberry.enum() by:
@strawberry.enum
class IceCreamFlavour ( Enum ):
VANILLA = "vanilla"
STRAWBERRY = "strawberry"
CHOCOLATE = "chocolate"
Prior to this change, pyright would complain if you tried to access IceCreamFlavour.VANILLA , since the type information of IceCreamFlavour was being erased by the EnumMeta typing .
Contributed by Tim Joseph Dumol PR #1568
This release adds load_many to DataLoader .
This release adds load_many to DataLoader .
Contributed by Silas Sewell PR #1528
This release adds deprecation_reason support to arguments and mutations.
This release adds deprecation_reason support to arguments and mutations.
Contributed by Silas Sewell PR #1527
This release checks for AutoFieldsNotInBaseModelError when converting from pydantic models. It is raised when strawberry.auto is used, but the pydanti
This release checks for AutoFieldsNotInBaseModelError when converting from pydantic models. It is raised when strawberry.auto is used, but the pydantic model does not have the particular field defined.
class User ( BaseModel ):
age: int
@strawberry.experimental.pydantic.type (User)
class UserType :
age: strawberry.auto
password: strawberry.auto
Previously no errors would be raised, and the password field would not appear on graphql schema. Such mistakes could be common during refactoring. Now, AutoFieldsNotInBaseModelError is raised.
Contributed by James Chua PR #1551
Fixes TypeError when converting a pydantic BaseModel with NewType field
Fixes TypeError when converting a pydantic BaseModel with NewType field
Contributed by James Chua PR #1547
This release allows setting http headers and custom http status codes with FastAPI GraphQLRouter.
This release allows setting http headers and custom http status codes with FastAPI GraphQLRouter.
Contributed by David Němec PR #1537
Fix compatibility with Sanic 21.12
Fix compatibility with Sanic 21.12
Contributed by Artjoms Iskovs PR #1520
Add support for piping StrawberryUnion and None when annotating types.
Add support for piping StrawberryUnion and None when annotating types.
For example:
@strawberry.type
class Cat :
name: str
@strawberry.type
class Dog :
name: str
Animal = strawberry.union( "Animal" , (Cat, Dog))
@strawberry.type
class Query :
animal: Animal | None # This line no longer triggers a TypeError
Contributed by Yossi Rozantsev PR #1540
This release fixes the conversion of pydantic models with a default_factory field.
This release fixes the conversion of pydantic models with a default_factory field.
Contributed by James Chua PR #1538
This release allows conversion of pydantic models with mutable default fields into strawberry types. Also fixes bug when converting a pydantic model f
This release allows conversion of pydantic models with mutable default fields into strawberry types. Also fixes bug when converting a pydantic model field with default_factory. Previously it would raise an exception when fields with a default_factory were declared before fields without defaults.
Contributed by James Chua PR #1491
This release updates the Decimal and UUID scalar parsers to exclude the original_error exception and format the error message similar to other builtin
This release updates the Decimal and UUID scalar parsers to exclude the original_error exception and format the error message similar to other builtin scalars.
Contributed by Silas Sewell PR #1507
Fix mypy plugin crushes when _get_type_for_expr is used on var nodes
Fix mypy plugin crushes when _get_type_for_expr is used on var nodes
Contributed by Andrii Kohut PR #1513
Your coding agent can read these notes before it upgrades. Set up the MCP server →