Skip to content

Releases: strawberry-graphql/strawberry

Strawberry 0.13.1

17 Jul 18:03
Compare
Choose a tag to compare

Fix missing fields when extending a class, now we can do this:

@strawberry.type
class Parent:
    cheese: str = "swiss"

    @strawberry.field
    def friend(self, info) -> str:
        return 'food'

@strawberry.type
class Schema(Parent):
    cake: str = "made_in_swiss"

Strawberry 0.13.0

16 Jul 06:42
Compare
Choose a tag to compare

This release adds field support for permissions

import strawberry

from strawberry.permission import BasePermission

class IsAdmin(BasePermission):
    message = "You are not authorized"

    def has_permission(self, info):
      return False

@strawberry.type
class Query:
    @strawberry.field(permission_classes=[IsAdmin])
    def hello(self, info) -> str:
      return "Hello"

Strawberry 0.12.0

25 Jun 17:39
Compare
Choose a tag to compare

This releases adds support for ASGI 3.0

from strawberry.asgi import GraphQL
from starlette.applications import Starlette

graphql_app = GraphQL(schema_module.schema, debug=True)

app = Starlette(debug=True)
app.add_route("/graphql", graphql_app)
app.add_websocket_route("/graphql", graphql_app)

Strawberry 0.11.0

07 Jun 21:58
Compare
Choose a tag to compare

Added support for optional fields with default arguments in the GraphQL schema when default arguments are passed to the resolver.

Example:

@strawberry.type
class Query:
   @strawberry.field
   def hello(self, info, name: str = "world") -> str:
       return name
type Query {
    hello(name: String = "world"): String
}

Strawberry 0.10.0

28 May 08:38
Compare
Choose a tag to compare

Fixed issue that was prevent usage of InitVars.
Now you can safely use InitVar to prevent fields from showing up in the schema:

@strawberry.type
class Category:
    name: str
    id: InitVar[str]

@strawberry.type
class Query:
    @strawberry.field
    def category(self, info) -> Category:
        return Category(name="example", id="123")

Strawberry 0.9.1

25 May 11:37
Compare
Choose a tag to compare

Fixed logo on PyPI

Strawberry 0.9.0

24 May 23:44
Compare
Choose a tag to compare

Added support for passing resolver functions

def resolver(root, info, par: str) -> str:
    return f"hello {par}"

@strawberry.type
class Query:
    example: str = strawberry.field(resolver=resolver)

Also we updated some of the dependencies of the project

Strawberry 0.8.0

09 May 14:43
3914261
Compare
Choose a tag to compare

Added support for renaming fields. Example usage:

@strawberry.type
class Query:
    example: str = strawberry.field(name='test')

Strawberry 0.7.0

09 May 13:52
1949938
Compare
Choose a tag to compare

Added support for declaring interface by using @strawberry.interface
Example:

@strawberry.interface
class Node:
    id: strawberry.ID

Strawberry 0.6.0

02 May 09:52
48cbf9d
Compare
Choose a tag to compare

This changes field to be lazy by default, allowing to use circular dependencies
when declaring types.