Strawberry-graphql

Latest version: v0.235.0

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

Scan your dependencies

Page 54 of 122

0.116.3

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

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](https://github.com/patrick91) via [PR #1988](https://github.com/strawberry-graphql/strawberry/pull/1988/)

0.116.2

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

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](https://github.com/skilkis) via [PR #1990](https://github.com/strawberry-graphql/strawberry/pull/1990/)

0.116.1

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

This release fixes a breaking internal error in mypy plugin for the following case.
- using positional arguments to pass a resolver for `strawberry.field()` or `strawberry.mutation()`

python
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](https://github.com/cake-monotone) via [PR #1987](https://github.com/strawberry-graphql/strawberry/pull/1987/)

0.116.0

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

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:

python
strawberry_type: TypeDefinition = graphql_core_type.extensions[
GraphQLCoreConverter.DEFINITION_BACKREF
]


Contributed by [Paulo Costa](https://github.com/paulo-raca) via [PR #1766](https://github.com/strawberry-graphql/strawberry/pull/1766/)

0.115.0

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

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:

python
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:

python
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:

python
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):
Arbitrary argument name when using `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](https://github.com/skilkis) via [PR #1713](https://github.com/strawberry-graphql/strawberry/pull/1713/)

0.114.7

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

Allow use of implicit `Any` in `strawberry.Private` annotated Generic types.

For example the following is now supported:

python
from __future__ import annotations

from typing import Generic, Sequence, TypeVar

import strawberry


T = TypeVar("T")


strawberry.type
class Foo(Generic[T]):
private_field: strawberry.Private[Sequence] instead of Sequence[Any]


strawberry.type
class Query:
strawberry.field
def foo(self) -> Foo[str]:
return Foo(private_field=[1, 2, 3])


See Issue [1938](https://github.com/strawberry-graphql/strawberry/issues/1938)
for details.

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

Page 54 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.