Skip to content

Strawberry 0.13.2

Compare
Choose a tag to compare
@botberry botberry released this 18 Jul 20:07
· 3135 commits to main since this release

Allow the usage of Union types in the mutations

@strawberry.type
class A:
    x: int

@strawberry.type
class B:
    y: int

@strawberry.type
class Mutation:
    @strawberry.mutation
    def hello(self, info) -> Union[A, B]:
        return B(y=5)

schema = strawberry.Schema(query=A, mutation=Mutation)

query = """
mutation {
    hello {
        __typename

        ... on A {
            x
        }

        ... on B {
            y
        }
    }
}
"""