|
| 1 | +--- |
| 2 | +title: Configuration |
| 3 | +--- |
| 4 | + |
| 5 | +# Configuration |
| 6 | + |
| 7 | +`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` |
| 8 | + |
| 9 | +Minimal configuration for client generation: |
| 10 | + |
| 11 | +```toml |
| 12 | +[tool.ariadne-codegen] |
| 13 | +schema_path = "schema.graphql" |
| 14 | +queries_path = "queries.graphql" |
| 15 | +``` |
| 16 | + |
| 17 | +## Required settings: |
| 18 | + |
| 19 | +- `queries_path` - path to file/directory with queries (Can be optional if `enable_custom_operations` is used) |
| 20 | + |
| 21 | +One of the following 2 parameters is required, in case of providing both of them `schema_path` is prioritized: |
| 22 | + |
| 23 | +- `schema_path` - path to file/directory with graphql schema |
| 24 | +- `remote_schema_url` - url to graphql server, where introspection query can be perfomed |
| 25 | + |
| 26 | +## Optional settings: |
| 27 | + |
| 28 | +- `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"}` |
| 29 | +- `remote_schema_verify_ssl` (defaults to `true`) - a flag that specifies wheter to verify ssl while introspecting remote schema |
| 30 | +- `target_package_name` (defaults to `"graphql_client"`) - name of generated package |
| 31 | +- `target_package_path` (defaults to cwd) - path where to generate package |
| 32 | +- `client_name` (defaults to `"Client"`) - name of generated client class |
| 33 | +- `client_file_name` (defaults to `"client"`) - name of file with generated client class |
| 34 | +- `base_client_name` (defaults to `"AsyncBaseClient"`) - name of base client class |
| 35 | +- `base_client_file_path` (defaults to `.../ariadne_codegen/client_generators/dependencies/async_base_client.py`) - path to file where `base_client_name` is defined |
| 36 | +- `enums_module_name` (defaults to `"enums"`) - name of file with generated enums models |
| 37 | +- `input_types_module_name` (defaults to `"input_types"`) - name of file with generated input types models |
| 38 | +- `fragments_module_name` (defaults to `"fragments"`) - name of file with generated fragments models |
| 39 | +- `include_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) |
| 40 | +- `convert_to_snake_case` (defaults to `true`) - a flag that specifies whether to convert fields and arguments names to snake case |
| 41 | +- `include_all_inputs` (defaults to `true`) - a flag specifying whether to include all inputs defined in the schema, or only those used in supplied operations |
| 42 | +- `include_all_enums` (defaults to `true`) - a flag specifying whether to include all enums defined in the schema, or only those used in supplied operations |
| 43 | +- `async_client` (defaults to `true`) - default generated client is `async`, change this to option `false` to generate synchronous client instead |
| 44 | +- `opentelemetry_client` (defaults to `false`) - default base clients don't support any performance tracing. Change this option to `true` to use the base client with Open Telemetry support. |
| 45 | +- `files_to_include` (defaults to `[]`) - list of files which will be copied into generated package |
| 46 | +- `plugins` (defaults to `[]`) - list of plugins to use during generation |
| 47 | +- `enable_custom_operations` (defaults to `false`) - enables building custom operations. Generates additional files that contains all the classes and methods for generation. |
0 commit comments