Flaxon 0.3.0 and Teloce-Py 0.3.0 are available on PyPI. Release instructions are maintained on this site; source links identify the framework snapshot. Check version and upgrade guidance.

Framework source · Markdown

GraphQL API Reference


Schema

GraphQLSchema(self, query: ObjectType | None=None, mutation: ObjectType | None=None, subscription: ObjectType | None=None)

Graph qlschema implementation for the graphql subsystem.

View implementation

Public methods and properties

add_type

def add_type(self, type_obj: ObjectType) -> None

Add the type.

get_type

def get_type(self, name: str) -> ObjectType | None

Return the type.

get_types

def get_types(self) -> dict[str, ObjectType]

Return the types.

add_directive

def add_directive(self, directive: Directive) -> None

Add the directive.

get_directives

def get_directives(self) -> list[Directive]

Return the directives.

resolver

def resolver(self) -> Resolver

Perform the resolver operation for graph qlschema.

execute

async def execute(self, query: str, variables: dict[str, Any] | None=None, context: Any=None, operation_name: str | None=None) -> dict[str, Any]

Execute the supplied operation with its parameters.

introspection

async def introspection(self) -> dict[str, Any]

Perform the introspection operation for graph qlschema.


Types

ObjectType

ObjectType(self, name: str, fields: dict[str, Field], description: str | None=None)

Object type implementation for the graphql subsystem.

View implementation

Public methods and properties

add_interface

def add_interface(self, interface: InterfaceType) -> None

Add the interface.


InterfaceType

InterfaceType(self, name: str, fields: dict[str, Field], description: str | None=None)

Interface type implementation for the graphql subsystem.

View implementation


UnionType

UnionType(self, name: str, types: list[ObjectType], description: str | None=None)

Union type implementation for the graphql subsystem.

View implementation


InputObjectType

InputObjectType(self, name: str, fields: dict[str, InputField], description: str | None=None)

Input object type implementation for the graphql subsystem.

View implementation


Field

Field(self, type_: Any, args: dict[str, Any] | None=None, resolver: Any=None)

Validate and convert field values.

View implementation

Public methods and properties

resolve

def resolve(self, parent: Any, args: dict[str, Any], context: Any, info: Any) -> Any

Perform the resolve operation for field.


InputField

InputField(self, type_: Any, default_value: Any=None)

Validate and convert input field values.

View implementation


GraphQL List Type

List(self, type_: Any)

List implementation for the graphql subsystem.

View implementation


NonNull

NonNull(self, type_: Any)

Non null implementation for the graphql subsystem.

View implementation


Scalar

Scalar(self, name: str, description: str | None=None)

Scalar implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> Any

Convert the supplied value into its serialized representation.

parse_value

def parse_value(self, value: Any) -> Any

Parse the value.

parse_literal

def parse_literal(self, value: Any) -> Any

Parse the literal.

set_serialize

def set_serialize(self, func: Any) -> None

Set the serialize.

set_parse_value

def set_parse_value(self, func: Any) -> None

Set the parse value.

set_parse_literal

def set_parse_literal(self, func: Any) -> None

Set the parse literal.


Scalars

ID(self)

Id implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> str

Convert the supplied value into its serialized representation.

DateTime(self)

Date time implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> str

Convert the supplied value into its serialized representation.

parse_value

def parse_value(self, value: Any) -> datetime.datetime

Parse the value.

Decimal(self)

Decimal implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> str

Convert the supplied value into its serialized representation.

parse_value

def parse_value(self, value: Any) -> decimal.Decimal

Parse the value.

JSON(self)

Json implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> Any

Convert the supplied value into its serialized representation.

parse_value

def parse_value(self, value: Any) -> Any

Parse the value.

parse_literal

def parse_literal(self, value: Any) -> Any

Parse the literal.

UUID(self)

Uuid implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> str

Convert the supplied value into its serialized representation.

parse_value

def parse_value(self, value: Any) -> Any

Parse the value.

URL(self)

Url implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> str

Convert the supplied value into its serialized representation.

Email(self)

Email implementation for the graphql subsystem.

View implementation

Public methods and properties

serialize

def serialize(self, value: Any) -> str

Convert the supplied value into its serialized representation.


Resolver

Resolver(self)

Resolver implementation for the graphql subsystem.

View implementation

Public methods and properties

register

def register(self, type_name: str, field_name: str, resolver: Any) -> None

Perform the register operation for resolver.

register_type_resolver

def register_type_resolver(self, type_name: str, resolver: Any) -> None

Register the type resolver.

get

def get(self, type_name: str, field_name: str) -> Any

Retrieve the requested value using this object's configured behavior.

get_type_resolver

def get_type_resolver(self, type_name: str) -> Any

Return the type resolver.

resolve

async def resolve(self, type_name: str, field_name: str, parent: Any, args: dict[str, Any], context: Any, info: Any) -> Any

Perform the resolve operation for resolver.


Directives

Directive

Directive(self, name: str, description: str | None=None, locations: list[str] | None=None, args: dict[str, Any] | None=None)

Directive implementation for the graphql subsystem.

View implementation

Public methods and properties

apply

def apply(self, context: Any, args: dict[str, Any]) -> bool

Perform the apply operation for directive.


Built-in Directives

SkipDirective(self)

Skip directive implementation for the graphql subsystem.

View implementation

Public methods and properties

apply

def apply(self, context: Any, args: dict[str, Any]) -> bool

Perform the apply operation for skip directive.

IncludeDirective(self)

Include directive implementation for the graphql subsystem.

View implementation

Public methods and properties

apply

def apply(self, context: Any, args: dict[str, Any]) -> bool

Perform the apply operation for include directive.

DeprecatedDirective(self)

Deprecated directive implementation for the graphql subsystem.

View implementation

DeferDirective(self)

Defer directive implementation for the graphql subsystem.

View implementation


Decorators

def graphql_type(name: str, description: str | None=None)

Provide type behavior for GraphQL integration.

View implementation

def graphql_field(description: str | None=None)

Provide field behavior for GraphQL integration.

View implementation

def graphql_query(name: str | None=None, description: str | None=None)

Provide query behavior for GraphQL integration.

View implementation

def graphql_mutation(name: str | None=None, description: str | None=None)

Provide mutation behavior for GraphQL integration.

View implementation

def graphql_subscription(name: str | None=None, description: str | None=None)

Provide subscription behavior for GraphQL integration.

View implementation


Subscriptions

SubscriptionManager

SubscriptionManager(self, backend: Any=None)

Subscription manager implementation for the graphql subsystem.

View implementation

Public methods and properties

subscribe

async def subscribe(self, operation_id: str, context: Any, variables: dict[str, Any]) -> str

Register a subscription for the supplied event or operation.

unsubscribe

async def unsubscribe(self, subscription_id: str) -> None

Remove the requested subscription.

publish

async def publish(self, operation_id: str, data: Any) -> None

Perform the publish operation for subscription manager.

next

async def next(self, subscription_id: str) -> Any

Perform the next operation for subscription manager.

get_subscription_count

def get_subscription_count(self) -> int

Return the subscription count.

get_subscriptions_by_operation

def get_subscriptions_by_operation(self, operation_id: str) -> list[str]

Return the subscriptions by operation.


MemorySubscriptionBackend

MemorySubscriptionBackend(self)

In-process subscription backend, matching RedisSubscriptionBackend's interface.

Suitable for single-process deployments or local development. For multi-process or multi-server deployments, use RedisSubscriptionBackend instead so publishes from one process reach subscribers connected to another.

View implementation

Public methods and properties

connect

async def connect(self) -> None

No-op: nothing to connect to for the in-memory backend.

disconnect

async def disconnect(self) -> None

Release any pending queues.

subscribe

async def subscribe(self, operation_id: str, context: Any, variables: dict[str, Any]) -> str

Register a subscription for the supplied event or operation.

unsubscribe

async def unsubscribe(self, subscription_id: str) -> None

Remove the requested subscription.

publish

async def publish(self, operation_id: str, data: Any) -> None

Perform the publish operation for memory subscription backend.

next

async def next(self, subscription_id: str) -> Any

Perform the next operation for memory subscription backend.


RedisSubscriptionBackend

RedisSubscriptionBackend(self, redis_url: str='redis://localhost:6379/0', prefix: str='graphql:subscription')

Provide redis subscription storage for graphql operations.

View implementation

Public methods and properties

connect

async def connect(self) -> None

Open the configured connection.

disconnect

async def disconnect(self) -> None

Close the configured connection.

subscribe

async def subscribe(self, operation_id: str, context: Any, variables: dict[str, Any]) -> str

Register a subscription for the supplied event or operation.

unsubscribe

async def unsubscribe(self, subscription_id: str) -> None

Remove the requested subscription.

publish

async def publish(self, operation_id: str, data: Any) -> None

Perform the publish operation for redis subscription backend.

next

async def next(self, subscription_id: str) -> Any

Perform the next operation for redis subscription backend.


Middleware

GraphQLMiddleware(self, app: Any)

Graph qlmiddleware implementation for the graphql subsystem.

View implementation

Public methods and properties

add

def add(self, middleware: Any) -> None

Add the supplied item to this collection.


Extensions

ComplexityExtension

ComplexityExtension(self, max_complexity: int=100, enabled: bool=True)

Complexity extension implementation for the graphql subsystem.

View implementation

Public methods and properties

set_cost

def set_cost(self, field_name: str, cost: int) -> None

Set the cost.

set_costs

def set_costs(self, costs: dict[str, int]) -> None

Set the costs.

get_cost

def get_cost(self, field_name: str) -> int

Return the cost.

calculate_complexity

def calculate_complexity(self, document: Any) -> int

Perform the calculate complexity operation for complexity extension.

validate_complexity

def validate_complexity(self, document: Any) -> bool

Validate the complexity.

before

async def before(self, context: dict[str, Any]) -> None

Perform the before operation for complexity extension.

after

async def after(self, context: dict[str, Any], result: dict[str, Any]) -> None

Perform the after operation for complexity extension.


DepthLimitExtension

DepthLimitExtension(self, max_depth: int=10, enabled: bool=True)

Depth limit extension implementation for the graphql subsystem.

View implementation

Public methods and properties

calculate_depth

def calculate_depth(self, document: Any) -> int

Perform the calculate depth operation for depth limit extension.

validate_depth

def validate_depth(self, document: Any) -> bool

Validate the depth.

before

async def before(self, context: dict[str, Any]) -> None

Perform the before operation for depth limit extension.

after

async def after(self, context: dict[str, Any], result: dict[str, Any]) -> None

Perform the after operation for depth limit extension.


PersistedQueriesExtension

PersistedQueriesExtension(self, storage: dict[str, str] | None=None, enabled: bool=True)

Persisted queries extension implementation for the graphql subsystem.

View implementation

Public methods and properties

register

def register(self, query_hash: str, query: str) -> None

Perform the register operation for persisted queries extension.

register_many

def register_many(self, queries: dict[str, str]) -> None

Register the many.

get

def get(self, query_hash: str) -> str | None

Retrieve the requested value using this object's configured behavior.

get_auto_hash

def get_auto_hash(self, query: str) -> str

Return the auto hash.

resolve_persisted_query

def resolve_persisted_query(self, query_hash: str, query_text: str | None=None) -> str | None

Resolve the persisted query.

save_persisted_query

def save_persisted_query(self, query_text: str) -> str

Save the persisted query.

load_persisted_queries

def load_persisted_queries(self, file_path: str) -> None

Load the persisted queries.

save_persisted_queries

def save_persisted_queries(self, file_path: str) -> None

Save the persisted queries.

before

async def before(self, context: dict[str, Any]) -> None

Perform the before operation for persisted queries extension.

after

async def after(self, context: dict[str, Any], result: dict[str, Any]) -> None

Perform the after operation for persisted queries extension.


Playgrounds

GraphiQL

GraphiQLPlayground(self, endpoint: str='/graphql')

View implementation

Public methods and properties

render

async def render(self, request: Request) -> HTMLResponse

Altair

AltairPlayground(self, endpoint: str='/graphql')

View implementation

Public methods and properties

render

async def render(self, request: Request) -> HTMLResponse

Utilities

async def graphql(schema: Any, query: str, variables: dict[str, Any] | None=None, context: Any=None, operation_name: str | None=None) -> dict[str, Any]

Execute a GraphQL query against a schema. Shorthand for schema.execute(...).

View implementation

def graphql_to_dict(obj: Any) -> dict[str, Any]

Provide to dict behavior for GraphQL integration.

View implementation

def graphql_to_json(obj: Any) -> str

Provide to json behavior for GraphQL integration.

View implementation

def graphql_format_error(message: str, line: int | None=None, column: int | None=None) -> dict[str, Any]

Provide format error behavior for GraphQL integration.

View implementation

def graphql_is_valid_name(name: str) -> bool

Provide is valid name behavior for GraphQL integration.

View implementation

def graphql_sanitize_name(name: str) -> str

Provide sanitize name behavior for GraphQL integration.

View implementation


Exceptions

GraphQLError

GraphQLError(self, message: str, locations: list[dict[str, int]] | None=None, path: list[str | int] | None=None)

Report a graph qlerror failure.

View implementation

Public methods and properties

to_dict

def to_dict(self) -> dict[str, Any]

Return a dictionary representation of the current value.


GraphQL Exceptions

GraphQLSyntaxError(self, message: str, line: int, column: int)

Report a graph qlsyntax failure.

View implementation

GraphQLValidationError(self, message: str)

Report a graph qlvalidation failure.

View implementation

GraphQLExecutionError(self, message: str)

Report a graph qlexecution failure.

View implementation

GraphQLTypeError(self, message: str)

Report a graph qltype failure.

View implementation


AST

Document(self, definitions: list[Any])

Document implementation for the graphql subsystem.

View implementation

OperationDefinition(self, operation: str, name: Any=None, variable_definitions: list[Any] | None=None, directives: list[Any] | None=None, selection_set: Any=None)

Operation definition implementation for the graphql subsystem.

View implementation

SelectionSet(self, selections: list[Any])

Selection set implementation for the graphql subsystem.

View implementation

Field(self, name: Any, alias: Any=None, arguments: list[Any] | None=None, directives: list[Any] | None=None, selection_set: Any=None)

Validate and convert field values.

View implementation

FragmentSpread(self, name: Any, directives: list[Any] | None=None)

Fragment spread implementation for the graphql subsystem.

View implementation

InlineFragment(self, type_condition: Any=None, directives: list[Any] | None=None, selection_set: Any=None)

Inline fragment implementation for the graphql subsystem.

View implementation

FragmentDefinition(self, name: Any, type_condition: Any, directives: list[Any] | None=None, selection_set: Any=None)

Fragment definition implementation for the graphql subsystem.

View implementation

VariableDefinition(self, name: Any, type: Any, default_value: Any=None)

Variable definition implementation for the graphql subsystem.

View implementation

Variable(self, name: Any)

Variable implementation for the graphql subsystem.

View implementation

Name(self, value: str)

Name implementation for the graphql subsystem.

View implementation

Argument(self, name: Any, value: Any)

Argument implementation for the graphql subsystem.

View implementation

Directive(self, name: Any, arguments: list[Any] | None=None)

Directive implementation for the graphql subsystem.

View implementation

NamedType(self, name: Any)

Named type implementation for the graphql subsystem.

View implementation

ListType(self, type: Any)

List type implementation for the graphql subsystem.

View implementation

NonNullType(self, type: Any)

Non null type implementation for the graphql subsystem.

View implementation

IntValue(self, value: str)

Int value implementation for the graphql subsystem.

View implementation

FloatValue(self, value: str)

Float value implementation for the graphql subsystem.

View implementation

StringValue(self, value: str)

String value implementation for the graphql subsystem.

View implementation

BooleanValue(self, value: bool)

Boolean value implementation for the graphql subsystem.

View implementation

ListValue(self, values: list[Any])

List value implementation for the graphql subsystem.

View implementation

ObjectValue(self, fields: list[Any])

Object value implementation for the graphql subsystem.

View implementation

ObjectField(self, name: Any, value: Any)

Validate and convert object field values.

View implementation

Use this capability in a full-stack app

Flaxon serves Python APIs and Teloce interfaces in one project. Keep validation, authorization and privileged operations on the server; components call those endpoints and present their results. Follow the full-stack lessons and Teloce integration reference to connect this capability to pages, components and application modules.