# @enra-gmbh/graphql-codegen-ariadne

> GraphQL Code Generator plugin for generating Python types helpful when implementing GraphQL servers with Ariadne.

Latest version **0.0.4** (published 2021-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @enra-gmbh/graphql-codegen-ariadne
pnpm add @enra-gmbh/graphql-codegen-ariadne
yarn add @enra-gmbh/graphql-codegen-ariadne
bun add @enra-gmbh/graphql-codegen-ariadne
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2021-04-21 |
| First published | 2021-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 15 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6 |
| Maintainers | enra-gmbh |

## Links

- npm: https://www.npmjs.com/package/@enra-gmbh/graphql-codegen-ariadne
- Repository: https://github.com/enra-GmbH/graphql-codegen-ariadne
- Homepage: https://github.com/enra-GmbH/graphql-codegen-ariadne#readme
- Issues: https://github.com/enra-GmbH/graphql-codegen-ariadne/issues
- npm.io page: https://npm.io/package/@enra-gmbh/graphql-codegen-ariadne

## Dependencies (2)

- [auto-bind](https://npm.io/package/auto-bind.md) ^4.0.0
- [change-case-all](https://npm.io/package/change-case-all.md) ^1.0.14

## Recent versions

- 0.0.4 (latest) — 2021-04-21
- 0.0.3 — 2021-04-08
- 0.0.2 — 2021-04-08
- 0.0.1 — 2021-04-07

## README

# GraphQL Code Generator Plugin for Ariadne

This repository is a plugin for [GraphQL Code Generator](https://www.graphql-code-generator.com/) that can be used to generate Python type hints when implementing GraphQL servers with [Ariadne](https://ariadnegraphql.org/).

## Features

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

  - [x] Create `typing.Enum`s from SDL `enum`.
  - [x] Create `typing.TypedDict`s from GraphQL `type` and `input`.
  - [x] 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](https://mypy.readthedocs.io/en/stable/protocols.html#recursive-protocols)).
  - [ ] Allow `Callable` for field resolvers.
  - [ ] Allow type-safe usage of Ariadne's decorator for resolver registration.
  - [ ] Type with the custom `Enum`s that you [pass to Ariadne](https://ariadnegraphql.org/docs/enums).

## Usage

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

Set up Graphql Code Generator following the [documentation](https://www.graphql-code-generator.com/docs/getting-started/installation).


Install `graphql-codegen-ariadne`. Then add it to `codegen.yml`. (Again, see [documentation](https://www.graphql-code-generator.com/docs/getting-started/codegen-config) 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.

---
_Source: https://npm.io/package/@enra-gmbh/graphql-codegen-ariadne · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
