예제 #1
0
        /// <summary>
        ///     Parse <see cref="document"/> into <see cref="GraphQLDocument"/>
        /// </summary>
        /// <param name="document"></param>
        /// <returns></returns>
        public static GraphQLDocument ParseDocument(string document)
        {
            var lexer  = new Lexer();
            var parser = new GraphQLParser.Parser(lexer);

            return(parser.Parse(new Source(document)));
        }
예제 #2
0
 /// <summary>
 ///     Parse <see cref="document"/> into <see cref="GraphQLDocument"/>
 /// </summary>
 /// <param name="document"></param>
 /// <returns></returns>
 public static Task <GraphQLDocument> ParseDocumentAsync(string document)
 {
     return(Task.Factory.StartNew(() =>
     {
         var lexer = new Lexer();
         var parser = new GraphQLParser.Parser(lexer);
         return parser.Parse(new Source(document));
     }));
 }
    public void GraphQL_dotnet_Parser_IntrospectionQuery()
    {
        var document = Parser.Parse(IntrospectionQuery);

        if (document.Definitions?.Any() == false)
        {
            throw new InvalidOperationException("Failed");
        }
    }
        public void GraphQL_dotnet_Parser_IntrospectionQuery()
        {
            var parser   = new GraphQLParser.Parser(new Lexer());
            var source   = new Source(IntrospectionQuery);
            var document = parser.Parse(source);

            if (!document.Definitions.Any())
            {
                throw new InvalidOperationException("Failed");
            }
        }