Strawberry-graphql

Latest version: v0.229.1

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

Scan your dependencies

Page 49 of 119

0.122.1

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

This release fixes that the AIOHTTP integration ignored the `operationName` of query
operations. This behaviour is a regression introduced in version 0.107.0.

Contributed by [Jonathan Ehwald](https://github.com/DoctorJohn) via [PR #2055](https://github.com/strawberry-graphql/strawberry/pull/2055/)

0.122.0

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

This release adds support for printing default values for scalars like JSON.

For example the following:

python
import strawberry
from strawberry.scalars import JSON


strawberry.input
class MyInput:
j: JSON = strawberry.field(default_factory=dict)
j2: JSON = strawberry.field(default_factory=lambda: {"hello": "world"})


will print the following schema:

graphql
input MyInput {
j: JSON! = {}
j2: JSON! = {hello: "world"}
}


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

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/)

Page 49 of 119

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.