Currently when you try to build a schema and an InputType is expected you get a ClassCastException.
This should be improved by a better Exception, which tells the user what type to expect.
There should also be a test to verify it.
Example:
type MutationType {
addCharacter(character: CharacterInput):
}
# CharacterInput must be an input, but is a type
type CharacterInput {
firstName: String
lastName: String
family: Boolean
}
type MutationResult {
success: Boolean
}
Java:
SchemaCompiler schemaCompiler = new SchemaCompiler();
TypeDefinitionRegistry compiledSchema = schemaCompiler.compile(schemaString);
SchemaGenerator schemaGenerator = new SchemaGenerator();
schemaGenerator.makeExecutableSchema(compiledSchema, buildRuntimeWiring());
Code hints:
https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/idl/SchemaGenerator.java#L210
https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/idl/SchemaGenerator.java#L244
Currently when you try to build a schema and an
InputTypeis expected you get aClassCastException.This should be improved by a better Exception, which tells the user what type to expect.
There should also be a test to verify it.
Example:
Java:
Code hints:
https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/idl/SchemaGenerator.java#L210
https://github.com/graphql-java/graphql-java/blob/master/src/main/java/graphql/schema/idl/SchemaGenerator.java#L244