Schema codegen

Strawberry supports code generation from SDL files.

Let's assume we have the following SDL file:

type Query {
user: User
type User {
id: ID!
name: String!

by running the following command:

strawberry schema-codegen schema.graphql

we'll get the following output:

import strawberry
class Query:
user: User | None
class User:
id: strawberry.ID
name: str
schema = strawberry.Schema(query=Query)

Was this helpful? What can we improve?

Edit on Github

Newsletter 💌

Do you want to receive the latest updates on Strawberry? Subscribe to our newsletter!