Standard plugins
Ariadne Codegen ships with optional plugins importable from the ariadne_codegen.contrib
package:
-
ariadne_codegen.contrib.shorter_results.ShorterResultsPlugin
- This plugin processes generated client methods for operations where only single top field is requested, so they return this field's value directly instead of operation's result type. For example get_user method generated for queryGetUser() { user(...) { ... }}
will return value of user field directly instead ofGetUserResult
. -
ariadne_codegen.contrib.extract_operations.ExtractOperationsPlugin
- This extracts query strings from generated client's methods into separateoperations.py
module. It also modifies the generated client to import these definitions. Generated module name can be customized by addingoperations_module_name="custom_name"
to the[tool.ariadne-codegen.operations]
section in config. Eg.:[tool.ariadne-codegen]
...
plugins = ["ariadne_codegen.contrib.extract_operations.ExtractOperationsPlugin"]
[tool.ariadne-codegen.extract_operations]
operations_module_name = "custom_operations_module_name" -
ariadne_codegen.contrib.client_forward_refs.ClientForwardRefsPlugin
- This plugin changes generated client module moving all Pydantic models imports under theTYPE_CHECKING
condition, making them forward references. This greatly improves the import performance of theclient
module. -
ariadne_codegen.contrib.no_reimports.NoReimportsPlugin
- This plugin removes content of generated__init__.py
. This is useful in scenarios where generated plugins contain so many Pydantic models that client's eager initialization of entire package on first import is very slow.