Giter Club home page Giter Club logo

libgraphqlparser's Introduction

libgraphqlparser

libgraphqlparser is a parser for GraphQL, a query language for describing data requirements on complex application data models, implemented in C++11. It can be used on its own in C++ code (or in C code via the pure C API defined in the c subdirectory), or you can use it as the basis for an extension module for your favorite programming language instead of writing your own parser from scratch.

Example

The provided dump_json_ast is a simple program that reads GraphQL text on stdin and prints a JSON representation of the AST to stdout.

The python subdirectory contains an example Python binding for the pure C API.

Requirements

libgraphqlparser requires a C++ compiler that supports C++11. It also requires Mac OS X or Linux.

To run tests, first, compile and install the library as described above. Then, please download googletest from https://github.com/google/googletest/archive/release-1.8.0.zip and unzip it in the test subdirectory. In consequence, a folder googletest-release-1.8.0 should be contained in test. Next, within the test folder, run cmake . and make to generate the runTests binary. To execute the tests run ./test/runTests from the main folder.

Building libgraphqlparser

libgraphqlparser is built with CMake. If a sufficiently-recent version of Flex and Bison are installed on your system, it will use them; otherwise, it will rely on the checked-in parser.tab.{c,h}pp and lexer.{h,cpp}.

To build libgraphqlparser from source:

$ # inside the project root:
$ cmake .
$ make

Then, to install it on your system:

$ make install

How libgraphqlparser works

libgraphqlparser uses flex and bison to generate a C++ parser for GraphQL. These tools work well but have idiosyncratic interfaces by modern standards, so GraphQLParser.h provides a simple interface to parse GraphQL.

In order to make it simpler to write code based around the GraphQL AST, libgraphqlparser includes an extremely simple code generation framework in the ast/ subdirectory. This framework is used to build the AST classes themselves, as well as a visitor over the AST. It may be easier to understand the output of the generation steps directly (i.e., Ast.h, Ast.cpp, and AstVisitor.h) rather than trying to read the generation scripts. Simply building libgraphqlparser will cause these files to be generated.

libgraphqlparser also uses the AST generation framework to build a pure C API in the c subdirectory. This API can be used from C code, and it should also simplify the task of creating bindings to other programming languages.

License

libgraphqlparser is MIT-licensed.

Related Projects

Contributing to this repo

This repository is managed by EasyCLA. Project participants must sign the free (GraphQL Specification Membership agreement before making a contribution. You only need to do this one time, and it can be signed by individual contributors or their employers.

To initiate the signature process please open a PR against this repo. The EasyCLA bot will block the merge if we still need a membership agreement from you.

You can find detailed information here. If you have issues, please email [email protected].

If your company benefits from GraphQL and you would like to provide essential financial support for the systems and people that power our community, please also consider membership in the GraphQL Foundation.

libgraphqlparser's People

Contributors

aarvay avatar andheiberg avatar brianwarner avatar dosten avatar dylanahsmith avatar eapache avatar erikwittern avatar gjtorikian avatar kenshaw avatar krytarowski avatar leebyron avatar leozz37 avatar mmatsa avatar rmosolgo avatar schloerke avatar steve384 avatar swolchok avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libgraphqlparser's Issues

Add support for building on Windows

Per the README.md Linux or Mac OS are listed as requirements. It would be useful to support building on Windoes.

I gave it a try and there's a few errors, but I was able to hack something together.

Location Lines

I'm looking at the location values for https://github.com/graphql/libgraphqlparser/blob/master/test/schema-kitchen-sink.json and https://github.com/graphql/libgraphqlparser/blob/master/test/kitchen-sink.json.

Both the kitchen sink (request) and schema kitchen sink GraphQL test inputs have comments and white space for the first 7-8 lines. But the locations in the JSON output say the documents start at line 2 and finish before the definitions are done.

Does libgraphqlparser remove comment only lines? The JSON locations do not match the original text definition locations. (Trying to make my print statements match the error information)

(Thank you for the line number addition!)

  • Barret

License

I tried to publish libgraphqlparser bindings but they were rejected because you LICENSE says BSD but the reposity contains several GPL files...

Multiple memory leaks as reported by clang's LeakSanitizer

Build dump_json_ast with -fsanitize=address on Linux x86_64:

$ clang --version
clang version 3.7.0 (https://github.com/llvm-mirror/clang.git 40b68b4c02b9d9e1e4138815747adf5589496240) (https://github.com/llvm-mirror/llvm.git dccade93466c50834dbaa5f4dabb81e90d768c40)
Target: x86_64-unknown-linux-gnu
Thread model: posix

$ mkdir build && cd build

$ env CXX=clang++ CXXFLAGS='-fsanitize=address -ggdb' cmake ..

$ make

and execute the following command:

$ echo -ne '\x7b\x0a\x20\x75\x30\x30\x30\x28\x69\x30\x3a\x20\x39\x30\x45' | ./dump_json_ast

Output:

Parser failed with error: 2.14: syntax error, unexpected EOF, expecting :

=================================================================
==5216==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 96 byte(s) in 2 object(s) allocated from:
    #0 0x4df280 in operator new(unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
    #1 0x7f5672faabc6 in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:232:28
    #2 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #3 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #4 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #5 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x4df280 in operator new(unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
    #1 0x7f5672fadc7f in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:329:36
    #2 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #3 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #4 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #5 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

Indirect leak of 56 byte(s) in 1 object(s) allocated from:
    #0 0x4df280 in operator new(unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
    #1 0x7f5672fadefd in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:333:32
    #2 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #3 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #4 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #5 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

Indirect leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x4df280 in operator new(unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
    #1 0x7f5672faebcb in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:363:32
    #2 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #3 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #4 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #5 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

Indirect leak of 48 byte(s) in 1 object(s) allocated from:
    #0 0x4df280 in operator new(unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
    #1 0x7f5672faabc6 in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:232:28
    #2 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #3 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #4 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #5 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

Indirect leak of 10 byte(s) in 3 object(s) allocated from:
    #0 0x477266 in __interceptor_strdup llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:590
    #1 0x7f5672faac75 in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:232:59
    #2 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #3 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #4 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #5 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

Indirect leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x4df280 in operator new(unsigned long) llvm/projects/compiler-rt/lib/asan/asan_new_delete.cc:62
    #1 0x7f5672fc307b in __gnu_cxx::new_allocator<std::unique_ptr<facebook::graphql::ast::Argument, std::default_delete<facebook::graphql::ast::Argument> > >::allocate(unsigned long, void const*) /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4/ext/new_allocator.h:104:27
    #2 0x7f5672fc2c96 in std::_Vector_base<std::unique_ptr<facebook::graphql::ast::Argument, std::default_delete<facebook::graphql::ast::Argument> >, std::allocator<std::unique_ptr<facebook::graphql::ast::Argument, std::default_delete<facebook::graphql::ast::Argument> > > >::_M_allocate(unsigned long) /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4/bits/stl_vector.h:168:27
    #3 0x7f5672fc20bb in void std::vector<std::unique_ptr<facebook::graphql::ast::Argument, std::default_delete<facebook::graphql::ast::Argument> >, std::allocator<std::unique_ptr<facebook::graphql::ast::Argument, std::default_delete<facebook::graphql::ast::Argument> > > >::_M_emplace_back_aux<facebook::graphql::ast::Argument*&>(facebook::graphql::ast::Argument*&) /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4/bits/vector.tcc:404:22
    #4 0x7f5672fb4d6a in void std::vector<std::unique_ptr<facebook::graphql::ast::Argument, std::default_delete<facebook::graphql::ast::Argument> >, std::allocator<std::unique_ptr<facebook::graphql::ast::Argument, std::default_delete<facebook::graphql::ast::Argument> > > >::emplace_back<facebook::graphql::ast::Argument*&>(facebook::graphql::ast::Argument*&) /usr/lib64/gcc/x86_64-pc-linux-gnu/4.8.4/include/g++-v4/bits/vector.tcc:101:4
    #5 0x7f5672fadd6b in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:329:82
    #6 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #7 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #8 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #9 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

Indirect leak of 3 byte(s) in 1 object(s) allocated from:
    #0 0x477266 in __interceptor_strdup llvm/projects/compiler-rt/lib/asan/asan_interceptors.cc:590
    #1 0x7f5672faec59 in yy::GraphQLParserImpl::parse() libgraphqlparser/build/parser.ypp:363:61
    #2 0x7f5672fd991b in facebook::graphql::doParse(char const**, void*) libgraphqlparser/GraphQLParser.cpp:26:17
    #3 0x7f5672fd9c0c in facebook::graphql::parseFile(_IO_FILE*, char const**) libgraphqlparser/GraphQLParser.cpp:48:17
    #4 0x4e222f in main libgraphqlparser/dump_json_ast.cpp:35:14
    #5 0x7f5671d89aa4 in __libc_start_main (/lib64/libc.so.6+0x21aa4)

SUMMARY: AddressSanitizer: 293 byte(s) leaked in 11 allocation(s).

afl

Allow building C binding out of the box

If I missed something, my apologies, please point me in the right direction.

I would like to wrap this library in Perl. For that I need the C binding built as a dynamic library. This seems not to be supported out of the box.

I added a simple Makefile for my own purposes, and have no problem in creating a pull request for it. But since the project uses cmake, perhaps you would rather do this differently?

Thanks!

Subscriptions

Not sure how much work this is to implement but support for graphql-js compatible subscriptions (maybe with an experimental flag or something?) would be super-useful and really appreciated.

I (very foolishly) assumed libgraphqlparser would support subscriptions when we started building on top of it. Now we've got a whole ruby GraphQL DSL built and nowhere to subscribe :(

Related Conversations:

better test instructions

The readme says:
To run tests, please download googletest from https://github.com/google/googletest/archive/release-1.8.0.zip and unzip it in the test subdirectory.

And that's it. I downloaded googletest in the test directory, ran cmake . and then tried with several make targets, but they all failed:

libgraphqlparser/test/ParserTests.cpp:13:10: fatal error: 'Ast.h' file not found

(after adding symlinks for the missing header files)

libgraphqlparser/test/Ast.h:237:43: error: a space is required between consecutive right angle brackets (use '> >')

I am pretty sure I missed a step here. Could some more detailed info be provided in the readme? Perhaps add a test/README.md?

Pure C API doesn't provide a way to access individual list-style subnodes

For example: Given I have a handle to a GraphQLAstSelectionSet, I can access the number of selections contained within it by calling GraphQLAstSelectionSet_get_selections_size. But how do I get a handle to a specific selection in the list? Is there a way to enumerate the selections contained within the selection set without resorting to visitors?

This also applies to other nodes with subnode lists, e.g. Document -> definitions, FragmentSpread -> directives etc.

Disclaimer: As I'm fairly new to all this stuff, I may be missing something really obvious here.

ast::Node::accept() not const

Any reason that ast::Node::accept() is not const?

It would be great to create a nested visitor while visiting and we can't call accept() on any nested nodes because we always have const pointers or references to them.

possible memory leak

Performing fuzzy testing on libgraphqlparser. Libfuzzer and Valgrind complain of memory leaks. For an input file with content

START FILE

{d }#s
b{a }

END FILE

376 (48 direct, 328 indirect)
yy::GraphQLParserImpl::parse() (parser.ypp:336)
facebook::graphql::doParse(char const**, void*, bool)(GraphQLParser.cpp:24)

Probably parser trying to create new document for second line without deleting first one which was created for line1 "{d }#s".

Statically linking library

I'm trying to write bindings for the Rust programming language. Is there a way to statically link this project?

Support for defining a schema

Hi, thank you for this project!
I am very new to GraphQL so forgive me if I am asking naive questions :).
I am considering implementing a graphql server in C++, and while I see that libgraphqlparser offer parsing of a graphql query, I could not find if it offers creating of Schema and executing query against it?

I know that in other languages(js) the idea is to generate the schema and then when query arrives it is parsed, validated and executed against the schema, so that is why I am looking for the libraries that would support the same thing in C++.

If there is support, would you mind sharing some code examples? Thanks!

Python version not used during install

I have both python 3.5 and 2.7 installed in my machine (Arch Linux) but whenever I run the cmake . command it always picks /usr/bin/python which links to 3.5.

Currently I just made /usr/bin/python to point into 2.7 but it would be better if the build script would pick the correct one.

Missing support for descriptions

Descriptions allow to annotate definitions in a GraphQL schema with human-readable content, which is also made available via introspection. It seems that libgraphqlparser currently fails when encountering descriptions with an exception of the following type:

Parser failed with error: <line.column-length>: syntax error, unexpected STRING, expecting EOF

New release with `make install`

Hello! Thank you for your open source contribution. We're trying to package this up for easy install through Homebrew and are using the 0.1.0 release tag for the tar.gz packaging. However 0.1.0 doesn't have the make install task. Could you please create a new release with the make install task?

Thanks!

Homebrew/legacy-homebrew#44389

Various compiler warnings

And GCC6:

c:/Rtools/mingw_64/bin/g++  -std=gnu++11 -I"C:/PROGRA~1/R/R-devel/include" -DNDEBUG -I. -Ic   -I"C:/Users/Jeroen/Documents/R/win-library/3.4/Rcpp/include" -I"d:/Compiler/gcc-4.9.3/local330/include"  -D__USE_MINGW_ANSI_STDIO   -O2 -Wall  -mtune=core2 -c JsonVisitor.cpp -o JsonVisitor.o
JsonVisitor.cpp: In member function 'void facebook::graphql::ast::visitor::JsonVisitor::printChildList(const const_iterator&, size_t)':
JsonVisitor.cpp:41:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int ii = 0; ii < numChildren; ++ii) {
                       ^
g++ -fsanitize=address,undefined,bounds-strict -fno-omit-frame-pointer -fno-sanitize=object-size,vptr -std=gnu++11 -I/usr/local/lib/R/include -DNDEBUG -I. -Ic -I/usr/local/include -I"/usr/local/lib/R/site-library/Rcpp/include"   -fpic  -pipe -Wall -pedantic -O2 -mtune=native -c lexer.cpp -o lexer.o
lexer.lpp: In function ‘int yylex(yystype*, yy::location*, yyscan_t)’:
lexer.lpp:89:33: warning: format ‘%x’ expects argument of type ‘unsigned int*’, but argument 3 has type ‘int*’ [-Wformat=]
     sscanf(yytext + 1, "%x", &ch);

And on Xcode8:

lexer.cpp:796:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
lexer.cpp:797:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
lexer.cpp:797:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
lexer.cpp:798:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int yy_act;
        ^~~~~~~~~
lexer.cpp:856:4: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
                        ^~~~~~~~~
lexer.cpp:1326:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
        ^~~~~~~~~
lexer.cpp:1327:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *source = yyg->yytext_ptr;
        ^~~~~~~~~
lexer.cpp:1328:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int number_to_move, i;
        ^~~~~~~~~
lexer.cpp:1328:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int number_to_move, i;
        ^~~~~~~~~
lexer.cpp:1460:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
lexer.cpp:1461:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp;
        ^~~~~~~~~
lexer.cpp:1468:3: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
                ^~~~~~~~~
lexer.cpp:1493:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register int yy_is_jam;
        ^~~~~~~~~
lexer.cpp:1495:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register char *yy_cp = yyg->yy_c_buf_p;
        ^~~~~~~~~
lexer.cpp:1497:2: warning: 'register' storage class specifier is deprecated and incompatible with C++1z [-Wdeprecated-register]
        register YY_CHAR yy_c = 1;
        ^~~~~~~~~

Thread safety

The README should clarify about the thread safety of the library so it's clearer if/how to use on multithreaded environments.

tag name is missing `v`

Did you intentionally leave out the v in the tag name this time? I don't care either way but just wanted to check.

CMake 3.1.0 required, only used for setting C++11 standard

CMake 3.1.0 is required to configure the buildsystem.
From what I can tell 3.1.0 is only needed for setting the C++ standard to C++11.

Unfortunately, even a recent Ubuntu 15.04 only comes with CMake 3.0.2.

It would be great to make it work with older CMake versions by putting some code in to add the appropriate flag manually. Yes, I know this needs some lines of code, but otherwise you force the user to upgrade CMake only for setting the C++ standard (or, like me, comment the line out and set -std=c++11 manually).

Bison build error on MacOS

Using the latest bison and flex from homebrew:

Jeroens-MacBook-Pro:libgraphqlparser jeroen$ make
[  4%] [FLEX][GraphQLScanner] Building scanner with flex 2.6.4
[  8%] Generating Ast.h
[ 13%] Generating Ast.cpp
[ 17%] Generating AstVisitor.h
[ 21%] Generating c/GraphQLAst.h
[ 26%] Generating c/GraphQLAst.cpp
[ 30%] Generating c/GraphQLAstForEachConcreteType.h
[ 34%] Generating JsonVisitor.h.inc
[ 39%] Generating JsonVisitor.cpp.inc
[ 43%] [BISON][graphqlparser_bison] Building parser with bison 3.2.1
parser.ypp:8.10-12: error: invalid version requirement: 3
 %require "3"
          ^^^
make[2]: *** [parser.tab.cpp] Error 1
make[1]: *** [CMakeFiles/graphqlparser.dir/all] Error 2
make: *** [all] Error 2

I can change the require to from "3" to "3.0" which works but I still get these warnings:

[ 43%] [BISON][graphqlparser_bison] Building parser with bison 3.2.1
parser.ypp:298.17-43: warning: unset value: $$ [-Wother]
 start:          document  { *outAST = $1; }
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
parser.ypp:446.23-26: warning: unused value: $2 [-Wother]
                 "..." "on" type_condition directives_opt selection_set { $$ = new InlineFragment(@$, $3, $4, $5); }
                       ^^^^
parser.ypp:451.17-26: warning: unused value: $1 [-Wother]
                 "fragment" fragment_name "on" type_condition directives_opt selection_set { $$ = new FragmentDefinition(@$, $2, $4, $5, $6); }
                 ^^^^^^^^^^
parser.ypp:451.42-45: warning: unused value: $3 [-Wother]
                 "fragment" fragment_name "on" type_condition directives_opt selection_set { $$ = new FragmentDefinition(@$, $2, $4, $5, $6); }
                                          ^^^^
parser.ypp:488.17-20: warning: unused value: $1 [-Wother]
 boolean_value:  TRUE { $$ = new BooleanValue(@$, true); }
                 ^^^^
parser.ypp:489.17-21: warning: unused value: $1 [-Wother]
         |       FALSE { $$ = new BooleanValue(@$, false); }
                 ^^^^^
parser.ypp:492.17-20: warning: unused value: $1 [-Wother]
 null_value:     NULL { $$ = new NullValue(@$); }
                 ^^^^
parser.ypp:597.20-25: warning: unused value: $1 [-Wother]
 schema_definition: SCHEMA directives_opt "{" operation_type_definition_list "}" { $$ = new SchemaDefinition(@$, $2, $4); }
                    ^^^^^^
parser.ypp:609.25-30: warning: unused value: $1 [-Wother]
 scalar_type_definition: SCALAR name directives_opt { $$ = new ScalarTypeDefinition(@$, $2, $3); }
                         ^^^^^^
parser.ypp:612.25-28: warning: unused value: $1 [-Wother]
 object_type_definition: TYPE name implements_interfaces_opt directives_opt "{" field_definition_list "}" { $$ = new ObjectTypeDefinition(@$, $2, $3, $4, $6); }
                         ^^^^
parser.ypp:616.17-26: warning: unused value: $1 [-Wother]
         |       IMPLEMENTS type_name_list { $$ = $2; }
                 ^^^^^^^^^^
parser.ypp:644.28-36: warning: unused value: $1 [-Wother]
 interface_type_definition: INTERFACE name directives_opt "{" field_definition_list "}" { $$ = new InterfaceTypeDefinition(@$, $2, $3, $5); }
                            ^^^^^^^^^
parser.ypp:647.24-28: warning: unused value: $1 [-Wother]
 union_type_definition: UNION name directives_opt "=" union_members { $$ = new UnionTypeDefinition(@$, $2, $3, $5); }
                        ^^^^^
parser.ypp:654.23-26: warning: unused value: $1 [-Wother]
 enum_type_definition: ENUM name directives_opt "{" enum_value_definition_list "}" { $$ = new EnumTypeDefinition(@$, $2, $3, $5); }
                       ^^^^
parser.ypp:665.31-35: warning: unused value: $1 [-Wother]
 input_object_type_definition: INPUT name directives_opt "{" input_value_definition_list "}" { $$ = new InputObjectTypeDefinition(@$, $2, $3, $5); }
                               ^^^^^
parser.ypp:668.28-33: warning: unused value: $1 [-Wother]
 type_extension_definition: EXTEND object_type_definition { $$ = new TypeExtensionDefinition(@$, $2); }
                            ^^^^^^
parser.ypp:671.23-31: warning: unused value: $1 [-Wother]
 directive_definition: DIRECTIVE "@" name arguments_definition_opt ON directive_locations { $$ = new DirectiveDefinition(@$, $3, $4, $6); }
                       ^^^^^^^^^
parser.ypp:671.67-68: warning: unused value: $5 [-Wother]
 directive_definition: DIRECTIVE "@" name arguments_definition_opt ON directive_locations { $$ = new DirectiveDefinition(@$, $3, $4, $6); }
                                                                   ^^

Dependency on the graphql gem?

I'm wondering why the dependency on the graphql gem? If the only thing I want is to parse a query into that nice Ruby structure, why do I need the graphql gem?

Missing support for extending interfaces

In addition to extending types, GraphQL also allows to extend interfaces. This seems currently not supported by libgraphqlparser, though, which fails with an exception of the type:

Parser failed with error: <line.column-length>: syntax error, unexpected interface, expecting type

Build fails with latest ctypesgen

Since ctypesgen 0.1.1 (now 1.0.0) it has installed as "ctypesgen" instead of "ctypesgen.py" so CMakeLists.txt can't find the executable.

The fix is trivial:

FIND_PROGRAM(CTYPESGEN_FOUND ctypesgen.py)
IF (NOT CTYPESGEN_FOUND)
  FIND_PROGRAM(CTYPESGEN_FOUND ctypesgen)
ENDIF()

If that's acceptable I'll push a PR.

Thanks

Structure of installation, includes and usages

@swolchok Great work, reached out to you on twitter as well.

I am doing OCaml bindings, https://github.com/fxfactorial/ocaml-graphql, and a server for graphql and have some questions.

(Installed from source)

  1. Doing: #include <graphqlparser/JsonVisitor.h> and getting
/usr/local/include/graphqlparser/JsonVisitor.h:13:10: fatal error: 'AstVisitor.h' file not found
#include "AstVisitor.h"
         ^
1 error generated.

Mistake in the cmake installation?

  1. Why is there a nested libgraphqlparser inside of graphqlparser in the installed headers?/

  2. Twitter question

  3. is graphql_ast_to_json intended just for debugging or is the graphql server intended to relevant info out of that and then do with the data as it wills, ie querying postgres, redis, etc. What are some more example C++ API based usages of the AST

Out of source build not possible, CMakeLists assumes building from root

The custom commands in the CmakeLists are hardcoded to expect building from the root directory.

Steps to reproduce:

> mkdir build && cd build
> cmake .. -DCMAKE_BUILD_TYPE=Release && cmake --build .

Filtered warnings:

python: can't open file './ast/ast.py': [Errno 2] No such file or directory

It would be great to allow or even prefer out of source builds.

Issue trying with the go example

Hi,

I got two issues trying out this package

 ❯❯❯ go build                                                                                                                      master ◼
# _/Users/bsr/Work/Programming/cpp/sample/libgraphqlparser/go
In file included from ./gotest.go:16:
../c/GraphQLAstVisitor.h:12:10: fatal error: 'c/GraphQLAst.h' file not found
#include "c/GraphQLAst.h"
         ^
1 error generated.

I corrected it by changing

#include "./GraphQLAst.h"

#include "./GraphQLAstForEachConcreteType.h"

from 

#include "c/GraphQLAst.h"

#include "c/GraphQLAstForEachConcreteType.h"

then

go build                                                                                                                      master ◼
# _/Users/bsr/Work/Programming/cpp/sample/libgraphqlparser/go
./callbacks.go:14:10: warning: implicit declaration of function 'printField' is invalid in C99 [-Wimplicit-function-declaration]
~/W/P/c/s/l/go ❯❯❯ ls                                                                                                                          master ✱ ◼
README.md    callbacks.go go           gotest.go
~/W/P/c/s/l/go ❯❯❯ ./go                                                                                                                        master ✱ ◼
field : myfield
Example error: 1.18-19: syntax error, unexpected on, expecting ( or @ or {

comple log is below

~/W/P/c/sample ❯❯❯ git clone https://github.com/graphql/libgraphqlparser.git                                                                            ⏎
Cloning into 'libgraphqlparser'...
remote: Counting objects: 161, done.
remote: Total 161 (delta 0), reused 0 (delta 0), pack-reused 161
Receiving objects: 100% (161/161), 105.33 KiB | 0 bytes/s, done.
Resolving deltas: 100% (80/80), done.
Checking connectivity... done.
~/W/P/c/sample ❯❯❯ cd libgraphqlparser
AstNode.h         GraphQLParser.h   PATENTS           dump_json_ast.cpp lexer.lpp         parser.ypp        syntaxdefs.h
CMakeLists.txt    JsonVisitor.cpp   README.md         go                location.hh       position.hh       test
CONTRIBUTING.md   JsonVisitor.h     ast               lexer.cpp         parser.tab.cpp    python
GraphQLParser.cpp LICENSE           c                 lexer.h           parser.tab.hpp    stack.hh
~/W/P/c/s/libgraphqlparser ❯❯❯ make install                                                                                                        master
make: *** No rule to make target `install'.  Stop.

~/W/P/c/s/libgraphqlparser ❯❯❯ cmake .                                                                                                           ⏎ master
-- The C compiler identification is AppleClang 5.1.0.5030040
-- The CXX compiler identification is AppleClang 5.1.0.5030040
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PythonInterp: /usr/bin/python (found version "2.7.5") 
-- Found BISON: /usr/local/bin/bison (found suitable version "3.0.4", minimum required is "3") 
-- Found FLEX: /usr/bin/flex (found version "2.5.35") 
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   graphqlparser

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/bsr/Work/Programming/cpp/sample/libgraphqlparser
~/W/P/c/s/libgraphqlparser ❯❯❯ make install                                                                                                        master
[  5%] Generating Ast.h
[ 10%] Generating Ast.cpp
[ 15%] Generating AstVisitor.h
[ 20%] Generating c/GraphQLAst.h
[ 25%] Generating c/GraphQLAst.cpp
[ 30%] Generating c/GraphQLAstForEachConcreteType.h
Scanning dependencies of target graphqlparser
[ 35%] Building CXX object CMakeFiles/graphqlparser.dir/JsonVisitor.cpp.o
[ 40%] Building CXX object CMakeFiles/graphqlparser.dir/Ast.cpp.o
[ 45%] Building CXX object CMakeFiles/graphqlparser.dir/c/GraphQLAst.cpp.o
[ 50%] Building CXX object CMakeFiles/graphqlparser.dir/c/GraphQLAstNode.cpp.o
[ 55%] Building CXX object CMakeFiles/graphqlparser.dir/c/GraphQLAstToJSON.cpp.o
[ 60%] Building CXX object CMakeFiles/graphqlparser.dir/c/GraphQLAstVisitor.cpp.o
[ 65%] Building CXX object CMakeFiles/graphqlparser.dir/c/GraphQLParser.cpp.o
[ 70%] Building CXX object CMakeFiles/graphqlparser.dir/parser.tab.cpp.o
In file included from parser.tab.cpp:46:
parser.ypp:62:58: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
    const char *heapStr;                                \                               
                                                         ^
1 warning generated.
[ 75%] Building CXX object CMakeFiles/graphqlparser.dir/lexer.cpp.o
In file included from lexer.lpp:17:
parser.ypp:62:58: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
    const char *heapStr;                                \                               
                                                         ^
lexer.cpp:788:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
lexer.cpp:789:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
lexer.cpp:789:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register char *yy_cp, *yy_bp;
        ^~~~~~~~~
lexer.cpp:790:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register int yy_act;
        ^~~~~~~~~
lexer.cpp:848:4: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
                        register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
                        ^~~~~~~~~
lexer.cpp:1313:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
        ^~~~~~~~~
lexer.cpp:1314:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register char *source = yyg->yytext_ptr;
        ^~~~~~~~~
lexer.cpp:1315:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register int number_to_move, i;
        ^~~~~~~~~
lexer.cpp:1315:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register int number_to_move, i;
        ^~~~~~~~~
lexer.cpp:1447:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register yy_state_type yy_current_state;
        ^~~~~~~~~
lexer.cpp:1448:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register char *yy_cp;
        ^~~~~~~~~
lexer.cpp:1455:3: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
                register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
                ^~~~~~~~~
lexer.cpp:1480:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register int yy_is_jam;
        ^~~~~~~~~
lexer.cpp:1482:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register char *yy_cp = yyg->yy_c_buf_p;
        ^~~~~~~~~
lexer.cpp:1484:2: warning: 'register' storage class specifier is deprecated [-Wdeprecated-register]
        register YY_CHAR yy_c = 1;
        ^~~~~~~~~
16 warnings generated.
[ 80%] Building CXX object CMakeFiles/graphqlparser.dir/GraphQLParser.cpp.o
In file included from /Users/bsr/Work/Programming/cpp/sample/libgraphqlparser/GraphQLParser.cpp:14:
parser.ypp:62:58: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
    const char *heapStr;                                \                               
                                                         ^
1 warning generated.
Linking CXX shared library libgraphqlparser.dylib
[ 90%] Built target graphqlparser
Scanning dependencies of target dump_json_ast
[ 95%] Building CXX object CMakeFiles/dump_json_ast.dir/dump_json_ast.cpp.o
Linking CXX executable dump_json_ast
[ 95%] Built target dump_json_ast
Scanning dependencies of target graphql-parser-python
[100%] Generating GraphQLParser.py
[100%] Built target graphql-parser-python
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/include/graphqlparser/c
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAst.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstForEachConcreteType.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstNode.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstToJSON.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstVisitor.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLParser.h
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/hooks
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/info
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/logs
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/logs/refs
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/logs/refs/heads
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/logs/refs/remotes
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/logs/refs/remotes/origin
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/objects
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/objects/info
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/objects/pack
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/refs
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/refs/heads
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/refs/remotes
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/refs/remotes/origin
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/.git/refs/tags
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/ast
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/Ast.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/AstNode.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/AstVisitor.h
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/c
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/c/GraphQLAst.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/c/GraphQLAstForEachConcreteType.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/c/GraphQLAstNode.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/c/GraphQLAstToJSON.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/c/GraphQLAstVisitor.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/c/GraphQLParser.h
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles/3.2.2
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles/3.2.2/CompilerIdC
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles/3.2.2/CompilerIdCXX
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles/CMakeTmp
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles/dump_json_ast.dir
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles/graphqlparser.dir
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/CMakeFiles/graphqlparser.dir/c
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/go
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/GraphQLParser.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/JsonVisitor.h
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/lexer.h
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/python
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/python/CMakeFiles
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/python/CMakeFiles/graphql-parser-python.dir
-- Installing: /usr/local/include/graphqlparser/libgraphqlparser/syntaxdefs.h
-- Up-to-date: /usr/local/include/graphqlparser/libgraphqlparser/test
-- Up-to-date: /usr/local/include/graphqlparser/c
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAst.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstForEachConcreteType.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstNode.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstToJSON.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLAstVisitor.h
-- Installing: /usr/local/include/graphqlparser/c/GraphQLParser.h
-- Installing: /usr/local/include/graphqlparser/AstNode.h
-- Installing: /usr/local/include/graphqlparser/GraphQLParser.h
-- Installing: /usr/local/include/graphqlparser/JsonVisitor.h
-- Installing: /usr/local/include/graphqlparser/lexer.h
-- Installing: /usr/local/include/graphqlparser/location.hh
-- Installing: /usr/local/include/graphqlparser/parser.tab.hpp
-- Installing: /usr/local/include/graphqlparser/position.hh
-- Installing: /usr/local/include/graphqlparser/stack.hh
-- Installing: /usr/local/include/graphqlparser/syntaxdefs.h
-- Installing: /usr/local/lib/libgraphqlparser.dylib
~/W/P/c/s/libgraphqlparser ❯❯❯ cd go                                                                                                             master ◼
README.md    callbacks.go gotest.go
~/W/P/c/s/l/go ❯❯❯ cat README.md                                                                                                                 master ◼
This directory contains an example usage of the GraphQL parser and AST
library from Go. See [cgo's
documentation](https://github.com/golang/go/wiki/cgo), particularly
the "Function pointer callbacks" section, for explanation of the
mechanisms in use.

To build, first build the main GraphQLParser library in the parent
directory, and then set this directory to be your `GOPATH` and run `go
build`.
~/W/P/c/s/l/go ❯❯❯ export GOPATH-`pwd`                                                                                                           master ◼
export: not valid in this context: GOPATH-/Users/bsr/Work/Programming/cpp/sample/libgraphqlparser/go
~/W/P/c/s/l/go ❯❯❯ export GOPATH=`pwd`                                                                                                         ⏎ master ◼
~/W/P/c/s/l/go ❯❯❯ go build                                                                                                                      master ◼
# _/Users/bsr/Work/Programming/cpp/sample/libgraphqlparser/go
In file included from ./gotest.go:16:
../c/GraphQLAstVisitor.h:12:10: fatal error: 'c/GraphQLAst.h' file not found
#include "c/GraphQLAst.h"
         ^
1 error generated.
~/W/P/c/s/l/go ❯❯❯ atom ../c/GraphQLAstVisitor.h                                                                                               ⏎ master ◼
~/W/P/c/s/l/go ❯❯❯ go build                                                                                                                      master ◼
# _/Users/bsr/Work/Programming/cpp/sample/libgraphqlparser/go
./callbacks.go:14:10: warning: implicit declaration of function 'printField' is invalid in C99 [-Wimplicit-function-declaration]
~/W/P/c/s/l/go ❯❯❯ ls                                                                                                                          master ✱ ◼
README.md    callbacks.go go           gotest.go
~/W/P/c/s/l/go ❯❯❯ ./go                                                                                                                        master ✱ ◼
field : myfield
Example error: 1.18-19: syntax error, unexpected on, expecting ( or @ or {
~/W/P/c/s/l/go ❯❯❯                                                                                                                             master ✱ ◼

Missing support for extending schemas

GraphQL allows to extend schemas, i.e.:

[...] to represent a schema which has been extended from an original schema. For example, this might be used by a GraphQL service which adds additional operation types, or additional directives to an existing schema.

libgraphqlparser currently does not support the parsing schema definitions including schema extensions.

SWIG bindings?

The readme for libgraphqlparser includes this snippet:

you can use it as the basis for an extension module for your favorite programming language instead of writing your own parser from scratch.

SWIG may help with this use case. It's a tool that generates glue code to call C++ APIs from other languages. It supports lots of different languages, including C#, Java, Python, Go, PHP, and Ruby. I've used it before to call a C++ API from Java and it worked pretty well for that use case.

It would be cool to include 'official' SWIG bindings to more easily allow this library to be used from other languages.

Package-config in Homebrew

I'm looking for libgraphqlparser.pc.in in the Cellar library from a homebrew (brew install libgraphqlparser) installation and can't find it. Would be useful to have this available. How can we make this available?

visit_argument crashed. Need a few help to guide how to fix it.

I use Shopify/graphql-parser to write following ruby code but crashed in C

    def visit_argument(arg)
      key = arg.name.value
      # TODO crashed in C trace
      value_obj = arg.value
    end

I debug the C code in graphql-parser, the visit_argument should defined in https://github.com/Shopify/graphql-parser/blob/master/ext/graphql_parser/graphql_ruby.c#L220
I'm new on both C and C++, so I don't know how to debug them.
I report an issue on https://github.com/Shopify/graphql-parser/issues/14 with C error trace but the shopify seems not maintenance the lib anymore.
Btw, The problem seems related to https://github.com/Shopify/graphql-parser/issues/4. But I just not understand it well.

Thanks for any help.

Building / installing without sudo

I've been spending time improving my Travis build times, and my final remaining task to switch to their container infrastructure is to get rid of the sudo make install required by libgraphqlparser.

I've spelunked the Makefile a little but I don't see an obvious way to encourage the installer to build to a directory I have access to instead of /usr/local/include/graphqlparser. Any suggestions?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.