-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
Description
Currently we write something like this:
graphql.nodes(['nodeID'], power={'state_eq': 'Down'}, updatedAt_gt=int(1234.567))Some aspects could be nicer:
- We have a mix of quoted strings and unquoted keyword arg names
- There's also a mix of keyword args and passing dicts for nested queries
- It's possible to pass invalid names in some places with no error given, for example
power={'state': 'Down'} - We must cast to the correct data type explicitly
Ideally we could:
from grid3.names import *
graphql.nodes([nodeID], power(state=Down), updatedAt_gt=1234.5678)
By implementing:
-
namescontains variables with the same name as all possible strings used in gql queries (nodeID = 'nodeID', etc), as well as functions with the name of any nested parameters (power) that just return a simple data structure with their own name and any keyword args - Make
_eqthe default operator when none is specified (also check and reject invalid parameter names) - Automatically convert to the correct data type for the input (can derive this from the schema?)