Skip to main content

No project description provided

Project description

Ariadne Extensions

Set of scripts and helper utilities to extend Ariadne GraphQL library

Install

pip install -e git+https://github.com/aleszoulek/ariadne-extensions.git#egg=ariadne-extensions

Features

Federation support

Support for Federation Specification

Features

  1. Generate federation schema types and directives (_Any, _FieldSet, ...)
  2. Implements {_service{sdl}} query
  3. Detects boundary types and generates _Entities union
  4. Resolve reference helpers for boundary types queried over {_entities} query
from os.path import dirname, join
from ariadne import QueryType, ObjectType, snake_case_fallback_resolvers

from ariadne_extensions import federation

query_type = QueryType()
manager = federation.FederatedManager(
    schema_sdl_file=join(dirname(__file__), 'schema.graphql'),
    query=query_type,
)

user_type = federation.FederatedObjectType('User')
photo_type = ObjectType('Photo')

@user_type.resolve_reference
def resolve_user_reference(reference):
    user_id = reference.get('id')
    return get_user_by_id(user_id)

@user_type.field('name')
def resolve_billing_account(obj, *_, id):
    return f'{obj.first_name} {obj_last_name}'

manager.add_types(user_type, photo_type)
manager.add_types(snake_case_fallback_resolvers)

schema = manager.get_schema()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ariadne-extensions-0.1.2.tar.gz (3.1 kB view details)

Uploaded Source

File details

Details for the file ariadne-extensions-0.1.2.tar.gz.

File metadata

  • Download URL: ariadne-extensions-0.1.2.tar.gz
  • Upload date:
  • Size: 3.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.1.0 requests-toolbelt/0.9.1 tqdm/4.34.0 CPython/3.7.4

File hashes

Hashes for ariadne-extensions-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ec552abd607b462d0da8a865340069e246bd1700cd4a55855710e2e440526279
MD5 d7e6fcc0e0c5d8548b8513e2fe608b98
BLAKE2b-256 d270939292c417ed5d1cee56acb8772211305e776540ba7e02881cfa79bca8fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page