GithubHelp home page GithubHelp logo

grafq's People

Contributors

asmello avatar

Watchers

 avatar  avatar

grafq's Issues

Investigate dynamic type hinting

It would be very nice if the Schema class (and TypedField) could provide dynamic type hinting without us having to go through the static code generation. The dataclass module seems to do something like that.

[Feature] Static type checking

At #4, I found out that there isn't really a way to do type checking statically while using dynamic code (sounds obvious, but dataclass does it, only by cheating!). This means that to improve the type validation experience, some form of static code must be used.

Two options available are:

  1. Allow users to define their data classes, and provide thoughtful interfaces for interoperating with library code seamlessly. In other words, let users define something like dataclasses, and we only implement the logic behind their operation.
  2. Fully generate the classes code from the GraphQL schema, by providing a script utility to users. This autogenerated codebase will have be be occasionally regenerated to pick up API changes, and cannot be customised (otherwise syncing will be a nightmare), but once in place, users can get the best out of their IDEs without writing any additional code.

There are obviously tradeoffs involved.

(1) has been used successfully for many ORM libraries (think SQLAlchemy), and is a very flexible approach that allows for interesting customisation opportunities. But this comes at the cost of delegating part of the work back to users - even though we know the types at runtime, they still have to, er, type them all up.

(2)'s approach been used successfully in some libraries like conjure-python. It requires breaking the glass a bit and instead of just importing this library, users will have to run a local script, and maintain their own snowflake code. Customisation is technically possible, but ill advised since they make automatically synchronising with the remote API non-trivial.

I suppose it doesn't have to be either-or, but I have to pick one to focus on first.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.