recurse
recurse_annotation
def recurse_annotation(node: FieldNode,
parent: str,
type: GraphQLType,
client_schema: GraphQLSchema,
config: GeneratorConfig,
subtree: ast.AST,
registry: ClassRegistry,
is_optional=True) -> ast.AST
Recurse Annotations
Resolves the type of a field and returns the appropriate annotation. If we deal with nested object types it recurses further and generated the objects together with the type_field_node method:
class X(BaseModel): a: int
in this case "a" is generated by type_field_node and "X" is generated by recurse_annotation
Arguments:
node
FieldNode - The nodetype
GraphQLType - The type of the field as specified in the schemaclient_schema
GraphQLSchema - The schema itselfconfig
GeneratorConfig - The generator config (with the defaults)subtree
ast.AST - The passed subtreeregistry
ClassRegistry - A class registry where classes and their imports are registeredparent_name
str, optional - If resolving nested types the name of parent. Defaults to "".is_optional
bool, optional - A recurse modifier for optional types. Defaults to True.
Raises:
NotImplementedError
- Not implemneted errorsNotImplementedError
- description
Returns:
ast.AST
- The returned tree
type_field_node
def type_field_node(node: FieldNode,
parent: str,
field: GraphQLField,
client_schema: GraphQLSchema,
config: GeneratorConfig,
subtree: ast.AST,
registry: ClassRegistry,
is_optional=True)
Types a field node
This
Arguments:
node
FieldNode - descriptionfield
GraphQLField - descriptionclient_schema
GraphQLSchema - descriptionconfig
GeneratorConfig - descriptionsubtree
ast.AST - descriptionregistry
ClassRegistry - descriptionparent_name
str, optional - description. Defaults to "".is_optional
bool, optional - description. Defaults to True.
Returns:
_type_
- description