Strawberry-graphql

Latest version: v0.229.1

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

Scan your dependencies

Page 23 of 119

0.183.5

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

This release fixes an issue where Strawberry would make copies
of types that were using specialized generics that were not
Strawerry types.

This issue combined with the use of lazy types was resulting
in duplicated type errors.

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

0.183.4

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

This release fixes an issue for parsing lazy types using forward references
when they were enclosed in an `Optional[...]` type.

The following now should work properly:

python
from __future__ import annotations

from typing import Optional, Annotated
import strawberry


strawberry.type
class MyType:
other_type: Optional[Annotated["OtherType", strawberry.lazy("some.module")]]
or like this
other_type: Annotated["OtherType", strawberry.lazy("some.module")] | None


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

0.183.3

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

This release fixes a codegen bug. Prior to this fix,
inline fragments would only include the last field defined
within its scope and all fields common with its siblings.

After this fix, all fields will be included in the
generated types.

Contributed by [Matt Gilson](https://github.com/mgilson) via [PR #2819](https://github.com/strawberry-graphql/strawberry/pull/2819/)

0.183.2

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

Fields with generics support directives.

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

0.183.1

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

This release fixes an issue of the new relay integration adding an `id: GlobalID!`
argument on all objects that inherit from `relay.Node`. That should've only happened
for `Query` types.

Strawberry now will not force a `relay.Node` or any type that inherits it to be
inject the node extension which adds the argument and a resolver for it, meaning that
this code:

python
import strawberry
from strawberry import relay


strawberry.type
class Fruit(relay.Node):
id: relay.NodeID[int]


strawberry.type
class Query:
node: relay.Node
fruit: Fruit


Should now be written as:

python
import strawberry
from strawberry import relay


strawberry.type
class Fruit(relay.Node):
id: relay.NodeID[int]


strawberry.type
class Query:
node: relay.Node = relay.node() <- note the "= relay.node()" here
fruit: Fruit = relay.node()


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

0.183.0

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

This release adds a new field extension called `InputMutationExtension`, which makes
it easier to create mutations that receive a single input type called `input`,
while still being able to define the arguments of that input on the resolver itself.

The following example:

python
import strawberry
from strawberry.field_extensions import InputMutationExtension


strawberry.type
class Fruit:
id: strawberry.ID
name: str
weight: float


strawberry.type
class Mutation:
strawberry.mutation(extensions=[InputMutationExtension()])
def update_fruit_weight(
self,
info: strawberry.Info,
id: strawberry.ID,
weight: Annotated[
float,
strawberry.argument(description="The fruit's new weight in grams"),
],
) -> Fruit:
fruit = ... retrieve the fruit with the given ID
fruit.weight = weight
... maybe save the fruit in the database
return fruit


Would generate a schema like this:

graphql
input UpdateFruitInput {
id: ID!

"""
The fruit's new weight in grams
"""
weight: Float!
}

type Fruit {
id: ID!
name: String!
weight: Float!
}

type Mutation {
updateFruitWeight(input: UpdateFruitInput!): Fruit!
}


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

Page 23 of 119

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.