strawberry.Info

Class containing information about the current execution.

This class is passed to resolvers when there’s an argument with type Info .

Example:

import strawberry
@strawberry.type
class Query:
@strawberry.field
def hello(self, info: strawberry.Info) -> str:
return f"Hello, {info.context['name']}!"

It also supports passing the type of the context and root types:

import strawberry
@strawberry.type
class Query:
@strawberry.field
def hello(self, info: strawberry.Info[str, str]) -> str:
return f"Hello, {info.context}!"

Constructor:

Signature:

def __init__(self, _raw_info: GraphQLResolveInfo, _field: StrawberryField) -> None:
...

Parameters:

  1. _raw_info:

    Type
    GraphQLResolveInfo
  2. _field:

    Type
    StrawberryField

Methods:

Attributes:

  1. field_name:

    The name of the current field being resolved.

    Type
    str
  2. schema:

    The schema of the current execution.

    Type
    Schema
  3. field_nodes:

    Type
    List[FieldNode]
  4. selected_fields:

    The fields that were selected on the current field’s type.

    Type
    List[Selection]
  5. context:

    The context passed to the query execution.

    Type
    ContextType
  6. root_value:

    The root value passed to the query execution.

    Type
    RootValueType
  7. variable_values:

    The variable values passed to the query execution.

    Type
    Dict[str, Any]
  8. return_type:

    The return type of the current field being resolved.

    Type
    Type[WithStrawberryObjectDefinition] | StrawberryType | None
  9. python_name:

    The name of the current field being resolved in Python format.

    Type
    str
  10. operation:

    The operation being executed.

    Type
    OperationDefinitionNode
  11. path:

    The path of the current field being resolved.

    Type
    Path