Strawberry-graphql

Latest version: v0.229.1

Safety actively analyzes 629765 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 18 of 119

0.193.1

--------------------

This fixes a regression from 0.190.0 where changes to the
return type of a field done by Field Extensions would not
be taken in consideration by the schema.

Contributed by [Thiago Bellini Ribeiro](https://github.com/bellini666) via [PR #2922](https://github.com/strawberry-graphql/strawberry/pull/2922/)

0.193.0

--------------------

This release updates the API to listen to Django Channels to avoid race conditions
when confirming GraphQL subscriptions.

**Deprecations:**

This release contains a deprecation for the Channels integration. The `channel_listen`
method will be replaced with an async context manager that returns an awaitable
AsyncGenerator. This method is called `listen_to_channel`.

An example of migrating existing code is given below:

py
Existing code
strawberry.type
class MyDataType:
name: str


strawberry.type
class Subscription:
strawberry.subscription
async def my_data_subscription(
self, info: strawberry.Info, groups: list[str]
) -> AsyncGenerator[MyDataType | None, None]:
yield None
async for message in info.context["ws"].channel_listen(
"my_data", groups=groups
):
yield MyDataType(name=message["payload"])


py
New code
strawberry.type
class Subscription:
strawberry.subscription
async def my_data_subscription(
self, info: strawberry.Info, groups: list[str]
) -> AsyncGenerator[MyDataType | None, None]:
async with info.context["ws"].listen_to_channel("my_data", groups=groups) as cm:
yield None
async for message in cm:
yield MyDataType(name=message["payload"])


Contributed by [Moritz Ulmer](https://github.com/moritz89) via [PR #2856](https://github.com/strawberry-graphql/strawberry/pull/2856/)

0.192.2

Not secure
--------------------

This release fixes an issue related to using `typing.Annotated` in resolver
arguments following the declaration of a reserved argument such as
`strawberry.types.Info`.

Before this fix, the following would be converted incorrectly:

python
from __future__ import annotations
import strawberry
import uuid
from typing_extensions import Annotated
from strawberry.types import Info


strawberry.type
class Query:
strawberry.field
def get_testing(
self,
info: strawberry.Info,
id_: Annotated[uuid.UUID, strawberry.argument(name="id")],
) -> str | None:
return None


schema = strawberry.Schema(query=Query)

print(schema)


Resulting in the schema:

graphql
type Query {
getTesting(id_: UUID!): String ⬅️ see `id_`
}

scalar UUID


After this fix, the schema is converted correctly:

graphql
type Query {
getTesting(id: UUID!): String
}

scalar UUID


Contributed by [San Kilkis](https://github.com/skilkis) via [PR #2901](https://github.com/strawberry-graphql/strawberry/pull/2901/)

0.192.1

Not secure
--------------------

Add specifications in FastAPI doc if query via GET is enabled

Contributed by [guillaumeLepape](https://github.com/guillaumeLepape) via [PR #2913](https://github.com/strawberry-graphql/strawberry/pull/2913/)

0.192.0

Not secure
--------------------

This release introduces a new command called `upgrade`, this command can be used
to run codemods on your codebase to upgrade to the latest version of Strawberry.

At the moment we only support upgrading unions to use the new syntax with
annotated, but in future we plan to add more commands to help with upgrading.

Here's how you can use the command to upgrade your codebase:

shell
strawberry upgrade annotated-union .


Contributed by [Patrick Arminio](https://github.com/patrick91) via [PR #2886](https://github.com/strawberry-graphql/strawberry/pull/2886/)

0.191.0

--------------------

This release adds support for declaring union types using `typing.Annotated`
instead of `strawberry.union(name, types=...)`.

Code using the old syntax will continue to work, but it will trigger a
deprecation warning. Using Annotated will improve type checking and IDE support
especially when using `pyright`.

Before:

python
Animal = strawberry.union("Animal", (Cat, Dog))


After:

python
from typing import Annotated, Union

Animal = Annotated[Union[Cat, Dog], strawberry.union("Animal")]

Page 18 of 119

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.