strawberry.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:

def __init__(
self,
query: Type,
mutation: Type | None = None,
subscription: Type | None = None,
directives: Iterable[StrawberryDirective] = (),
types: Iterable[Type | StrawberryType] = (),
extensions: Iterable[Type[SchemaExtension] | SchemaExtension] = (),
execution_context_class: Type[GraphQLExecutionContext] | None = None,
config: StrawberryConfig | None = None,
scalar_overrides: Dict[object, Type | ScalarWrapper | ScalarDefinition] | None = None,
schema_directives: Iterable[object] = (),
) -> None:
...

Parameters:

  1. query:

    The entry point for queries.

    Type
    Type
  2. mutation:

    The entry point for mutations.

    Type
    Type | None
    Default
    None
  3. subscription:

    The entry point for subscriptions.

    Type
    Type | None
    Default
    None
  4. directives:

    A list of operation directives that clients can use. The bult-in @include and @skip are included by default.

    Type
    Iterable[StrawberryDirective]
    Default
    ()
  5. types:

    A list of additional types that will be included in the schema.

    Type
    Iterable[Type | StrawberryType]
    Default
    ()
  6. extensions:

    A list of Strawberry extensions.

    Type
    Iterable[Type[SchemaExtension] | SchemaExtension]
    Default
    ()
  7. execution_context_class:

    The execution context class.

    Type
    Type[GraphQLExecutionContext] | None
    Default
    None
  8. config:

    The configuration for the schema.

    Type
    StrawberryConfig | None
    Default
    None
  9. scalar_overrides:

    A dictionary of overrides for scalars.

    Type
    Dict[object, Type | ScalarWrapper | ScalarDefinition] | None
    Default
    None
  10. schema_directives:

    A list of schema directives for the schema.

    Type
    Iterable[object]
    Default
    ()

Methods:

Attributes:

  1. query:

  2. mutation:

  3. subscription:

  4. extensions:

  5. execution_context_class:

  6. config:

  7. schema_converter:

  8. directives:

  9. schema_directives: