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 36 of 119

0.151.2

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

This release fixes `strawberry.experimental.pydantic.type` and adds support for the metadata attribute on fields.

Example:
python
strawberry.experimental.pydantic.type(model=User)
class UserType:
private: strawberry.auto = strawberry.field(metadata={"admin_only": True})
public: strawberry.auto


Contributed by [Huy Z](https://github.com/huyz) via [PR #2415](https://github.com/strawberry-graphql/strawberry/pull/2415/)

0.151.1

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

This release fixes an issue that prevented using generic
that had a field of type enum. The following works now:

python
strawberry.enum
class EstimatedValueEnum(Enum):
test = "test"
testtest = "testtest"


strawberry.type
class EstimatedValue(Generic[T]):
value: T
type: EstimatedValueEnum


strawberry.type
class Query:
strawberry.field
def estimated_value(self) -> Optional[EstimatedValue[int]]:
return EstimatedValue(value=1, type=EstimatedValueEnum.test)


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

0.151.0

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

This PR adds a new `graphql_type` parameter to strawberry.field that allows you
to explicitly set the field type. This parameter will take preference over the
resolver return type and the class field type.

For example:

python
strawberry.type
class Query:
a: float = strawberry.field(graphql_type=str)
b = strawberry.field(graphql_type=int)

strawberry.field(graphql_type=float)
def c(self) -> str:
return "3.4"


schema = strawberry.Schema(Query)

str(
schema
) == """
type Query {
a: String!
b: Int!
c: Float!
}
"""


Contributed by [Jonathan Kim](https://github.com/jkimbo) via [PR #2313](https://github.com/strawberry-graphql/strawberry/pull/2313/)

0.150.1

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

Fixed field resolvers with nested generic return types
(e.g. `list`, `Optional`, `Union` etc) raising TypeErrors.
This means resolver factory methods can now be correctly type hinted.

For example the below would previously error unless you ommited all the
type hints on `resolver_factory` and `actual_resolver` functions.
python
from typing import Callable, Optional, Type, TypeVar

import strawberry


strawberry.type
class Cat:
name: str


T = TypeVar("T")


def resolver_factory(type_: Type[T]) -> Callable[[], Optional[T]]:
def actual_resolver() -> Optional[T]:
load rows from database and cast to type etc
...

return actual_resolver


strawberry.type
class Query:
cat: Cat = strawberry.field(resolver_factory(Cat))


schema = strawberry.Schema(query=Query)


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

0.150.0

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

This release implements the ability to use custom caching for dataloaders.
It also allows to provide a `cache_key_fn` to the dataloader. This function
is used to generate the cache key for the dataloader. This is useful when
you want to use a custom hashing function for the cache key.

Contributed by [Aman Choudhary](https://github.com/Techno-Tut) via [PR #2394](https://github.com/strawberry-graphql/strawberry/pull/2394/)

0.149.2

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

This release fixes support for generics in arguments, see the following example:

python
T = TypeVar("T")


strawberry.type
class Node(Generic[T]):
strawberry.field
def data(self, arg: T) -> T: `arg` is also generic
return arg


Contributed by [A. Coady](https://github.com/coady) via [PR #2316](https://github.com/strawberry-graphql/strawberry/pull/2316/)

Page 36 of 119

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.