A GraphQL library for Python that leverages type annotations 🍓
MIT License
Published by botberry over 4 years ago
Fix typo in Decimal description
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")
Published by botberry over 4 years ago
This release disables subscription in GraphiQL where it
is not supported.
Published by botberry over 4 years ago
Fixes a bug when using unions and lists together
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
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])
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!
}
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.
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
}
Published by botberry over 4 years ago
Improves tooling by updating pre-commit
hooks and adding pre-commit
to
pyproject.toml
.
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())
Published by botberry over 4 years ago
Fix error when a subscription accepted input arguments
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.
Published by botberry over 4 years ago
This release fixes a bug introduced by 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.
Published by botberry over 4 years ago
This release fixes the dependecy of GraphQL-core
Published by botberry over 4 years ago
This releases updates the debug server to serve the API on '/' as well as '/graphql'.
Published by botberry over 4 years ago
Removes the need for duplicate graphiql template file.
Published by botberry over 4 years ago
This releases replaces the playground with GraphiQL including the GraphiQL explorer plugin.
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)