ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.28k stars 748 forks source link

StrawberryShake is not generating fields when fragments are used on interfaces #2147

Closed gmiserez closed 3 years ago

gmiserez commented 4 years ago

Summary

When a type implements several interfaces, and you use a fragment on one of these interfaces, the fields invoked in that fragment are not generated. The workaround is to not make fragments on interfaces.

How to reproduce

Given the following Schema:

type Query {
    vehicles: [Vehicle!]!
}

interface Vehicle {
    id: ID!
}

interface Car {
    nbSeats: Int!
}

type SportsCar implements Vehicle & Car {
    id: ID!
    nbSeats: Int!
}

type FamilyCar implements Vehicle & Car {
    id: ID!
    nbSeats: Int!
    securityRating: Int!
}

"The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `\"4\"`) or integer (such as `4`) input value will be accepted as an ID."
scalar ID

"The `Int` scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1."
scalar Int

Write the following Query:

query getVehicles {
  vehicles{
    ... on Car {
      nbSeats
    }
  }
}

Results

Missing Interface

Missing Interface

System Info

StrawBerryShake 11.0.0-preview.136

Sample

Demo repository available here

gmiserez commented 4 years ago

Seems to be the same bug than #2004

michaelstaib commented 3 years ago

This is now fixed.