Coverage for src/lexigram/graphql/protocols.py: 0%

10 statements  

« prev     ^ index     » next       coverage.py v7.15.4, created at 2026-08-25 04:37 +0800

1"""GraphQL protocol re-exports. 

2 

3Central contract imports for the lexigram-graphql package. 

4All protocol definitions live in ``lexigram.contracts.graphql``; this module 

5re-exports the ones that are relevant to consumers of lexigram-graphql so 

6they can import from a single, stable location. 

7 

8Canonical protocols (from contracts): 

9 SchemaBuilderProtocol - fluent schema-building contract 

10 GraphQLExecutorProtocol - execution contract 

11 ErrorFormatter - error formatting contract 

12 DataLoaderProtocol - batch-loading contract 

13 ResolverProtocol - field-resolver contract 

14""" 

15 

16from __future__ import annotations 

17 

18from collections.abc import Callable 

19from typing import Any 

20 

21from strawberry import Schema 

22 

23from lexigram.contracts.graphql import ( 

24 DataLoaderProtocol, 

25 DirectiveHandlerProtocol, 

26 ErrorFormatterProtocol, 

27 GraphQLExecutorProtocol, 

28 ResolverProtocol, 

29 SchemaBuilderProtocol, 

30 SubscriptionAuthHandlerProtocol, 

31 SubscriptionHandlerProtocol, 

32 ValidationRuleProtocol, 

33) 

34from lexigram.graphql.directives import DeprecationDirectiveHandler, DirectiveRegistry 

35from lexigram.graphql.resolvers import ResolverAdapter, resolver 

36 

37# --------------------------------------------------------------------------- 

38# Public type aliases 

39# --------------------------------------------------------------------------- 

40 

41# A GraphQL schema instance (Strawberry Schema). 

42GraphQLSchema = Schema 

43 

44# A resolver callable — any function that accepts (parent, args, context, info) 

45# and returns Any (sync or async). Kept as a broad alias to avoid coupling to 

46# a specific resolver protocol where plain functions are used. 

47GraphQLResolver = Callable[..., Any] 

48 

49 

50__all__ = [ 

51 # Contracts re-exports 

52 "DataLoaderProtocol", 

53 "DeprecationDirectiveHandler", 

54 "DirectiveHandlerProtocol", 

55 "ErrorFormatterProtocol", 

56 "GraphQLExecutorProtocol", 

57 "ResolverProtocol", 

58 "SchemaBuilderProtocol", 

59 "SubscriptionHandlerProtocol", 

60 "ValidationRuleProtocol", 

61 "WebSocketTransportProtocol", 

62 "resolver", 

63]