Strawberry-graphql

Latest version: v0.229.1

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

Scan your dependencies

Page 86 of 119

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.

0.61.2

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

This release adds support for the info param in resolve_reference:

python
strawberry.federation.type(keys=["upc"])
class Product:
upc: str
info: str

classmethod
def resolve_reference(cls, info, upc):
return Product(upc, info)


> Note: resolver reference is used when using Federation, similar to [Apollo server's __resolveReference](https://apollographql.com/docs/federation/api/apollo-federation/#__resolvereference)

0.61.1

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

This release extends the `strawberry server` command to allow the specification
of a schema symbol name within a module:

sh
strawberry server mypackage.mymodule:myschema


The schema symbol name defaults to `schema` making this change backwards compatible.

0.61.0

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

This release adds file upload support to the [Sanic](https://sanicframework.org)
integration. No additional configuration is required to enable file upload support.

The following example shows how a file upload based mutation could look like:

python
import strawberry
from strawberry.file_uploads import Upload


strawberry.type
class Mutation:
strawberry.mutation
def read_text(self, text_file: Upload) -> str:
return text_file.read().decode()

0.60.0

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

This release adds an `export-schema` command to the Strawberry CLI.
Using the command you can print your schema definition to your console.
Pipes and redirection can be used to store the schema in a file.

Example usage:

sh
strawberry export-schema mypackage.mymodule:myschema > schema.graphql

Page 86 of 119

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.