strawberry

A GraphQL library for Python that leverages type annotations 🍓

MIT License

Downloads
1.1M
Stars
3.8K
Committers
260
strawberry - Strawberry 0.57.4

Published by botberry over 3 years ago

This release fixes an issue when using nested lists, this now works properly:

def get_polygons() -> List[List[float]]:
    return [[2.0, 6.0]]

@strawberry.type
class Query:
    polygons: List[List[float]] = strawberry.field(resolver=get_polygons)

schema = strawberry.Schema(query=Query)

query = "{ polygons }"

result = schema.execute_sync(query, root_value=Query())
strawberry - Strawberry 0.57.3

Published by botberry over 3 years ago

This release fixes support for generic types so that now we can also use generics for input types:

T = typing.TypeVar("T")

@strawberry.input
class Input(typing.Generic[T]):
    field: T

@strawberry.type
class Query:
    @strawberry.field
    def field(self, input: Input[str]) -> str:
        return input.field
strawberry - Strawberry 0.57.2

Published by botberry over 3 years ago

This release fixes a bug that prevented from extending a generic type when
passing a type, like here:

T = typing.TypeVar("T")

@strawberry.interface
class Node(typing.Generic[T]):
    id: strawberry.ID

    def _resolve(self) -> typing.Optional[T]:
        return None

@strawberry.type
class Book(Node[str]):
    name: str

@strawberry.type
class Query:
    @strawberry.field
    def books(self) -> typing.List[Book]:
        return list()
strawberry - Strawberry 0.57.1

Published by botberry over 3 years ago

Fix converting pydantic objects to strawberry types using from_pydantic when having a falsy value like 0 or ''.

strawberry - Strawberry 0.57.0

Published by botberry over 3 years ago

Add a process_errors method to strawberry.Schema which logs all exceptions during execution to a strawberry.execution logger.

strawberry - Strawberry 0.56.3

Published by botberry over 3 years ago

This release fixes the return type value from info argument of resolver.

strawberry - Strawberry 0.56.2

Published by botberry over 3 years ago

This release improves Pydantic support to support default values and factories.

strawberry - Strawberry 0.56.1

Published by botberry over 3 years ago

This release fixes the pydantic integration where you couldn't
convert objects to pydantic instance when they didn't have a
default value.

strawberry - Strawberry 0.56.0

Published by botberry over 3 years ago

Add --app-dir CLI option to specify where to find the schema module to load when using
the debug server.

For example if you have a schema module in a my_app package under ./src, then you
can run the debug server with it using:

strawberry server --app-dir src my_app.schema
strawberry - Strawberry 0.55.0

Published by botberry over 3 years ago

Add support for default and default_factory arguments in strawberry.field

@strawberry.type
class Droid:
    name: str = strawberry.field(default="R2D2")
    aka: List[str] = strawberry.field(default_factory=lambda: ["Artoo"])
strawberry - Strawberry 0.54.0

Published by botberry over 3 years ago

Internal refactoring.

  • Renamed StrawberryArgument to StrawberryArgumentAnnotation
  • Renamed ArgumentDefinition to StrawberryArgument
    • Renamed ArgumentDefinition(type: ...) argument to
      StrawberryArgument(type_: ...)
strawberry - Strawberry 0.53.4

Published by botberry over 3 years ago

Fixed issue with django multipart/form-data uploads

strawberry - Strawberry 0.53.3

Published by botberry over 3 years ago

Fix issue where StrawberryField.graphql_name would always be camelCased

strawberry - Strawberry 0.53.2

Published by botberry over 3 years ago

This relases fixes an issue with the generated __eq__ and __repr__ methods when defining
fields with resolvers.

This now works properly:

@strawberry.type
class Query:
    a: int

    @strawberry.field
    def name(self) -> str:
        return "A"

assert Query(1) == Query(1)
assert Query(1) != Query(2)
strawberry - Strawberry 0.53.1

Published by botberry over 3 years ago

Gracefully handle user-induced subscription errors.

strawberry - Strawberry 0.53.0

Published by botberry over 3 years ago

  • FieldDefinition has been absorbed into StrawberryField and now no longer exists.

  • FieldDefinition.origin_name and FieldDefinition.name have been replaced with
    StrawberryField.python_name and StrawberryField.graphql_name. This should help
    alleviate some backend confusion about which should be used for certain situations.

  • strawberry.types.type_resolver.resolve_type has been split into
    resolve_type_argument and _resolve_type (for arguments) until StrawberryType is
    implemented to combine them back together. This was done to reduce the scope of this
    PR and defer changing ArgumentDefinition (future StrawberryArgument) until a
    different PR.

Note: The constructor signature for StrawberryField has type_ as an argument
instead of type as was the case for FieldDefinition. This is done to prevent
shadowing of builtins.

Note: StrawberryField.name still exists because of the way dataclass Fields
work, but is an alias for StrawberryField.python_name.

strawberry - Strawberry 0.52.1

Published by botberry over 3 years ago

Include field_nodes in Strawberry info object.

strawberry - Strawberry 0.52.0

Published by botberry over 3 years ago

Change get_context to be async for sanic integration

strawberry - Strawberry 0.51.1

Published by botberry over 3 years ago

Configures GraphiQL to attach CSRF cookies as request headers sent to the GQL server.

strawberry - Strawberry 0.51.0

Published by botberry over 3 years ago

Expose Strawberry Info object instead of GraphQLResolveInfo in resolvers

Package Rankings
Top 1.15% on Pypi.org
Top 16.1% on Conda-forge.org
Badges
Extracted from project README
CircleCI Discord PyPI
Related Projects