DocumentValidator { public BoundDocument validate(final GQLDocument doc, final DiagnosticListener<String> collector) { return new BoundDocument(this.schema, doc); } DocumentValidator(final ResolvedSchema schema); BoundDocument validate(final GQLDocument doc, final DiagnosticListener<String> collector); BoundDocument validate(final String doc, final DiagnosticListener<String> collector);  }
@Test public void test() { final SchemaCompiler compiler = new SchemaCompiler(); compiler.addUnit("type HelloWorldService { hello(name: String): String }"); final Map<GQLOperationType, String> ops = ImmutableMap.of(GQLOpType.Query, "HelloWorldService"); final ResolvedSchema schema = new ResolvedSchema(compiler, ops); final DocumentValidator validator = new DocumentValidator(schema); final ValidationCollector<String> collector = new ValidationCollector<>(); final BoundDocument bound = validator.validate("query getHello($a: String!) { hello(name: $a) }", collector); System.err.println(bound); collector.diagnostics() .forEach(System.err::println); }