graphql icon indicating copy to clipboard operation
graphql copied to clipboard

Errors on schema with interfaces

Open bombillazo opened this issue 4 years ago • 1 comments

Given a schema with interfaces:

type Account {
  id: ID
  profile: ProfileData!
} 

interface Profile {
  email: String
  phone: String
}

type ProfileData {
  personal: PersonalProfile
  business: BusinessProfile
}

type PersonalProfile implements Profile {
  firstName: String!
  lastName: String!
  email: String
  phone: String
}

type BusinessProfile implements Profile {
  name: String!
  type: BusinessTypes
  email: String
  phone: String
}

@miragejs/graphql gets confused when trying to create Models. The attempts to create a ProfileData record using server.create('profileData') gives an error indicating there is no model nor factory available for it. In addition, a Profile model is created when there should be none since it is an interface.

bombillazo avatar Jul 21 '21 01:07 bombillazo

Which version of the library were you using when you encountered this issue? There are similar tests for this in the project. I modified the test schema and tests locally to more closely match your scenario and everything is working as expected.

jneurock avatar Jan 16 '22 12:01 jneurock