Skip to content

TypeError in validateTypeImplementsInterface #2504

@MichalLytek

Description

@MichalLytek

In TypeGraphQL I have a test case for throwing an error when object type field type doesn't match with the interface one, like:

interface SampleInterface {
  sampleField: String!
}
type SampleObject implements SampleInterface {
  sampleField: Int!
}

After upgrading to v15.0.0, it now throws this error:

TypeError: Cannot read property 'type' of undefined
          at validateTypeImplementsInterface (D:\#Projekty\type-graphql\node_modules\graphql\type\validate.js:296:298)
          at validateInterfaces (D:\#Projekty\type-graphql\node_modules\graphql\type\validate.js:276:5)
          at validateTypes (D:\#Projekty\type-graphql\node_modules\graphql\type\validate.js:198:7)
          at validateSchema (D:\#Projekty\type-graphql\node_modules\graphql\type\validate.js:54:3)
          at graphqlImpl (D:\#Projekty\type-graphql\node_modules\graphql\graphql.js:79:62)
          at D:\#Projekty\type-graphql\node_modules\graphql\graphql.js:28:59
          at new Promise (<anonymous>)
          at Object.graphql (D:\#Projekty\type-graphql\node_modules\graphql\graphql.js:26:10)
          at Function.generateFromMetadata (D:\#Projekty\type-graphql\src\schema\schema-generator.ts:111:32)
          at Object.buildSchema (D:\#Projekty\type-graphql\src\utils\buildSchema.ts:31:40)

What I am doing to validate that is to execute the introspection query against the built schema.

In v14.x it was throwing a normal GraphQLError with a detailed info about this invalid interface implementation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions