strawberry

A GraphQL library for Python that leverages type annotations 🍓

MIT License

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

Published by botberry over 4 years ago

Fix typo in Decimal description

strawberry - Strawberry 0.27.0

Published by botberry over 4 years ago

This release adds support for decimal type, example:

@strawberry.type
class Query:
    @strawberry.field
    def example_decimal(self) -> Decimal:
        return Decimal("3.14159")
strawberry - Strawberry 0.26.3

Published by botberry over 4 years ago

This release disables subscription in GraphiQL where it
is not supported.

strawberry - Strawberry 0.26.2

Published by botberry over 4 years ago

Fixes a bug when using unions and lists together

strawberry - Strawberry 0.26.1

Published by botberry over 4 years ago

Argument conversion doesn't populate missing args with defaults.

@strawberry.field
def hello(self, null_or_unset: Optional[str] = UNSET, nullable: str = None) -> None:
    pass
strawberry - Strawberry 0.26.0

Published by botberry over 4 years ago

This releases adds experimental support for apollo federation.

Here's an example:

import strawberry


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

    @strawberry.field
    def title(self) -> str:
        return f"Title for {self.id}"

    @classmethod
    def resolve_reference(cls, id):
        return Campaign(id)


@strawberry.federation.type(extend=True)
class Query:
    @strawberry.field
    def strawberry(self) -> str:
        return "🍓"


schema = strawberry.federation.Schema(query=Query, types=[Campaign])
strawberry - Strawberry 0.25.6

Published by botberry over 4 years ago

Default values make input arguments nullable when the default is None.

class Query:
     @strawberry.field
     def hello(self, i: int = 0, s: str = None) -> str:
         return s
type Query {
  hello(i: Int! = 0, s: String): String!
}
strawberry - Strawberry 0.25.5

Published by botberry over 4 years ago

Added sentinel value for input parameters that aren't sent by the clients.
It checks for when a field is unset.

strawberry - Strawberry 0.25.4

Published by botberry over 4 years ago

Support for default_value on inputs and arguments.

Usage:

class MyInput:
    s: Optional[str]
    i: int = 0
input MyInput {
  s: String
  i: Int! = 0
}
strawberry - Strawberry 0.25.3

Published by botberry over 4 years ago

Improves tooling by updating pre-commit hooks and adding pre-commit to
pyproject.toml.

strawberry - Strawberry 0.25.2

Published by botberry over 4 years ago

Add support for setting root_value in asgi.

Usage:

schema = strawberry.Schema(query=Query)
app = strawberry.asgi.GraphQL(schema, root_value=Query())
strawberry - Strawberry 0.25.1

Published by botberry over 4 years ago

Fix error when a subscription accepted input arguments

strawberry - Strawberry 0.25.0

Published by botberry over 4 years ago

This release add supports for named unions, now you can create
a new union type by writing:

Result = strawberry.union("Result", (A, B), description="Example Result")

This also improves the support for Union and Generic types, as it
was broken before.

strawberry - Strawberry 0.24.1

Published by botberry over 4 years ago

This release fixes a bug introduced by 0.24.0

strawberry - Strawberry 0.24.0

Published by botberry over 4 years ago

This releases allows to use resolver without having
to specify root and info arguments:

def function_resolver() -> str:
    return "I'm a function resolver"

def function_resolver_with_params(x: str) -> str:
    return f"I'm {x}"

@strawberry.type
class Query:
    hello: str = strawberry.field(resolver=function_resolver)
    hello_with_params: str = strawberry.field(
        resolver=function_resolver_with_params
    )


@strawberry.type
class Query:
    @strawberry.field
    def hello(self) -> str:
        return "I'm a function resolver"

    @strawberry.field
    def hello_with_params(self, x: str) -> str:
        return f"I'm {x}"

This makes it easier to reuse existing functions and makes code
cleaner when not using info or root.

strawberry - Strawberry 0.23.3

Published by botberry over 4 years ago

This release fixes the dependecy of GraphQL-core

strawberry - Strawberry 0.23.2

Published by botberry over 4 years ago

This releases updates the debug server to serve the API on '/' as well as '/graphql'.

strawberry - Strawberry 0.23.1

Published by botberry over 4 years ago

Removes the need for duplicate graphiql template file.

strawberry - Strawberry 0.23.0

Published by botberry over 4 years ago

This releases replaces the playground with GraphiQL including the GraphiQL explorer plugin.

strawberry - Strawberry 0.22.0

Published by botberry over 4 years ago

This release adds support for generic types, allowing
to reuse types easily, here's an example:

T = typing.TypeVar("T")

@strawberry.type
class Edge(typing.Generic[T]):
    cursor: strawberry.ID
    node: T

@strawberry.type
class Query:
    @strawberry.field
    def int_edge(self, info, **kwargs) -> Edge[int]:
        return Edge(cursor=strawberry.ID("1"), node=1)
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