Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best practice to construct nested query variables #217

Open
elados93 opened this issue Nov 15, 2022 · 0 comments
Open

Best practice to construct nested query variables #217

elados93 opened this issue Nov 15, 2022 · 0 comments

Comments

@elados93
Copy link

I'm having a GraphQL schema that I'm using codegen for schema & operations generation, just like the README suggest.

I wonder if there is a better way in sgqlc to construct variables with type hints so the experience will be closer to sending queries with GraphQL playground, see this API example.

I'd like to have:

  1. Autocomplete in IDE (currently fields are part of **kwargs and not part of init args).
  2. Type hints for the variables, mainly because I have many inputs and some of them are nested so it's very errors prune.

currently I'm building my variables with the schema objects I generated:

input = CollectionWhereInput(name='some-collection_name', create_time_gt=datetime.time())
op = Operations.query.get_collections
res = endpoint(op, variables=input.__to_json_value__())

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant