Overview of ariadne-codegen features
mainariadne-codegen is a Python code generator that converts GraphQL schemas and operations into a fully typed, async (or sync) Python client built on Pydantic.
Key capabilities include:
- Fully typed models: Pydantic models for schema types, inputs, enums, fragments, and operation results.
- Typed client methods: Each operation becomes a method with typed arguments and return values.
- Async or sync: Generate an async client (default) or a synchronous one.
- Subscriptions: Real-time updates via WebSockets (
graphql-transport-ws). - File uploads: Support for multipart requests via the GraphQL multipart request spec.
- Custom scalars: Map GraphQL scalars to Python types using
serialize/parsehooks. - Extensible output: Inject mixins, copy files, or swap the base client (e.g., for custom auth or removing
httpx/websocketsdependencies). - Flexible schema sources: Load schemas from local files, installed Python packages, or remote introspection.
- Plugin system: Customize generation via hooks.
- Advanced features: Programmatic query building, OpenTelemetry tracing, multiple clients per project, and schema-copy mode.