Skip to content

Automatic array handling #1

@yeegor

Description

@yeegor

Overview

Currently, when an array-like field is getting created, it is necessary to pass an additional argument to the creation process:

const people = new Query('people', true)
    .addField('friends', true)
    .addField(new Field('parents', true)
        .addField('gender')
        .addField('age')
    );

const result = await client.post(people);

result[0].friends[0];
result[0].parents[0].gender;
result[0].parents[0].age;

Expected behavior

In the ideal world, this is handled completely automatically.

Brief mockup:

  1. Use GraphQL type introspection functionality to generate the schema of TS types locally.
  2. When building the type - either during the field generation process or query fetching, use the generated schema to determine whether the field is an array or not.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions