You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This plugin allows for add-in logic through custom directives, that will allow adding in
custom code generation logic through self directives, that then call user defined functions:
turms_directives:
name_or_directive: #name of the directivelocations: #the directive locations
- "variable definition"type: "path.to.plugin.plugin_function"#the resolved plugintrim: True #will trim this directive from the generated graphql sdl (in the meta class)args: #additional args (aka @validator(arg1="arg1string")arg1: string
defplugin_function(v: VariableDefinitionNode, body: List[AST], registry: ClassRegistry, arg1: str) ->List[AST]:
# Custom logic defining alterations to this specific body (input will vary from plugin to plugin)returnbody
To illustrate the Usecase:
Sometypes it can become useful to introduce custom pydantic validaition logic for specific
arguments on operations:
Defined in yalidator.py
We define this validator directive plugin, that will import the validation functionality and put it as a call
for the validation function
This plugin allows for add-in logic through custom directives, that will allow adding in
custom code generation logic through self directives, that then call user defined functions:
To illustrate the Usecase:
Sometypes it can become useful to introduce custom pydantic validaition logic for specific
arguments on operations:
Defining the plugin in graphql.config.yaml
Defined in yalidator.py
We define this validator directive plugin, that will import the validation functionality and put it as a call
for the validation function
When now running the plugin turms will call the directive plugin on encounter and yield this result:
The text was updated successfully, but these errors were encountered: