Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: __typename should succeed on root fields #573

Conversation

mattjohnsonpint
Copy link
Member

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

Sorry, something went wrong.

Unverified

This user has not yet uploaded their public signing key.

Unverified

This user has not yet uploaded their public signing key.
@mattjohnsonpint mattjohnsonpint requested a review from a team as a code owner 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
45 checks passed
@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 join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants