Strawberry-graphql

Latest version: v0.235.0

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

Scan your dependencies

Page 52 of 122

0.121.1

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

This release adds a backward compatibility layer with libraries
that specify a custom `get_result`.

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

0.121.0

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

This release adds support for overriding the default resolver for fields.

Currently the default resolver is `getattr`, but now you can change it to any
function you like, for example you can allow returning dictionaries:

python
strawberry.type
class User:
name: str


strawberry.type
class Query:
strawberry.field
def user(self) -> User:
return {"name": "Patrick"} type: ignore


schema = strawberry.Schema(
query=Query,
config=StrawberryConfig(default_resolver=getitem),
)

query = "{ user { name } }"

result = schema.execute_sync(query)


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

0.120.0

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

This release add a new `DatadogTracingExtension` that can be used to instrument
your application with Datadog.

python
import strawberry

from strawberry.extensions.tracing import DatadogTracingExtension

schema = strawberry.Schema(
Query,
extensions=[
DatadogTracingExtension,
],
)


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

0.119.2

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

Fixed edge case where `Union` types raised an `UnallowedReturnTypeForUnion`
error when returning the correct type from the resolver. This also improves
performance of StrawberryUnion's `_resolve_union_type` from `O(n)` to `O(1)` in
the majority of cases where `n` is the number of types in the schema.

For
[example the below](https://play.strawberry.rocks/?gist=f7d88898d127e65b12140fdd763f9ef2))
would previously raise the error when querying `two` as `StrawberryUnion` would
incorrectly determine that the resolver returns `Container[TypeOne]`.

python
import strawberry
from typing import TypeVar, Generic, Union, List, Type

T = TypeVar("T")


strawberry.type
class Container(Generic[T]):
items: List[T]


strawberry.type
class TypeOne:
attr: str


strawberry.type
class TypeTwo:
attr: str


def resolver_one():
return Container(items=[TypeOne("one")])


def resolver_two():
return Container(items=[TypeTwo("two")])


strawberry.type
class Query:
one: Union[Container[TypeOne], TypeOne] = strawberry.field(resolver_one)
two: Union[Container[TypeTwo], TypeTwo] = strawberry.field(resolver_two)


schema = strawberry.Schema(query=Query)


Contributed by [Tim OSullivan](https://github.com/invokermain) via [PR #2029](https://github.com/strawberry-graphql/strawberry/pull/2029/)

0.119.1

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

An explanatory custom exception is raised when union of GraphQL input types is attempted.

Contributed by [Dhanshree Arora](https://github.com/DhanshreeA) via [PR #2019](https://github.com/strawberry-graphql/strawberry/pull/2019/)

0.119.0

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

This release changes when we add the custom directives extension, previously
the extension was always enabled, now it is only enabled if you pass custom
directives to `strawberry.Schema`.

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

Page 52 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.