Trying to use the same class with a normal type and input type in the same schema results in an java.lang.IllegalArgumentException: value already present exception for the class in question.
import com.coxautodev.graphql.tools.GraphQLMutationResolver;
import com.coxautodev.graphql.tools.GraphQLQueryResolver;
import com.coxautodev.graphql.tools.SchemaParser;
public class Example implements GraphQLQueryResolver, GraphQLMutationResolver {
public static void main(String... args) {
SchemaParser.newParser()
.schemaString(
"type Value { s: String }" +
"type ValueInput { s: String }" +
"type Query { get: Value! }" +
"type Mutation { set(value: ValueInput): String! }"
)
.resolvers(new Example())
.build();
}
public Value get() { return new Value(); }
public String set(Value value) { return value.getS(); }
static class Value {
private String s;
public String getS() { return s; }
public void setS(String s) { this.s = s; }
}
}
Running this with graphql-java-tools 4.1.0 throws
Exception in thread "main" com.coxautodev.graphql.tools.SchemaClassScannerError: Error creating bimap of type => class
at com.coxautodev.graphql.tools.SchemaClassScanner.validateAndCreateParser(SchemaClassScanner.kt:126)
at com.coxautodev.graphql.tools.SchemaClassScanner.scanForClasses(SchemaClassScanner.kt:96)
at com.coxautodev.graphql.tools.SchemaParserBuilder.build(SchemaParserBuilder.kt:126)
at Example.main(Example.java:15)
Caused by: java.lang.IllegalArgumentException: value already present: class Example$Value
at com.google.common.collect.HashBiMap.put(HashBiMap.java:287)
at com.google.common.collect.HashBiMap.put(HashBiMap.java:262)
at com.coxautodev.graphql.tools.SchemaClassScanner.validateAndCreateParser(SchemaClassScanner.kt:123)
... 3 more
Explicitly adding the name and class with dictionary results in a similar exception.
I am also facing same issue , using graphql-java 6.0 and graphql-java-tool 4.3.0. kindly help to know the rite approach to solve the issue. Thanks in advance.
Trying to use the same class with a normal type and input type in the same schema results in an
java.lang.IllegalArgumentException: value already present
exception for the class in question.Running this with
graphql-java-tools
4.1.0 throwsExplicitly adding the name and class with
dictionary
results in a similar exception.