graphql-java-tools icon indicating copy to clipboard operation
graphql-java-tools copied to clipboard

Add support for unused types for all dictionary types

Open timward60 opened this issue 2 years ago • 0 comments

Resolves #736

Checklist

  • [X] Pull requests follows the contribution guide
  • [X] New or modified functionality is covered by tests

Description

For unused type handling in SchemaClassScanner, when processing unused types, allow the dictionary to inject all types (EnumTypeDefinition, InterfaceTypeDefinition, etc) in addition to ObjectTypeDefinition.

Without this, we see an issue that the injecting enum that is being used by a missing field resolver custom implementation (we support preview only GraphQL schema where we fake data) results in an exception being thrown by the graphql-java-tools:

graphql.kickstart.tools.SchemaError: Expected type 'MyEnum' to be a GraphQLInputType, but it wasn't!  Was a type only permitted for object types incorrectly used as an input type, or vice-versa?  at
graphql.kickstart.tools.SchemaParser.determineInputType(SchemaParser.kt:409)  at 
graphql.kickstart.tools.SchemaParser.determineInputType(SchemaParser.kt:389)  at 
graphql.kickstart.tools.SchemaParser.createArgument(SchemaParser.kt:302) at 
graphql.kickstart.tools.SchemaParser.createField(SchemaParser.kt:292)

timward60 avatar Mar 07 '23 08:03 timward60