Strawberry provides some utility functions to help you build your GraphQL server. All tools can be imported from


Create a Strawberry type from a list of fields.

def create_type(
    name: str,
    fields: List[StrawberryField],
    is_input: bool = False,
    is_interface: bool = False,
    description: Optional[str] = None,
    directives: Optional[Sequence[object]] = (),
    extend: bool = False,
) -> Type: ...


import strawberry
from import create_type
def hello(info) -> str:
    return "World"
def get_name(info) -> str:
my_name = strawberry.field(name="myName", resolver=get_name)
Query = create_type("Query", [hello, my_name])
schema = strawberry.Schema(query=Query)
type Query {
  hello: String!
  myName: String!


Merge multiple Strawberry types into one. Example:

import strawberry
from import merge_types
class QueryA:
    def perform_a(self) -> str:
class QueryB:
    def perform_b(self) -> str:
ComboQuery = merge_types("ComboQuery", (QueryB, QueryA))
schema = strawberry.Schema(query=ComboQuery)
type ComboQuery {
  performB: String!
  performA: String!
Edit this page on GitHub