Skip to content
This repository was archived by the owner on Sep 11, 2025. It is now read-only.

Conversation

@mattjohnsonpint
Copy link
Contributor

Description

We already support returning __typename fields on user-defined types, such as:

query {
    people {
        __typename
        firstName
        lastName
        fullName
    }
}

... which would give "Person" for the __typename field.

However, asking for __typename on the root Query or Mutation currently fails, and it should succeed. This is important because some GraphQL clients add __typename to every field in a query, including the root fields.

In other words, these should succeed:

query {
   __typename
}

mutation {
   __typename
}

Checklist

  • Code compiles correctly and linting passes locally
  • For all code changes, an entry added to the CHANGELOG.md file describing and linking to this PR

@mattjohnsonpint mattjohnsonpint requested a review from a team November 8, 2024 19:39
@mattjohnsonpint mattjohnsonpint enabled auto-merge (squash) November 8, 2024 19:41
@mattjohnsonpint mattjohnsonpint merged commit ca1a96d into main Nov 8, 2024
@mattjohnsonpint mattjohnsonpint deleted the mjp/hyp-2591-modus-graphql-layer-does-not-handle-__typename-on-root-types branch November 8, 2024 19:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants