CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-ariadne

Ariadne is a Python library for implementing GraphQL servers using a schema-first approach.

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

federation.mddocs/

Apollo Federation

Support for Apollo Federation allowing microservice architecture with federated GraphQL schemas.

Capabilities

Federated Types

class FederatedObjectType(ObjectType):
    """Object type with Apollo Federation support."""
    
    def __init__(self, name: str): ...
    
    def reference_resolver(self, resolver_func: Callable):
        """Set entity reference resolver."""

class FederatedInterfaceType(InterfaceType):
    """Interface type with Apollo Federation support."""
    
    def __init__(self, name: str): ...
    
    def reference_resolver(self, resolver_func: Callable):
        """Set entity reference resolver."""

Federated Schema

def make_federated_schema(
    type_defs: Union[str, list[str]],
    *bindables,
    **kwargs
) -> GraphQLSchema:
    """Create Apollo Federation-compatible schema."""

Usage Examples

from ariadne.contrib.federation import FederatedObjectType, make_federated_schema

type_defs = """
    extend type User @key(fields: "id") {
        id: ID! @external
        posts: [Post!]!
    }
"""

user_type = FederatedObjectType("User")

@user_type.reference_resolver
def resolve_user_reference(representation):
    return get_user_by_id(representation["id"])

schema = make_federated_schema(type_defs, user_type)

Install with Tessl CLI

npx tessl i tessl/pypi-ariadne

docs

asgi.md

core-schema.md

error-handling.md

execution.md

explorer.md

federation.md

file-uploads.md

index.md

relay.md

resolvers.md

type-bindables.md

validation.md

tile.json