Skip to main content

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 node
  • type GraphQLType - The type of the field as specified in the schema
  • client_schema GraphQLSchema - The schema itself
  • config GeneratorConfig - The generator config (with the defaults)
  • subtree ast.AST - The passed subtree
  • registry ClassRegistry - A class registry where classes and their imports are registered
  • parent_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 errors
  • NotImplementedError - 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 - description
  • field GraphQLField - description
  • client_schema GraphQLSchema - description
  • config GeneratorConfig - description
  • subtree ast.AST - description
  • registry ClassRegistry - description
  • parent_name str, optional - description. Defaults to "".
  • is_optional bool, optional - description. Defaults to True.

Returns:

  • _type_ - description