strawberry

A GraphQL library for Python that leverages type annotations 🍓

MIT License

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

Published by botberry almost 4 years ago

Bugfix to allow the use of UNSET as a default value for arguments.

import strawberry
from strawberry.arguments import UNSET, is_unset

@strawberry.type
class Query:
    @strawberry.field
    def hello(self, name: Optional[str] = UNSET) -> str:
        if is_unset(name):
            return "Hi there"
        return "Hi {name}"

schema = strawberry.Schema(query=Query)

result = schema.execute_async("{ hello }")
assert result.data == {"hello": "Hi there"}

result = schema.execute_async('{ hello(name: "Patrick" }')
assert result.data == {"hello": "Hi Patrick"}

SDL:

type Query {
  hello(name: String): String!
}
strawberry - Strawberry 0.42.1

Published by botberry almost 4 years ago

This release improves mypy support for strawberry.field

strawberry - Strawberry 0.42.0

Published by botberry almost 4 years ago

  • Completely revamped how resolvers are created, stored, and managed by
    StrawberryField. Now instead of monkeypatching a FieldDefinition object onto
    the resolver function itself, all resolvers are wrapped inside of a
    StrawberryResolver object with the useful properties.
  • arguments.get_arguments_from_resolver is now the
    StrawberryResolver.arguments property
  • Added a test to cover a situation where a field is added to a StrawberryType
    manually using dataclasses.field but not annotated. This was previously
    uncaught.
strawberry - Strawberry 0.41.1

Published by botberry almost 4 years ago

This release fixes an issue with forward types

strawberry - Strawberry 0.41.0

Published by botberry almost 4 years ago

This release adds a built-in dataloader. Example:

async def app():
    async def idx(keys):
        return keys

    loader = DataLoader(load_fn=idx)

    [value_a, value_b, value_c] = await asyncio.gather(
        loader.load(1),
        loader.load(2),
        loader.load(3),
    )


    assert value_a == 1
    assert value_b == 2
    assert value_c == 3
strawberry - Strawberry 0.40.2

Published by botberry almost 4 years ago

Allow interfaces to implement other interfaces.
This may be useful if you are using the relay pattern
or if you want to model base interfaces that can be extended.

Example:

import strawberry


@strawberry.interface
class Error:
    message: str

@strawberry.interface
class FieldError(Error):
    message: str
    field: str

@strawberry.type
class PasswordTooShort(FieldError):
    message: str
    field: str
    fix: str

Produces the following SDL:

interface Error {
  message: String!
}

interface FieldError implements Error {
  message: String!
  field: String!
}

type PasswordTooShort implements FieldError & Error {
  message: String!
  field: String!
  fix: String!
}
strawberry - Strawberry 0.40.1

Published by botberry almost 4 years ago

Fix mypy plugin to handle bug where the types argument to strawberry.union is passed in as a keyword argument instead of a position one.

MyUnion = strawberry.union(types=(TypeA, TypeB), name="MyUnion")
strawberry - Strawberry 0.40.0

Published by botberry almost 4 years ago

This release adds a new AsyncGraphQLView for django.

strawberry - Strawberry 0.39.4

Published by botberry almost 4 years ago

Improve typing for field and StrawberryField.

strawberry - Strawberry 0.39.3

Published by botberry almost 4 years ago

This release disable implicit re-export of modules. This fixes Strawberry for you if you were using implicit_reexport = False in your MyPy config.

strawberry - Strawberry 0.39.2

Published by botberry almost 4 years ago

This fixes the prettier pre-lint check.

strawberry - Strawberry 0.39.1

Published by botberry almost 4 years ago

Fix issue when using strawberry.enum(module.EnumClass) in mypy

strawberry - Strawberry 0.39.0

Published by botberry almost 4 years ago

This release adds support to mark a field as deprecated via deprecation_reason

strawberry - Strawberry 0.38.1

Published by botberry almost 4 years ago

Set default value to null in the schema when it's set to None

strawberry - Strawberry 0.38.0

Published by botberry almost 4 years ago

Register UUID's as a custom scalar type instead of the ID type.

⚠️ This is a potential breaking change because inputs of type UUID are now parsed as instances of uuid.UUID instead of strings as they were before.

strawberry - Strawberry 0.37.7

Published by botberry almost 4 years ago

This release fixes a bug when returning list in async resolvers

strawberry - Strawberry 0.37.6

Published by botberry almost 4 years ago

This release improves how we check for enums

strawberry - Strawberry 0.37.5

Published by botberry almost 4 years ago

This release improves how we handle enum values when returing lists of enums.

strawberry - Strawberry 0.37.4

Published by botberry about 4 years ago

This releases adds a workaround to prevent mypy from crashing in specific occasions

strawberry - Strawberry 0.37.3

Published by botberry about 4 years ago

This release fixes an issue preventing to return enums in lists

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