Strawberry-graphql

Latest version: v0.229.1

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

Scan your dependencies

Page 46 of 119

0.130.0

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

Convert Tuple and Sequence types to GraphQL list types.

Example:

python
from collections.abc import Sequence
from typing import Tuple


strawberry.type
class User:
pets: Sequence[Pet]
favourite_ice_cream_flavours: Tuple[IceCreamFlavour]


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

0.129.0

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

This release adds `strawberry.lazy` which allows you to define the type of the
field and its path. This is useful when you want to define a field with a type
that has a circular dependency.

For example, let's say we have a `User` type that has a list of `Post` and a
`Post` type that has a `User`:

python
posts.py
from typing import TYPE_CHECKING, Annotated

import strawberry

if TYPE_CHECKING:
from .users import User


strawberry.type
class Post:
title: str
author: Annotated["User", strawberry.lazy(".users")]


python
users.py
from typing import TYPE_CHECKING, Annotated, List

import strawberry

if TYPE_CHECKING:
from .posts import Post


strawberry.type
class User:
name: str
posts: List[Annotated["Post", strawberry.lazy(".posts")]]


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

0.128.0

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

This release changes how dataclasses are created to make use of the new
`kw_only` argument in Python 3.10 so that fields without a default value can now
follow a field with a default value. This feature is also backported to all other
supported Python versions.

More info: https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass

For example:

python
This no longer raises a TypeError


strawberry.type
class MyType:
a: str = "Hi"
b: int


⚠️ This is a breaking change! Whenever instantiating a Strawberry type make sure
that you only pass values are keyword arguments:

python
Before:

MyType("foo", 3)

After:

MyType(a="foo", b=3)


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

0.127.4

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

This release fixes a bug in the subscription clean up when subscribing using the
graphql-transport-ws protocol, which could occasionally cause a 'finally'
statement within the task to not get run, leading to leaked resources.

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

0.127.3

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

This release fixes a couple of small styling issues with
the GraphiQL explorer

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

0.127.2

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

This release adds support for passing schema directives to
`Schema(..., types=[])`. This can be useful if using a built-inschema directive
that's not supported by a gateway.

For example the following:

python
import strawberry
from strawberry.scalars import JSON
from strawberry.schema_directive import Location


strawberry.type
class Query:
example: JSON


strawberry.schema_directive(locations=[Location.SCALAR], name="specifiedBy")
class SpecifiedBy:
name: str


schema = strawberry.Schema(query=Query, types=[SpecifiedBy])


will print the following SDL:

graphql
directive specifiedBy(name: String!) on SCALAR

"""
The `JSON` scalar type represents JSON values as specified by [ECMA-404](https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf).
"""
scalar JSON
specifiedBy(
url: "https://ecma-international.org/wp-content/uploads/ECMA-404_2nd_edition_december_2017.pdf"
)

type Query {
example: JSON!
}


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

Page 46 of 119

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.