Skip to content

Support filtering interface/union types on __typename #1024

@myronmarston

Description

@myronmarston

When querying an abstract type (interface or union type), it's useful to be able to filter on the __typename. However, we can't add a __typename field to the filter because the __ prefix is reserved by GraphQL for the spec's usage:

https://spec.graphql.org/October2021/#sec-Names.Reserved-Names

Any Name within a GraphQL type system must not start with two underscores "__" unless it is part of the introspection system as defined by this specification.

Given that, we punted on supporting filter: {__typename: {equalToAnyOf: [...]}} when we initially implemented support for interface/union types.

It's still a useful feature, though. We can add support by defining it as _typename:

filter: {_typename: {equalToAnyOf: [...]}}

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