Strawberry-graphql

Latest version: v0.235.0

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

Scan your dependencies

Page 88 of 122

0.63.2

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

Add `root_value` to `ExecutionContext` type so that it can be accessed in
extensions.

Example:

python
import strawberry
from strawberry.extensions import Extension


class MyExtension(Extension):
def on_request_end(self):
root_value = self.execution_context.root_value
do something with the root_value


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

0.63.1

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

New deployment process to release new Strawberry releases

[Marco Acierno](https://github.com/marcoacierno) [PR #957](https://github.com/strawberry-graphql/strawberry/pull/957/)

0.63.0

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

This release adds extra values to the ExecutionContext object so that it can be
used by extensions and the `Schema.process_errors` function.

The full ExecutionContext object now looks like this:

python
from graphql import ExecutionResult as GraphQLExecutionResult
from graphql.error.graphql_error import GraphQLError
from graphql.language import DocumentNode as GraphQLDocumentNode


dataclasses.dataclass
class ExecutionContext:
query: str
context: Any = None
variables: Optional[Dict[str, Any]] = None
operation_name: Optional[str] = None

graphql_document: Optional[GraphQLDocumentNode] = None
errors: Optional[List[GraphQLError]] = None
result: Optional[GraphQLExecutionResult] = None


and can be accessed in any of the extension hooks:

python
from strawberry.extensions import Extension


class MyExtension(Extension):
def on_request_end(self):
result = self.execution_context.result
Do something with the result


schema = strawberry.Schema(query=Query, extensions=[MyExtension])


---

Note: This release also removes the creation of an ExecutionContext object in the web
framework views. If you were relying on overriding the `get_execution_context`
function then you should change it to `get_request_data` and use the
`strawberry.http.parse_request_data` function to extract the pieces of data
needed from the incoming request.

0.62.1

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

This releases fixes an issue with the debug server that prevented the
usage of dataloaders, see: https://github.com/strawberry-graphql/strawberry/issues/940

0.62.0

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

This release adds support for GraphQL subscriptions to the AIOHTTP integration.
Subscription support works out of the box and does not require any additional
configuration.

Here is an example how to get started with subscriptions in general. Note that by
specification GraphQL schemas must always define a query, even if only subscriptions
are used.

python
import asyncio
import typing
import strawberry


strawberry.type
class Subscription:
strawberry.subscription
async def count(self, target: int = 100) -> typing.AsyncGenerator[int, None]:
for i in range(target):
yield i
await asyncio.sleep(0.5)


strawberry.type
class Query:
strawberry.field
def _unused(self) -> str:
return ""


schema = strawberry.Schema(subscription=Subscription, query=Query)

0.61.3

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

Fix `requires(fields: ["email"])` and `provides(fields: ["name"])` usage on a Federation field

You can use `requires` to specify which fields you need to resolve a field

python
import strawberry


strawberry.federation.type(keys=["id"], extend=True)
class Product:
id: strawberry.ID = strawberry.federation.field(external=True)
code: str = strawberry.federation.field(external=True)

classmethod
def resolve_reference(cls, id: strawberry.ID, code: str):
return cls(id=id, code=code)

strawberry.federation.field(requires=["code"])
def my_code(self) -> str:
return self.code


`provides` can be used to specify what fields are going to be resolved
by the service itself without having the Gateway to contact the external service
to resolve them.

Page 88 of 122

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.