0.0.4 • Published 5 years ago
@enra-gmbh/graphql-codegen-ariadne v0.0.4
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 SDLenum. - Create
typing.TypedDicts from GraphQLtypeandinput. - Create special
ariadne.ObjectTypewith an overloadedset_fieldmethod for type safe resolver registration. - Allow field access through attributes instead of through string dictionary keys like Ariadne (implement with
typing.protocoland@property, mypy docs). - Allow
Callablefor 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.