Skip to content

Consider resolving root __typename as schema introspection #867

Open
@yanns

Description

@yanns

Description

SchemaIntrospectionQuery::split_and_execute cannot solve the query { __typename }

Steps to reproduce

I'm playing with the introspection with a code similiar to https://github.com/apollographql/apollo-rs/pull/859/files

When I use a query like { __schema { types { name } } }, everything is working fine.
When I use the query { __typename }, the execute_non_introspection_parts function is being called.

Expected result

SchemaIntrospectionQuery::split_and_execute should solve the query { __typename } and return the following:

{
  "data": {
    "__typename": "Query"
  }
}

Actual result

The code panic as the following function is being called:

|_| panic!("Provided query must not have non-introspection elements")

https://github.com/apollographql/apollo-rs/pull/859/files#diff-6416f1ff6c1a61aa6817f3430bcde09ca29f1fdb819603a5058d7991a33adfd1R42

Environment

  • apollo-compiler = "=1.0.0-beta.17"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions