Skip to content

Best practice to construct nested query variables #217

@elados93

Description

@elados93

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions