strawberry.schema.Schema
Constructor:
Default Schema to be to be used in a Strawberry application.
A GraphQL Schema class used to define the structure and configuration of GraphQL queries, mutations, and subscriptions.
This class allows the creation of a GraphQL schema by specifying the types for queries, mutations, and subscriptions, along with various configuration options such as directives, extensions, and scalar overrides.
Signature:
Parameters:
-
query:
The entry point for queries.
- Type
-
Type
-
mutation:
The entry point for mutations.
- Type
-
Type | None
- Default
-
None
-
subscription:
The entry point for subscriptions.
- Type
-
Type | None
- Default
-
None
-
directives:
A list of operation directives that clients can use. The bult-in
@include
and@skip
are included by default.- Type
-
Iterable[StrawberryDirective]
- Default
-
()
-
types:
A list of additional types that will be included in the schema.
- Type
-
Iterable[Type | StrawberryType]
- Default
-
()
-
extensions:
A list of Strawberry extensions.
- Type
-
Iterable[Type[SchemaExtension] | SchemaExtension]
- Default
-
()
-
execution_context_class:
The execution context class.
- Type
-
Type[GraphQLExecutionContext] | None
- Default
-
None
-
config:
The configuration for the schema.
- Type
-
StrawberryConfig | None
- Default
-
None
-
scalar_overrides:
A dictionary of overrides for scalars.
- Type
-
Dict[object, Type | ScalarWrapper | ScalarDefinition] | None
- Default
-
None
-
schema_directives:
A list of schema directives for the schema.
- Type
-
Iterable[object]
- Default
-
()
Methods:
-
get_extensions
Signature:
Parameters:
-
sync:
- Type
-
bool
- Default
-
False
-
-
get_type_by_name
Signature:
Parameters:
-
name:
- Type
-
str
-
-
get_field_for_type
Signature:
Parameters:
-
field_name:
- Type
-
str
-
type_name:
- Type
-
str
-
-
get_directive_by_name
Signature:
Parameters:
-
graphql_name:
- Type
-
str
-
-
get_fields
Signature:
Parameters:
-
type_definition:
- Type
-
StrawberryObjectDefinition
-
-
execute
Signature:
Parameters:
-
query:
- Type
-
str | None
-
variable_values:
- Type
-
Dict[str, Any] | None
- Default
-
None
-
context_value:
- Type
-
Any | None
- Default
-
None
-
root_value:
- Type
-
Any | None
- Default
-
None
-
operation_name:
- Type
-
str | None
- Default
-
None
-
allowed_operation_types:
- Type
-
Iterable[OperationType] | None
- Default
-
None
-
-
execute_sync
Signature:
Parameters:
-
query:
- Type
-
str | None
-
variable_values:
- Type
-
Dict[str, Any] | None
- Default
-
None
-
context_value:
- Type
-
Any | None
- Default
-
None
-
root_value:
- Type
-
Any | None
- Default
-
None
-
operation_name:
- Type
-
str | None
- Default
-
None
-
allowed_operation_types:
- Type
-
Iterable[OperationType] | None
- Default
-
None
-
-
subscribe
Signature:
Parameters:
-
query:
- Type
-
str
-
variable_values:
- Type
-
Dict[str, Any] | None
- Default
-
None
-
context_value:
- Type
-
Any | None
- Default
-
None
-
root_value:
- Type
-
Any | None
- Default
-
None
-
operation_name:
- Type
-
str | None
- Default
-
None
-
-
as_str
Signature:
-
introspect
Return the introspection query result for the current schema.
Signature:
Attributes:
-
query:
-
mutation:
-
subscription:
-
extensions:
-
execution_context_class:
-
config:
-
schema_converter:
-
directives:
-
schema_directives: