A GraphQL library for Python that leverages type annotations 🍓
MIT License
Bot releases are hidden (Show)
Published by botberry almost 3 years ago
Add support for piping StrawberryUnion
and None
when annotating types.
For example:
@strawberry.type
class Cat:
name: str
@strawberry.type
class Dog:
name: str
Animal = strawberry.union("Animal", (Cat, Dog))
@strawberry.type
class Query:
animal: Animal | None # This line no longer triggers a TypeError
Published by botberry almost 3 years ago
This release fixes the conversion of pydantic models with a default_factory
field.
Published by botberry almost 3 years ago
This release allows conversion of pydantic models with mutable default fields into strawberry types.
Also fixes bug when converting a pydantic model field with default_factory. Previously it would raise an exception when fields with a default_factory were declared before fields without defaults.
Published by botberry almost 3 years ago
This release updates the Decimal and UUID scalar parsers to exclude the original_error exception and format the error message similar to other builtin scalars.
Published by botberry almost 3 years ago
Fix mypy plugin crushes when _get_type_for_expr is used on var nodes
Published by botberry almost 3 years ago
This release fixes a bug in the annotation parser that prevents using strict typinh for Optional arguments which have their default set to UNSET.
Published by botberry almost 3 years ago
This release adds support for mypy 0.920.
Published by botberry almost 3 years ago
This releases fixes a bug with the opentracing extension
where the tracer wasn't replacing the field name correctly.
Published by botberry almost 3 years ago
This release modifies the internal utility function await_maybe
towards updating mypy to 0.920.
Published by botberry almost 3 years ago
Change context_getter
in strawberry.fastapi.GraphQLRouter
to merge, rather than overwrite, default and custom getters.
This mean now you can always access the request
instance from info.context
, even when using
a custom context getter.
Published by botberry almost 3 years ago
This release changes when we fetch the event loop in dataloaders
to prevent using the wrong event loop in some occasions.
Published by botberry almost 3 years ago
This release fixes an issue that prevented from lazily importing
enum types using LazyType.
Published by botberry almost 3 years ago
This release allows running strawberry as a script, for example, you can start the debug server with the following command:
python -m strawberry server schema
Published by botberry almost 3 years ago
This release adds support for uvicorn 0.16
Published by botberry almost 3 years ago
This fixes the previous release that introduced a direct dependency on Django.
Published by botberry almost 3 years ago
This release adds support for Django 4.0
Published by botberry almost 3 years ago
This release operation_type
to the ExecutionContext
type that is available
in extensions. It also gets the operation_name
from the query if one isn't
provided by the client.
Published by botberry almost 3 years ago
This release adds support for passing json_encoder
and json_dumps_params
to Django JsonResponse
via a view.
from json import JSONEncoder
from django.urls import path
from strawberry.django.views import AsyncGraphQLView
from .schema import schema
# Pass the JSON params to `.as_view`
urlpatterns = [
path(
"graphql",
AsyncGraphQLView.as_view(
schema=schema,
json_encoder=JSONEncoder,
json_dumps_params={"separators": (",", ":")},
),
),
]
# … or set them in a custom view
class CustomAsyncGraphQLView(AsyncGraphQLView):
json_encoder = JSONEncoder
json_dumps_params = {"separators": (",", ":")}
Published by botberry almost 3 years ago
Fix cross-module type resolving for fields and resolvers
The following two issues are now fixed:
A field with a generic (typeless) resolver looks up the
type relative to the resolver and not the class the field is
defined in. (#1448)
When inheriting fields from another class the origin of the
fields are set to the inheriting class and not the class the
field is defined in.
Both these issues could lead to a rather undescriptive error message:
TypeError: (...) fields cannot be resolved. Unexpected type 'None'
Published by botberry almost 3 years ago
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.