Configuration
ariadne-codegen reads configuration from [tool.ariadne-codegen] section in your pyproject.toml. You can use other configuration file with --config option, eg. ariadne-codegen --config custom_file.toml
Minimal configuration for client generation:
[tool.ariadne-codegen]
schema_path = "schema.graphql"
queries_path = "queries.graphql"
Required settings:
queries_path- path to file/directory with queries (Can be optional ifenable_custom_operationsis used)
One of the following 2 parameters is required, in case of providing both of them schema_path is prioritized:
schema_path- path to file/directory with graphql schemaremote_schema_url- url to graphql server, where introspection query can be perfomed
Optional settings:
remote_schema_headers- extra headers that are passed along with introspection query, eg.{"Authorization" = "Bearer: token"}. To include an environment variable in a header value, prefix the variable with$, eg.{"Authorization" = "$AUTH_TOKEN"}remote_schema_verify_ssl(defaults totrue) - a flag that specifies wheter to verify ssl while introspecting remote schematarget_package_name(defaults to"graphql_client") - name of generated packagetarget_package_path(defaults to cwd) - path where to generate packageclient_name(defaults to"Client") - name of generated client classclient_file_name(defaults to"client") - name of file with generated client classbase_client_name(defaults to"AsyncBaseClient") - name of base client classbase_client_file_path(defaults to.../ariadne_codegen/client_generators/dependencies/async_base_client.py) - path to file wherebase_client_nameis definedenums_module_name(defaults to"enums") - name of file with generated enums modelsinput_types_module_name(defaults to"input_types") - name of file with generated input types modelsfragments_module_name(defaults to"fragments") - name of file with generated fragments modelsinclude_comments(defaults to"stable") - option which sets content of comments included at the top of every generated file. Valid choices are:"none"(no comments),"timestamp"(comment with generation timestamp),"stable"(comment contains a message that this is a generated file)convert_to_snake_case(defaults totrue) - a flag that specifies whether to convert fields and arguments names to snake caseinclude_all_inputs(defaults totrue) - a flag specifying whether to include all inputs defined in the schema, or only those used in supplied operationsinclude_all_enums(defaults totrue) - a flag specifying whether to include all enums defined in the schema, or only those used in supplied operationsasync_client(defaults totrue) - default generated client isasync, change this to optionfalseto generate synchronous client insteadopentelemetry_client(defaults tofalse) - default base clients don't support any performance tracing. Change this option totrueto use the base client with Open Telemetry support.files_to_include(defaults to[]) - list of files which will be copied into generated packageplugins(defaults to[]) - list of plugins to use during generationenable_custom_operations(defaults tofalse) - enables building custom operations. Generates additional files that contains all the classes and methods for generation.