Skip to content

Releases: strawberry-graphql/strawberry

🍓 0.282.0

07 Sep 20:28
Compare
Choose a tag to compare

This release fixes mask errors to support strawberry execution results.

Releases contributed by @aryaniyaps via #3987

🍓 0.281.0

26 Aug 16:07
Compare
Choose a tag to compare

In this release we removed the --log-operations option from the
strawberry server command. The option only worked for WebSocket connections to
the debug server, and had limited utility.

Removing this option allowed us to remove the undocumented debug option from
all HTTP view integrations and WebSocket protocol implementation, simplifying
the codebase.

Releases contributed by @DoctorJohn via #3979

🍓 0.280.0

19 Aug 17:27
Compare
Choose a tag to compare

This release unifies the format of HTTP error response bodies across all HTTP
view integrations. Previously, the Chalice integration used a custom JSON body
response different from the plain string used by other integrations. Now, all
integrations will return a plain string for HTTP error responses.

Releases contributed by @DoctorJohn via #3978

🍓 0.279.0

19 Aug 17:14
Compare
Choose a tag to compare

This release changes the strawberry.Maybe type to provide a more consistent and intuitive API for handling optional fields in GraphQL inputs.

Breaking Change: The Maybe type definition has been changed from Union[Some[Union[T, None]], None] to Union[Some[T], None]. This means:

  • Maybe[str] now only accepts string values or absent fields (refuses explicit null)
  • Maybe[str | None] accepts strings, null, or absent fields (maintains previous behavior)

This provides a cleaner API where if field is not None consistently means "field was provided" for all Maybe fields. A codemod is available to automatically migrate your code: strawberry upgrade maybe-optional

See the breaking changes documentation for migration details.

Releases contributed by @patrick91 via #3961

🍓 0.278.1

05 Aug 22:13
Compare
Choose a tag to compare

This release removes some internal code in favour of using an external dependency,
this will help us with maintaining the codebase in the future 😊

Releases contributed by @patrick91 via #3967

🍓 0.278.0

19 Jul 12:43
Compare
Choose a tag to compare

Add GraphQL Query batching support

GraphQL query batching is now supported across all frameworks (sync and async)
To enable query batching, add a valid batching_config to the schema configuration.

This makes your GraphQL API compatible with batching features supported by various
client side libraries, such as Apollo GraphQL and Relay.

Example (FastAPI):

import strawberry

from fastapi import FastAPI
from strawberry.fastapi import GraphQLRouter
from strawberry.schema.config import StrawberryConfig


@strawberry.type
class Query:
    @strawberry.field
    def hello(self) -> str:
        return "Hello World"


schema = strawberry.Schema(
    Query, config=StrawberryConfig(batching_config={"max_operations": 10})
)

graphql_app = GraphQLRouter(schema)

app = FastAPI()
app.include_router(graphql_app, prefix="/graphql")

Example (Flask):

import strawberry

from flask import Flask
from strawberry.flask.views import GraphQLView

app = Flask(__name__)


@strawberry.type
class Query:
    @strawberry.field
    def hello(self) -> str:
        return "Hello World"


schema = strawberry.Schema(
    Query, config=StrawberryConfig(batching_config={"max_operations": 10})
)

app.add_url_rule(
    "/graphql/batch",
    view_func=GraphQLView.as_view("graphql_view", schema=schema),
)

if __name__ == "__main__":
    app.run()

Note: Query Batching is not supported for multipart subscriptions

Releases contributed by @aryaniyaps via #3755

🍓 0.277.1

19 Jul 11:02
Compare
Choose a tag to compare

This release fixes the resolution of Generics when specializing using a union
defined with Annotated, like in the example below:

from typing import Annotated, Generic, TypeVar, Union
import strawberry

T = TypeVar("T")


@strawberry.type
class User:
    name: str
    age: int


@strawberry.type
class ProUser:
    name: str
    age: float


@strawberry.type
class GenType(Generic[T]):
    data: T


GeneralUser = Annotated[Union[User, ProUser], strawberry.union("GeneralUser")]


@strawberry.type
class Response(GenType[GeneralUser]): ...


@strawberry.type
class Query:
    @strawberry.field
    def user(self) -> Response: ...


schema = strawberry.Schema(query=Query)

Before this would raise a TypeError, now it works as expected.

Releases contributed by @bellini666 via #3950

🍓 0.277.0

18 Jul 22:24
Compare
Choose a tag to compare

This release adds experimental support for GraphQL's @defer and @stream directives, enabling incremental delivery of response data.

Note: this only works when using Strawberry with graphql-core>=3.3.0a9.

Features

  • @defer directive: Allows fields to be resolved asynchronously and delivered incrementally
  • @stream directive: Enables streaming of list fields using the new strawberry.Streamable type
  • strawberry.Streamable[T]: A new generic type for defining streamable fields that work with @stream

Configuration

To enable these experimental features, configure your schema with:

from strawberry.schema.config import StrawberryConfig

schema = strawberry.Schema(
    query=Query, config=StrawberryConfig(enable_experimental_incremental_execution=True)
)

Releases contributed by @patrick91 via #3819

🍓 0.276.2

18 Jul 12:34
Compare
Choose a tag to compare

This release renames the ExecutionContext.errors attribute to ExecutionContext.pre_execution_errors to better reflect its purpose. The old errors attribute is now deprecated but still available for backward compatibility.

The pre_execution_errors attribute specifically stores errors that occur during the pre-execution phase (parsing and validation), making the distinction clearer from errors that might occur during the actual execution phase.

For backward compatibility, accessing ExecutionContext.errors will now emit a deprecation warning and return the value of pre_execution_errors.

Releases contributed by @patrick91 via #3947

🍓 0.276.1

18 Jul 09:55
Compare
Choose a tag to compare

This release fixes an issue where DuplicatedTypeName exception would be raised
for nested generics like in the example below:

from typing import Generic, TypeVar

import strawberry

T = TypeVar("T")


@strawberry.type
class Wrapper(Generic[T]):
    value: T


@strawberry.type
class Query:
    a: Wrapper[Wrapper[int]]
    b: Wrapper[Wrapper[int]]


schema = strawberry.Schema(query=Query)

This piece of code and similar ones will now work correctly.

Releases contributed by @bellini666 via #3946