0.0.4 • Published 3 years ago

@enra-gmbh/graphql-codegen-ariadne v0.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

GraphQL Code Generator Plugin for Ariadne

This repository is a plugin for GraphQL Code Generator that can be used to generate Python type hints when implementing GraphQL servers with Ariadne.

Features

See the tests directory for examples of what it can do currently.

  • Create typing.Enums from SDL enum.
  • Create typing.TypedDicts from GraphQL type and input.
  • Create special ariadne.ObjectType with an overloaded set_field method for type safe resolver registration.
  • Allow field access through attributes instead of through string dictionary keys like Ariadne (implement with typing.protocol and @property, mypy docs).
  • Allow Callable for field resolvers.
  • Allow type-safe usage of Ariadne's decorator for resolver registration.
  • Type with the custom Enums that you pass to Ariadne.

Usage

Note: this plugin is more of a proof of concept in its current stage.

Set up Graphql Code Generator following the documentation.

Install graphql-codegen-ariadne. Then add it to codegen.yml. (Again, see documentation of Graphql Code Generator).

overwrite: true
schema: "/schema.graphql"
documents: "**/*.graphql"
generates:
  graphql_types.py:
    plugins:
      - "graphql-codegen-ariadne"

This plugin currently has no configuration.

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago