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.typeclass 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.typeclass 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:
-
_raw_info:- Type
-
GraphQLResolveInfo
-
_field:- Type
-
StrawberryField
Methods:
-
get_argument_definition
Get the StrawberryArgument definition for the current field by name.
Signature:
def get_argument_definition(self, name: str) -> StrawberryArgument | None:...Parameters:
-
name:- Type
-
str
-
Attributes:
-
field_name:The name of the current field being resolved.
- Type
-
str
-
schema:The schema of the current execution.
- Type
-
Schema
-
field_nodes:- Type
-
List[FieldNode]
-
selected_fields:The fields that were selected on the current field’s type.
- Type
-
List[Selection]
-
context:The context passed to the query execution.
- Type
-
ContextType
-
root_value:The root value passed to the query execution.
- Type
-
RootValueType
-
variable_values:The variable values passed to the query execution.
- Type
-
Dict[str, Any]
-
return_type:The return type of the current field being resolved.
- Type
-
Type[WithStrawberryObjectDefinition] | StrawberryType | None
-
python_name:The name of the current field being resolved in Python format.
- Type
-
str
-
operation:The operation being executed.
- Type
-
OperationDefinitionNode
-
path:The path of the current field being resolved.
- Type
-
Path