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
@strawberry.type
class Query:
user: User | None
@strawberry.type
class User:
id: strawberry.ID
name: str
schema = strawberry.Schema(query=Query)