public FieldSelectionVisitor(GraphQlSchemaCursor schemaCursor, QueryTreeCursor queryTreeCursor) { this.schemaCursor = schemaCursor; this.queryTreeCursor = queryTreeCursor; }
public static string Run(string query, GraphQlSchema schema) { ParsedQuery parsedQuery = GraphQlParser.ParseQuery(query); var schemaCursor = new GraphQlSchemaCursor(schema); var queryTree = new QueryTree(); var queryTreeCursor = new QueryTreeCursor(queryTree); var visitorLookup = new ParsedQueryNodeVisitorLookup(); visitorLookup.RegisterForNode<ParsedQuery>(new NullQueryParsedQueryNodeVisitor()); visitorLookup.RegisterForNode<ParsedField>(new FieldSelectionVisitor(schemaCursor, queryTreeCursor)); ParsedQueryTraverser.Traverse(parsedQuery, visitorLookup); }