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

0.32.2

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

This releases fixes an issue when extending types, now
fields should work as they were working before even
when extending an existing type.

0.32.1

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

Improves tooling by adding `flake8-eradicate` to `flake8` `pre-commit` hook..

0.32.0

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

Previously, `strawberry.field` had redundant arguments for the resolver, one for
when `strawberry.field` was used as a decorator, and one for when it was used as
a function. These are now combined into a single argument.

The `f` argument of `strawberry.field` no longer exists. This is a
backwards-incompatible change, but should not affect many users. The `f`
argument was the first argument for `strawberry.field` and its use was only
documented without the keyword. The fix is very straight-forward: replace any
`f=` kwarg with `resolver=`.

python
strawberry.type
class Query:
my_int: int = strawberry.field(f=lambda: 5)
becomes
my_int: int = strawberry.field(resolver=lambda: 5)

no change
strawberry.field
def my_float(self) -> float:
return 5.5


Other (minor) breaking changes
* `MissingArgumentsAnnotationsError`'s message now uses the original Python
field name instead of the GraphQL field name. The error can only be thrown while
instantiating a strawberry.field, so the Python field name should be more
helpful.
* As a result, `strawberry.arguments.get_arguments_from_resolver()` now only
takes one field -- the `resolver` Callable.
* `MissingFieldAnnotationError` is now thrown when a strawberry.field is not
type-annotated but also has no resolver to determine its type

0.31.1

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

This release fixes the Flask view that was returning 400 when there were errors
in the GraphQL results. Now it always returns 200.

0.31.0

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

Add `process_result` to views for Django, Flask and ASGI. They can be overridden
to provide a custom response and also to process results and errors.

It also removes `request` from Flask view's `get_root_value` and `get_context`
since request in Flask is a global.

Django example:

python
views.py
from django.http import HttpRequest
from strawberry.django.views import GraphQLView as BaseGraphQLView
from strawberry.http import GraphQLHTTPResponse
from strawberry.types import ExecutionResult


class GraphQLView(BaseGraphQLView):
def process_result(
self, request: HttpRequest, result: ExecutionResult
) -> GraphQLHTTPResponse:
return {"data": result.data, "errors": result.errors or []}


Flask example:

python
views.py
from strawberry.flask.views import GraphQLView as BaseGraphQLView
from strawberry.http import GraphQLHTTPResponse
from strawberry.types import ExecutionResult


class GraphQLView(BaseGraphQLView):
def process_result(self, result: ExecutionResult) -> GraphQLHTTPResponse:
return {"data": result.data, "errors": result.errors or []}


ASGI example:

python
from strawberry.asgi import GraphQL as BaseGraphQL
from strawberry.http import GraphQLHTTPResponse
from strawberry.types import ExecutionResult
from starlette.requests import Request

from .schema import schema


class GraphQL(BaseGraphQLView):
async def process_result(
self, request: Request, result: ExecutionResult
) -> GraphQLHTTPResponse:
return {"data": result.data, "errors": result.errors or []}

0.30.1

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

This releases fixes the check for unset values.

Page 107 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.