Skip to content

Allow lists of types as data type #11

@ericbstie

Description

@ericbstie

Fields of QueryBuilders should support lists. Currently, a type like this:

class ListedNames(QueryBuilder):
    name: list[str]

raises an error when being built:

ValueError: Invalid field type: list[str]

The implementation must support any n-dimensional list (e.g. [[[[[String]]]]] should be allowed).

import gqlrequests

class Episode(gqlrequests.QueryBuilder):
    name: str
    length: float

class Character(gqlrequests.QueryBuilder):
    name: str
    appearsIn: list[Episode]


print(Character)
print(Character().build())

should print:

type Character {
    name: String
    appearsIn: [Episode]
}
{
    name
    apearsIn
}

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions