@@ -28,10 +28,35 @@ Installing from source is a bit more complex. The main steps are
28
28
LDFLAGS="-L$GRAPHQL_HOME" CFLAGS="-I$GRAPHQL_HOME/c -I$GRAPHQL_HOME" pip install graphqlparser
29
29
30
30
31
+ Usage
32
+ -----
33
+
34
+ Make sure ``libgraphqlparser `` is available to the loader. You can add its base dir to ``LD_LIBRARY_PATH ``.
35
+
36
+ Then you can start parsing by creating your custom visitor class::
37
+
38
+ from graphql_parser import GraphQLAstVisitor
39
+
40
+ class MyVisitor(GraphQLAstVisitor.GraphQLAstVisitor):
41
+
42
+ def visit_field(self, node):
43
+ print('start field %s visit' % node)
44
+
45
+ def end_visit_field(self, node):
46
+ print('end field %s visit' % node)
47
+
48
+ And using it to visit a parsed query::
49
+
50
+ from graphql_parser import GraphQLParser
51
+
52
+ node = GraphQLParser.graphql_parse_string(query)
53
+ MyVisitor().visit_node(node)
54
+
55
+
31
56
Building from source checkout
32
57
-----------------------------
33
58
34
- Needed to rebuild the generate cython files from the libgraphql AST
59
+ Rebuild the generated cython files from the libgraphql AST (usually not needed)
35
60
36
61
- download submodules with ``git checkout --recursive ``
37
62
- build libgraphql library in folder ``./libgraphqlparser `` (python2.7 required for building)
@@ -51,12 +76,6 @@ To create a wheel distribution:
51
76
- build with ``pip wheel --wheel-dir=.wheelhouse . ``
52
77
53
78
54
- Run
55
- ---
56
-
57
- Make sure ``libgraphqlparser `` is available to the loader. You can add its base dir to ``LD_LIBRARY_PATH ``.
58
-
59
-
60
79
Known issues
61
80
------------
62
81
0 commit comments