Example #1
0
        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);
        }
Example #2
0
 public GraphQlSchemaCursor(GraphQlSchema schema)
 {
     Current = schema.Query;
 }
Example #3
0
 public void GivenIHaveASchemaThatHasAQueryOfThatType()
 {
     schema = new GraphQlSchema(currentType.As<GraphQlObject>());
 }