graphql
graphql copied to clipboard
Errors on schema with interfaces
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.
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.