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

False positive warning about missing __typename #98

Open
cmeeren opened this issue Nov 28, 2024 · 2 comments
Open

False positive warning about missing __typename #98

cmeeren opened this issue Nov 28, 2024 · 2 comments

Comments

@cmeeren
Copy link

cmeeren commented Nov 28, 2024

Consider this query:

query MyFavorites {
  me {
    favorites {
      item {
        __typename
        ... on Order {
          id
        }
      }
    }
  }
}

It fails with:

Missing required __typename on sub type Order of type FavoriteItem selected on field item

But __typename is included outside the fragment, on every type.

I can work around it by adding __typename inside ... on Order, but it should not be necessary.

@Zaid-Ajaj
Copy link
Owner

I can work around it by adding __typename inside ... on Order, but it should not be necessary.

Hi there @cmeeren, this indeed doesn't sound necessary as long as the resulting __typename field value is adjacent to the fields of the sub types (Order in this case). This is required by the deserialization libraries to know which union case to unmarshall the data into.

It looks like a doable fix, any chance you could take a stab at it? I could probably look into it but very low on time these days for OSS work

@cmeeren
Copy link
Author

cmeeren commented Nov 28, 2024

It looks like a doable fix, any chance you could take a stab at it? I could probably look into it but very low on time these days for OSS work

Totally understand, I'm in the same position, so unfortunately, I'm not able to prioritize getting into a new codebase at the moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants