Skip to main content

utils

target_from_node

def target_from_node(node: FieldNode) -> str

Extacts the field name from a FieldNode. If alias is present, it will be used instead of the name

inspect_operation_for_documentation

def inspect_operation_for_documentation(operation: OperationDefinitionNode)

Checks for operation level documentatoin

generate_typename_field

def generate_typename_field(typename: str, registry: ClassRegistry)

Generates the typename field a specific type, this will be used to determine the type of the object in the response

generate_config_class

def generate_config_class(graphQLType: GraphQLTypes,
config: GeneratorConfig,
typename: str = None)

Generates the config class for a specific type

It will append the config class to the registry, and set the frozen attribute for the class to True, if the freeze config is enabled and the type appears in the freeze list.

It will also add config attributes to the class, if the type appears in 'additional_config' in the config file.

parse_documents

def parse_documents(client_schema: GraphQLSchema, scan_glob) -> DocumentNode

parse_value_node

def parse_value_node(
value_node: ValueNode) -> Union[None, str, int, float, bool]

Parses a Value Node into a Python value using standard types

Arguments:

  • value_node ValueNode - The Argument Value Node

Raises:

  • NotImplementedError - If the Value Node is not supported

Returns:

Union[None, str, int, float, bool]: The parsed value