Code Generation¶
The GPP Client uses ariadne-codegen to generate all GraphQL models, enums,
inputs, fragments, and the underlying _GPPClient transport layer.
All generated code lives in:
src/gpp_client/api/
Running Codegen¶
Use the provided script:
uv run python scripts/run_codegen.py PRODUCTION
This script:
Validates that the schema exists.
Writes a temporary
codegen.tomlbased on project defaults.Creates a backup of the existing
src/gpp_client/apidirectory.Runs
ariadne-codegen.Restores the backup on failure.
Deletes the backup on success.
Codegen Configuration¶
The configuration is constructed dynamically, but corresponds to:
[tool.ariadne-codegen]
schema_path = "schemas/production.schema.graphql"
query_path = "src/queries"
target_package_path = "src/gpp_client"
target_package_name = "api"
convert_to_snake_case = true
enable_custom_operations = true
client_name = "_GPPClient"
client_file_name = "_client"
plugins = ["custom_plugins.AliasStrWrapperPlugin"]
This produces:
src/gpp_client/api/
Custom Plugins¶
The project currently uses:
custom_plugins.AliasStrWrapperPlugin
This plugin corrects how certain scalar wrappers behave with aliases.
Why Codegen Is Required¶
The GPP schema changes regularly. Each change may add:
New input types
New enums
New fields
Updated nullability
New custom types
Rather than maintain all Pydantic models manually, the project regenerates them using the upstream schema.
Note
The GPP Client itself is intentionally thin. Most logic resides in resource managers and higher-level abstractions. The generated code is not intended to contain business logic except for the defined queries, mutations, and subscriptions.