title: Strawberry docs
General
Types
Codegen
Extensions
>Errors
>Guides
Editor integration
Concepts
Integrations
Federation
Operations
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.typeclass Query: user: User | None
@strawberry.typeclass User: id: strawberry.ID name: str
schema = strawberry.Schema(query=Query)