Skip to content

Typing of array_slice as Sequence in connection methods #29

Closed
@markedwards

Description

@markedwards

I'm implementing graphql_relay in a GraphQL implementation to handle Connection responses by passing django.db.models.QuerySet objects to the array_slice argument of connection_from_array_slice(), much in the same way that Graphene does.

Although I have assured myself that this works, the typing of array_slice as Sequence is a bit disconcerting, since QuerySet does not qualify as a Sequence instance. As far as I can tell, there isn't an appropriate standard type that would solve this, however. The best idea I have would be to define a custom Protocol, but that might pose compatibility challenges for older python installs.

Is there any appetite to resolve this so that a class like QuerySet type-checks without having to cast or ignore it? Barring that, can it at least be stated that graphql_relay will continue to support QuerySet in this way? I assume that is the intention since Graphene relies on it.

Metadata

Metadata

Assignees

Labels

discussionNeeds more discussioninvestigateNeeds investigaton or experimentation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions