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 70 of 122

0.92.0

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

This releases fixes an issue where you were not allowed
to return a non-strawberry type for fields that return
an interface. Now this works as long as each type
implementing the interface implements an `is_type_of`
classmethod. Previous automatic duck typing on types
that implement an interface now requires explicit
resolution using this classmethod.

Contributed by [Etty](https://github.com/estyxx) [PR #1299](https://github.com/strawberry-graphql/strawberry/pull/1299/)

0.91.0

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

This release adds a `GraphQLTestClient`. It hides the http request's details and asserts that there are no errors in the response (you can always disable this behavior by passing `asserts_errors=False`). This makes it easier to test queries and makes your tests cleaner.

If you are using `pytest` you can add a fixture in `conftest.py`

python
import pytest

from django.test.client import Client

from strawberry.django.test import GraphQLTestClient


pytest.fixture
def graphql_client():
yield GraphQLTestClient(Client())


And use it everywere in your test methods

python
def test_strawberry(graphql_client):
query = """
query Hi($name: String!) {
hi(name: $name)
}
"""

result = graphql_client.query(query, variables={"name": "Marcotte"})

assert result.data == {"hi": "Hi Marcotte!"}


It can be used to test the file uploads as well

python
from django.core.files.uploadedfile import SimpleUploadedFile


def test_upload(graphql_client):
f = SimpleUploadedFile("file.txt", b"strawberry")
query = """
mutation($textFile: Upload!) {
readText(textFile: $textFile)
}
"""

response = graphql_client.query(
query=query,
variables={"textFile": None},
files={"textFile": f},
)

assert response.data["readText"] == "strawberry"


Contributed by [Etty](https://github.com/estyxx) [PR #1225](https://github.com/strawberry-graphql/strawberry/pull/1225/)

0.90.3

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

This release fixes an issue that prevented using enums as
arguments for generic types inside unions.

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

0.90.2

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

This release fixes the message of `InvalidFieldArgument` to properly show the field's name in the error message.

Contributed by [Etty](https://github.com/estyxx) [PR #1322](https://github.com/strawberry-graphql/strawberry/pull/1322/)

0.90.1

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

This release fixes an issue that prevented using `classmethod`s and `staticmethod`s as resolvers

python
import strawberry


strawberry.type
class Query:
strawberry.field
staticmethod
def static_text() -> str:
return "Strawberry"

strawberry.field
classmethod
def class_name(cls) -> str:
return cls.__name__


Contributed by [Illia Volochii](https://github.com/illia-v) [PR #1430](https://github.com/strawberry-graphql/strawberry/pull/1430/)

0.90.0

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

This release improves type checking support for `strawberry.union` and now allows
to use unions without any type issue, like so:

python
strawberry.type
class User:
name: str


strawberry.type
class Error:
message: str


UserOrError = strawberry.union("UserOrError", (User, Error))

x: UserOrError = User(name="Patrick")


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

Page 70 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.