AsiPanda / graphqlient

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GraphQLient

Typed GraphQL client code generator built on top of GQL.

Tries to make python-written queries easier instead of relying on the user to remember all the correct and required types (I mean who can remember the whole graphql schema of an API right).

All fields are annotated with types, IDE auto-completion and hints should work.

Dev setup

  1. poetry install
  2. poetry run python -m tests.generate
  3. Use client generated in tests/*/generated/client.py
  4. For mocked JOBS api - docker run -d --rm -p 127.0.0.1:9002:9002 -v "$(pwd)/tests/graphql-faker:/mock" apisguru/graphql-faker /mock/schema.graphql

Building client package

  1. poetry install
  2. poetry run python -m gqlient.cli --help for further instructions

Roadmap

  • Basic client generation
  • Simple queries
  • Actually creating and executing queries
  • Nested fields
  • Fragments, Unions, Interfaces
  • Class renaming
  • Mutations
  • Hinting for return types
  • Class-like access for returned data
  • Hinting for returned union/interface types
  • Aliases
  • Better hinting for returned union/interface types (resolve field type clashes with aliases etc.)
  • Separate client code to multiple modules
  • Add docstrings from graphql schema documentation
  • Eliminate duplicated code
  • Eliminate duplicated templates
  • Conditional imports
  • Tests
  • Documentation
  • Structured jinja templates
  • Well formatted Python code (spaces, blank lines, etc)
  • Client customization
  • Async
  • Subscriptions
  • Minimal dependency client (including required packages etc.)

About


Languages

Language:Jinja 50.8%Language:Python 48.4%Language:Shell 0.8%