rails-graphql 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (266) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +19 -0
  4. data/Rakefile +31 -0
  5. data/ext/depend +3 -0
  6. data/ext/extconf.rb +57 -0
  7. data/ext/graphqlparser/Ast.cpp +346 -0
  8. data/ext/graphqlparser/Ast.h +1214 -0
  9. data/ext/graphqlparser/AstNode.h +36 -0
  10. data/ext/graphqlparser/AstVisitor.h +137 -0
  11. data/ext/graphqlparser/GraphQLParser.cpp +76 -0
  12. data/ext/graphqlparser/GraphQLParser.h +55 -0
  13. data/ext/graphqlparser/JsonVisitor.cpp +161 -0
  14. data/ext/graphqlparser/JsonVisitor.cpp.inc +456 -0
  15. data/ext/graphqlparser/JsonVisitor.h +121 -0
  16. data/ext/graphqlparser/JsonVisitor.h.inc +110 -0
  17. data/ext/graphqlparser/VERSION +1 -0
  18. data/ext/graphqlparser/c/GraphQLAst.cpp +324 -0
  19. data/ext/graphqlparser/c/GraphQLAst.h +180 -0
  20. data/ext/graphqlparser/c/GraphQLAstForEachConcreteType.h +44 -0
  21. data/ext/graphqlparser/c/GraphQLAstNode.cpp +25 -0
  22. data/ext/graphqlparser/c/GraphQLAstNode.h +33 -0
  23. data/ext/graphqlparser/c/GraphQLAstToJSON.cpp +21 -0
  24. data/ext/graphqlparser/c/GraphQLAstToJSON.h +24 -0
  25. data/ext/graphqlparser/c/GraphQLAstVisitor.cpp +55 -0
  26. data/ext/graphqlparser/c/GraphQLAstVisitor.h +53 -0
  27. data/ext/graphqlparser/c/GraphQLParser.cpp +35 -0
  28. data/ext/graphqlparser/c/GraphQLParser.h +54 -0
  29. data/ext/graphqlparser/dump_json_ast.cpp +48 -0
  30. data/ext/graphqlparser/lexer.lpp +324 -0
  31. data/ext/graphqlparser/parser.ypp +693 -0
  32. data/ext/graphqlparser/parsergen/lexer.cpp +2633 -0
  33. data/ext/graphqlparser/parsergen/lexer.h +528 -0
  34. data/ext/graphqlparser/parsergen/location.hh +189 -0
  35. data/ext/graphqlparser/parsergen/parser.tab.cpp +3300 -0
  36. data/ext/graphqlparser/parsergen/parser.tab.hpp +646 -0
  37. data/ext/graphqlparser/parsergen/position.hh +179 -0
  38. data/ext/graphqlparser/parsergen/stack.hh +156 -0
  39. data/ext/graphqlparser/syntaxdefs.h +19 -0
  40. data/ext/libgraphqlparser/AstNode.h +36 -0
  41. data/ext/libgraphqlparser/CMakeLists.txt +148 -0
  42. data/ext/libgraphqlparser/CONTRIBUTING.md +23 -0
  43. data/ext/libgraphqlparser/GraphQLParser.cpp +76 -0
  44. data/ext/libgraphqlparser/GraphQLParser.h +55 -0
  45. data/ext/libgraphqlparser/JsonVisitor.cpp +161 -0
  46. data/ext/libgraphqlparser/JsonVisitor.h +121 -0
  47. data/ext/libgraphqlparser/LICENSE +22 -0
  48. data/ext/libgraphqlparser/README.clang-tidy +7 -0
  49. data/ext/libgraphqlparser/README.md +84 -0
  50. data/ext/libgraphqlparser/ast/ast.ast +203 -0
  51. data/ext/libgraphqlparser/ast/ast.py +61 -0
  52. data/ext/libgraphqlparser/ast/c.py +100 -0
  53. data/ext/libgraphqlparser/ast/c.pyc +0 -0
  54. data/ext/libgraphqlparser/ast/c_impl.py +61 -0
  55. data/ext/libgraphqlparser/ast/c_impl.pyc +0 -0
  56. data/ext/libgraphqlparser/ast/c_visitor_impl.py +39 -0
  57. data/ext/libgraphqlparser/ast/c_visitor_impl.pyc +0 -0
  58. data/ext/libgraphqlparser/ast/casing.py +26 -0
  59. data/ext/libgraphqlparser/ast/casing.pyc +0 -0
  60. data/ext/libgraphqlparser/ast/cxx.py +197 -0
  61. data/ext/libgraphqlparser/ast/cxx.pyc +0 -0
  62. data/ext/libgraphqlparser/ast/cxx_impl.py +61 -0
  63. data/ext/libgraphqlparser/ast/cxx_impl.pyc +0 -0
  64. data/ext/libgraphqlparser/ast/cxx_json_visitor_header.py +42 -0
  65. data/ext/libgraphqlparser/ast/cxx_json_visitor_header.pyc +0 -0
  66. data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.py +80 -0
  67. data/ext/libgraphqlparser/ast/cxx_json_visitor_impl.pyc +0 -0
  68. data/ext/libgraphqlparser/ast/cxx_visitor.py +64 -0
  69. data/ext/libgraphqlparser/ast/cxx_visitor.pyc +0 -0
  70. data/ext/libgraphqlparser/ast/js.py +65 -0
  71. data/ext/libgraphqlparser/ast/license.py +10 -0
  72. data/ext/libgraphqlparser/ast/license.pyc +0 -0
  73. data/ext/libgraphqlparser/c/GraphQLAstNode.cpp +25 -0
  74. data/ext/libgraphqlparser/c/GraphQLAstNode.h +33 -0
  75. data/ext/libgraphqlparser/c/GraphQLAstToJSON.cpp +21 -0
  76. data/ext/libgraphqlparser/c/GraphQLAstToJSON.h +24 -0
  77. data/ext/libgraphqlparser/c/GraphQLAstVisitor.cpp +55 -0
  78. data/ext/libgraphqlparser/c/GraphQLAstVisitor.h +53 -0
  79. data/ext/libgraphqlparser/c/GraphQLParser.cpp +35 -0
  80. data/ext/libgraphqlparser/c/GraphQLParser.h +54 -0
  81. data/ext/libgraphqlparser/clang-tidy-all.sh +3 -0
  82. data/ext/libgraphqlparser/cmake/version.cmake +16 -0
  83. data/ext/libgraphqlparser/dump_json_ast.cpp +48 -0
  84. data/ext/libgraphqlparser/go/README.md +20 -0
  85. data/ext/libgraphqlparser/go/callbacks.go +18 -0
  86. data/ext/libgraphqlparser/go/gotest.go +64 -0
  87. data/ext/libgraphqlparser/lexer.lpp +324 -0
  88. data/ext/libgraphqlparser/libgraphqlparser.pc.in +11 -0
  89. data/ext/libgraphqlparser/parser.ypp +693 -0
  90. data/ext/libgraphqlparser/parsergen/lexer.cpp +2633 -0
  91. data/ext/libgraphqlparser/parsergen/lexer.h +528 -0
  92. data/ext/libgraphqlparser/parsergen/location.hh +189 -0
  93. data/ext/libgraphqlparser/parsergen/parser.tab.cpp +3300 -0
  94. data/ext/libgraphqlparser/parsergen/parser.tab.hpp +646 -0
  95. data/ext/libgraphqlparser/parsergen/position.hh +179 -0
  96. data/ext/libgraphqlparser/parsergen/stack.hh +156 -0
  97. data/ext/libgraphqlparser/python/CMakeLists.txt +14 -0
  98. data/ext/libgraphqlparser/python/README.md +5 -0
  99. data/ext/libgraphqlparser/python/example.py +31 -0
  100. data/ext/libgraphqlparser/syntaxdefs.h +19 -0
  101. data/ext/libgraphqlparser/test/BuildCAPI.c +5 -0
  102. data/ext/libgraphqlparser/test/CMakeLists.txt +25 -0
  103. data/ext/libgraphqlparser/test/JsonVisitorTests.cpp +28 -0
  104. data/ext/libgraphqlparser/test/ParserTests.cpp +352 -0
  105. data/ext/libgraphqlparser/test/kitchen-sink.graphql +59 -0
  106. data/ext/libgraphqlparser/test/kitchen-sink.json +1 -0
  107. data/ext/libgraphqlparser/test/schema-kitchen-sink.graphql +78 -0
  108. data/ext/libgraphqlparser/test/schema-kitchen-sink.json +1 -0
  109. data/ext/libgraphqlparser/test/valgrind.supp +33 -0
  110. data/ext/version.cpp +21 -0
  111. data/lib/generators/graphql/controller_generator.rb +22 -0
  112. data/lib/generators/graphql/schema_generator.rb +22 -0
  113. data/lib/generators/graphql/templates/controller.erb +5 -0
  114. data/lib/generators/graphql/templates/schema.erb +6 -0
  115. data/lib/graphqlparser.so +0 -0
  116. data/lib/rails-graphql.rb +2 -0
  117. data/lib/rails/graphql.rake +1 -0
  118. data/lib/rails/graphql.rb +185 -0
  119. data/lib/rails/graphql/adapters/mysql_adapter.rb +0 -0
  120. data/lib/rails/graphql/adapters/pg_adapter.rb +50 -0
  121. data/lib/rails/graphql/adapters/sqlite_adapter.rb +39 -0
  122. data/lib/rails/graphql/argument.rb +220 -0
  123. data/lib/rails/graphql/callback.rb +124 -0
  124. data/lib/rails/graphql/collectors.rb +14 -0
  125. data/lib/rails/graphql/collectors/hash_collector.rb +83 -0
  126. data/lib/rails/graphql/collectors/idented_collector.rb +73 -0
  127. data/lib/rails/graphql/collectors/json_collector.rb +114 -0
  128. data/lib/rails/graphql/config.rb +61 -0
  129. data/lib/rails/graphql/directive.rb +203 -0
  130. data/lib/rails/graphql/directive/deprecated_directive.rb +59 -0
  131. data/lib/rails/graphql/directive/include_directive.rb +24 -0
  132. data/lib/rails/graphql/directive/skip_directive.rb +24 -0
  133. data/lib/rails/graphql/errors.rb +42 -0
  134. data/lib/rails/graphql/event.rb +141 -0
  135. data/lib/rails/graphql/field.rb +318 -0
  136. data/lib/rails/graphql/field/input_field.rb +92 -0
  137. data/lib/rails/graphql/field/mutation_field.rb +52 -0
  138. data/lib/rails/graphql/field/output_field.rb +96 -0
  139. data/lib/rails/graphql/field/proxied_field.rb +131 -0
  140. data/lib/rails/graphql/field/resolved_field.rb +96 -0
  141. data/lib/rails/graphql/field/scoped_config.rb +22 -0
  142. data/lib/rails/graphql/field/typed_field.rb +104 -0
  143. data/lib/rails/graphql/helpers.rb +40 -0
  144. data/lib/rails/graphql/helpers/attribute_delegator.rb +39 -0
  145. data/lib/rails/graphql/helpers/inherited_collection.rb +152 -0
  146. data/lib/rails/graphql/helpers/leaf_from_ar.rb +141 -0
  147. data/lib/rails/graphql/helpers/registerable.rb +103 -0
  148. data/lib/rails/graphql/helpers/with_arguments.rb +125 -0
  149. data/lib/rails/graphql/helpers/with_assignment.rb +113 -0
  150. data/lib/rails/graphql/helpers/with_callbacks.rb +55 -0
  151. data/lib/rails/graphql/helpers/with_directives.rb +126 -0
  152. data/lib/rails/graphql/helpers/with_events.rb +81 -0
  153. data/lib/rails/graphql/helpers/with_fields.rb +141 -0
  154. data/lib/rails/graphql/helpers/with_namespace.rb +40 -0
  155. data/lib/rails/graphql/helpers/with_owner.rb +35 -0
  156. data/lib/rails/graphql/helpers/with_schema_fields.rb +230 -0
  157. data/lib/rails/graphql/helpers/with_validator.rb +52 -0
  158. data/lib/rails/graphql/introspection.rb +53 -0
  159. data/lib/rails/graphql/native.rb +56 -0
  160. data/lib/rails/graphql/native/functions.rb +38 -0
  161. data/lib/rails/graphql/native/location.rb +41 -0
  162. data/lib/rails/graphql/native/pointers.rb +23 -0
  163. data/lib/rails/graphql/native/visitor.rb +349 -0
  164. data/lib/rails/graphql/railtie.rb +85 -0
  165. data/lib/rails/graphql/railties/base_generator.rb +35 -0
  166. data/lib/rails/graphql/railties/controller.rb +101 -0
  167. data/lib/rails/graphql/railties/controller_runtime.rb +40 -0
  168. data/lib/rails/graphql/railties/log_subscriber.rb +62 -0
  169. data/lib/rails/graphql/request.rb +343 -0
  170. data/lib/rails/graphql/request/arguments.rb +93 -0
  171. data/lib/rails/graphql/request/component.rb +100 -0
  172. data/lib/rails/graphql/request/component/field.rb +225 -0
  173. data/lib/rails/graphql/request/component/fragment.rb +118 -0
  174. data/lib/rails/graphql/request/component/operation.rb +178 -0
  175. data/lib/rails/graphql/request/component/operation/subscription.rb +16 -0
  176. data/lib/rails/graphql/request/component/spread.rb +119 -0
  177. data/lib/rails/graphql/request/component/typename.rb +82 -0
  178. data/lib/rails/graphql/request/context.rb +51 -0
  179. data/lib/rails/graphql/request/errors.rb +54 -0
  180. data/lib/rails/graphql/request/event.rb +112 -0
  181. data/lib/rails/graphql/request/helpers/directives.rb +64 -0
  182. data/lib/rails/graphql/request/helpers/selection_set.rb +87 -0
  183. data/lib/rails/graphql/request/helpers/value_writers.rb +115 -0
  184. data/lib/rails/graphql/request/steps/organizable.rb +146 -0
  185. data/lib/rails/graphql/request/steps/prepareable.rb +33 -0
  186. data/lib/rails/graphql/request/steps/resolveable.rb +32 -0
  187. data/lib/rails/graphql/request/strategy.rb +249 -0
  188. data/lib/rails/graphql/request/strategy/dynamic_instance.rb +41 -0
  189. data/lib/rails/graphql/request/strategy/multi_query_strategy.rb +36 -0
  190. data/lib/rails/graphql/request/strategy/sequenced_strategy.rb +28 -0
  191. data/lib/rails/graphql/schema.rb +272 -0
  192. data/lib/rails/graphql/shortcuts.rb +77 -0
  193. data/lib/rails/graphql/source.rb +371 -0
  194. data/lib/rails/graphql/source/active_record/builders.rb +154 -0
  195. data/lib/rails/graphql/source/active_record_source.rb +231 -0
  196. data/lib/rails/graphql/source/scoped_arguments.rb +87 -0
  197. data/lib/rails/graphql/to_gql.rb +368 -0
  198. data/lib/rails/graphql/type.rb +138 -0
  199. data/lib/rails/graphql/type/enum.rb +206 -0
  200. data/lib/rails/graphql/type/enum/directive_location_enum.rb +30 -0
  201. data/lib/rails/graphql/type/enum/type_kind_enum.rb +57 -0
  202. data/lib/rails/graphql/type/input.rb +134 -0
  203. data/lib/rails/graphql/type/interface.rb +82 -0
  204. data/lib/rails/graphql/type/object.rb +111 -0
  205. data/lib/rails/graphql/type/object/directive_object.rb +34 -0
  206. data/lib/rails/graphql/type/object/enum_value_object.rb +25 -0
  207. data/lib/rails/graphql/type/object/field_object.rb +54 -0
  208. data/lib/rails/graphql/type/object/input_value_object.rb +49 -0
  209. data/lib/rails/graphql/type/object/schema_object.rb +40 -0
  210. data/lib/rails/graphql/type/object/type_object.rb +136 -0
  211. data/lib/rails/graphql/type/scalar.rb +71 -0
  212. data/lib/rails/graphql/type/scalar/bigint_scalar.rb +34 -0
  213. data/lib/rails/graphql/type/scalar/binary_scalar.rb +30 -0
  214. data/lib/rails/graphql/type/scalar/boolean_scalar.rb +37 -0
  215. data/lib/rails/graphql/type/scalar/date_scalar.rb +34 -0
  216. data/lib/rails/graphql/type/scalar/date_time_scalar.rb +32 -0
  217. data/lib/rails/graphql/type/scalar/decimal_scalar.rb +35 -0
  218. data/lib/rails/graphql/type/scalar/float_scalar.rb +32 -0
  219. data/lib/rails/graphql/type/scalar/id_scalar.rb +39 -0
  220. data/lib/rails/graphql/type/scalar/int_scalar.rb +36 -0
  221. data/lib/rails/graphql/type/scalar/string_scalar.rb +28 -0
  222. data/lib/rails/graphql/type/scalar/time_scalar.rb +40 -0
  223. data/lib/rails/graphql/type/union.rb +87 -0
  224. data/lib/rails/graphql/type_map.rb +347 -0
  225. data/lib/rails/graphql/version.rb +7 -0
  226. data/test/assets/introspection-db.json +0 -0
  227. data/test/assets/introspection-mem.txt +1 -0
  228. data/test/assets/introspection.gql +91 -0
  229. data/test/assets/luke.jpg +0 -0
  230. data/test/assets/mem.gql +428 -0
  231. data/test/assets/sqlite.gql +423 -0
  232. data/test/config.rb +80 -0
  233. data/test/graphql/request/context_test.rb +70 -0
  234. data/test/graphql/schema_test.rb +190 -0
  235. data/test/graphql/source_test.rb +237 -0
  236. data/test/graphql/type/enum_test.rb +203 -0
  237. data/test/graphql/type/input_test.rb +138 -0
  238. data/test/graphql/type/interface_test.rb +72 -0
  239. data/test/graphql/type/object_test.rb +104 -0
  240. data/test/graphql/type/scalar/bigint_scalar_test.rb +42 -0
  241. data/test/graphql/type/scalar/binary_scalar_test.rb +17 -0
  242. data/test/graphql/type/scalar/boolean_scalar_test.rb +40 -0
  243. data/test/graphql/type/scalar/date_scalar_test.rb +29 -0
  244. data/test/graphql/type/scalar/date_time_scalar_test.rb +29 -0
  245. data/test/graphql/type/scalar/decimal_scalar_test.rb +28 -0
  246. data/test/graphql/type/scalar/float_scalar_test.rb +22 -0
  247. data/test/graphql/type/scalar/id_scalar_test.rb +26 -0
  248. data/test/graphql/type/scalar/int_scalar_test.rb +26 -0
  249. data/test/graphql/type/scalar/string_scalar_test.rb +17 -0
  250. data/test/graphql/type/scalar/time_scalar_test.rb +36 -0
  251. data/test/graphql/type/scalar_test.rb +45 -0
  252. data/test/graphql/type/union_test.rb +82 -0
  253. data/test/graphql/type_map_test.rb +362 -0
  254. data/test/graphql/type_test.rb +68 -0
  255. data/test/graphql_test.rb +55 -0
  256. data/test/integration/config.rb +56 -0
  257. data/test/integration/memory/star_wars_introspection_test.rb +144 -0
  258. data/test/integration/memory/star_wars_query_test.rb +184 -0
  259. data/test/integration/memory/star_wars_validation_test.rb +99 -0
  260. data/test/integration/schemas/memory.rb +232 -0
  261. data/test/integration/schemas/sqlite.rb +82 -0
  262. data/test/integration/sqlite/star_wars_introspection_test.rb +15 -0
  263. data/test/integration/sqlite/star_wars_mutation_test.rb +82 -0
  264. data/test/integration/sqlite/star_wars_query_test.rb +71 -0
  265. data/test/test_ext.rb +48 -0
  266. metadata +509 -0
@@ -0,0 +1 @@
1
+ {"kind":"Document","loc":{"start": {"line": 8,"column":1}, "end": {"line":78,"column":21}},"definitions":[{"kind":"SchemaDefinition","loc":{"start": {"line": 8,"column":1}, "end": {"line":11,"column":2}},"directives":null,"operationTypes":[{"kind":"OperationTypeDefinition","loc":{"start": {"line": 9,"column":3}, "end": {"line":9,"column":19}},"operation":"query","type":{"kind":"NamedType","loc":{"start": {"line": 9,"column":10}, "end": {"line":9,"column":19}},"name":{"kind":"Name","loc":{"start": {"line": 9,"column":10}, "end": {"line":9,"column":19}},"value":"QueryType"}}},{"kind":"OperationTypeDefinition","loc":{"start": {"line": 10,"column":3}, "end": {"line":10,"column":25}},"operation":"mutation","type":{"kind":"NamedType","loc":{"start": {"line": 10,"column":13}, "end": {"line":10,"column":25}},"name":{"kind":"Name","loc":{"start": {"line": 10,"column":13}, "end": {"line":10,"column":25}},"value":"MutationType"}}}]},{"kind":"ObjectTypeDefinition","loc":{"start": {"line": 13,"column":1}, "end": {"line":21,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 13,"column":6}, "end": {"line":13,"column":9}},"value":"Foo"},"interfaces":[{"kind":"NamedType","loc":{"start": {"line": 13,"column":21}, "end": {"line":13,"column":24}},"name":{"kind":"Name","loc":{"start": {"line": 13,"column":21}, "end": {"line":13,"column":24}},"value":"Bar"}}],"directives":null,"fields":[{"kind":"FieldDefinition","loc":{"start": {"line": 14,"column":3}, "end": {"line":14,"column":12}},"name":{"kind":"Name","loc":{"start": {"line": 14,"column":3}, "end": {"line":14,"column":6}},"value":"one"},"arguments":null,"type":{"kind":"NamedType","loc":{"start": {"line": 14,"column":8}, "end": {"line":14,"column":12}},"name":{"kind":"Name","loc":{"start": {"line": 14,"column":8}, "end": {"line":14,"column":12}},"value":"Type"}},"directives":null},{"kind":"FieldDefinition","loc":{"start": {"line": 15,"column":3}, "end": {"line":15,"column":34}},"name":{"kind":"Name","loc":{"start": {"line": 15,"column":3}, "end": {"line":15,"column":6}},"value":"two"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 15,"column":7}, "end": {"line":15,"column":27}},"name":{"kind":"Name","loc":{"start": {"line": 15,"column":7}, "end": {"line":15,"column":15}},"value":"argument"},"type":{"kind":"NonNullType","loc":{"start": {"line": 15,"column":17}, "end": {"line":15,"column":27}},"type":{"kind":"NamedType","loc":{"start": {"line": 15,"column":17}, "end": {"line":15,"column":26}},"name":{"kind":"Name","loc":{"start": {"line": 15,"column":17}, "end": {"line":15,"column":26}},"value":"InputType"}}},"defaultValue":null,"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 15,"column":30}, "end": {"line":15,"column":34}},"name":{"kind":"Name","loc":{"start": {"line": 15,"column":30}, "end": {"line":15,"column":34}},"value":"Type"}},"directives":null},{"kind":"FieldDefinition","loc":{"start": {"line": 16,"column":3}, "end": {"line":16,"column":49}},"name":{"kind":"Name","loc":{"start": {"line": 16,"column":3}, "end": {"line":16,"column":8}},"value":"three"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 16,"column":9}, "end": {"line":16,"column":28}},"name":{"kind":"Name","loc":{"start": {"line": 16,"column":9}, "end": {"line":16,"column":17}},"value":"argument"},"type":{"kind":"NamedType","loc":{"start": {"line": 16,"column":19}, "end": {"line":16,"column":28}},"name":{"kind":"Name","loc":{"start": {"line": 16,"column":19}, "end": {"line":16,"column":28}},"value":"InputType"}},"defaultValue":null,"directives":null},{"kind":"InputValueDefinition","loc":{"start": {"line": 16,"column":30}, "end": {"line":16,"column":43}},"name":{"kind":"Name","loc":{"start": {"line": 16,"column":30}, "end": {"line":16,"column":35}},"value":"other"},"type":{"kind":"NamedType","loc":{"start": {"line": 16,"column":37}, "end": {"line":16,"column":43}},"name":{"kind":"Name","loc":{"start": {"line": 16,"column":37}, "end": {"line":16,"column":43}},"value":"String"}},"defaultValue":null,"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 16,"column":46}, "end": {"line":16,"column":49}},"name":{"kind":"Name","loc":{"start": {"line": 16,"column":46}, "end": {"line":16,"column":49}},"value":"Int"}},"directives":null},{"kind":"FieldDefinition","loc":{"start": {"line": 17,"column":3}, "end": {"line":17,"column":44}},"name":{"kind":"Name","loc":{"start": {"line": 17,"column":3}, "end": {"line":17,"column":7}},"value":"four"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 17,"column":8}, "end": {"line":17,"column":35}},"name":{"kind":"Name","loc":{"start": {"line": 17,"column":8}, "end": {"line":17,"column":16}},"value":"argument"},"type":{"kind":"NamedType","loc":{"start": {"line": 17,"column":18}, "end": {"line":17,"column":24}},"name":{"kind":"Name","loc":{"start": {"line": 17,"column":18}, "end": {"line":17,"column":24}},"value":"String"}},"defaultValue":{"kind":"StringValue","loc":{"start": {"line": 17,"column":27}, "end": {"line":17,"column":35}},"value":"string"},"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 17,"column":38}, "end": {"line":17,"column":44}},"name":{"kind":"Name","loc":{"start": {"line": 17,"column":38}, "end": {"line":17,"column":44}},"value":"String"}},"directives":null},{"kind":"FieldDefinition","loc":{"start": {"line": 18,"column":3}, "end": {"line":18,"column":58}},"name":{"kind":"Name","loc":{"start": {"line": 18,"column":3}, "end": {"line":18,"column":7}},"value":"five"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 18,"column":8}, "end": {"line":18,"column":49}},"name":{"kind":"Name","loc":{"start": {"line": 18,"column":8}, "end": {"line":18,"column":16}},"value":"argument"},"type":{"kind":"ListType","loc":{"start": {"line": 18,"column":18}, "end": {"line":18,"column":26}},"type":{"kind":"NamedType","loc":{"start": {"line": 18,"column":19}, "end": {"line":18,"column":25}},"name":{"kind":"Name","loc":{"start": {"line": 18,"column":19}, "end": {"line":18,"column":25}},"value":"String"}}},"defaultValue":{"kind":"ListValue","loc":{"start": {"line": 18,"column":29}, "end": {"line":18,"column":49}},"values":[{"kind":"StringValue","loc":{"start": {"line": 18,"column":30}, "end": {"line":18,"column":38}},"value":"string"},{"kind":"StringValue","loc":{"start": {"line": 18,"column":40}, "end": {"line":18,"column":48}},"value":"string"}]},"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 18,"column":52}, "end": {"line":18,"column":58}},"name":{"kind":"Name","loc":{"start": {"line": 18,"column":52}, "end": {"line":18,"column":58}},"value":"String"}},"directives":null},{"kind":"FieldDefinition","loc":{"start": {"line": 19,"column":3}, "end": {"line":19,"column":50}},"name":{"kind":"Name","loc":{"start": {"line": 19,"column":3}, "end": {"line":19,"column":6}},"value":"six"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 19,"column":7}, "end": {"line":19,"column":43}},"name":{"kind":"Name","loc":{"start": {"line": 19,"column":7}, "end": {"line":19,"column":15}},"value":"argument"},"type":{"kind":"NamedType","loc":{"start": {"line": 19,"column":17}, "end": {"line":19,"column":26}},"name":{"kind":"Name","loc":{"start": {"line": 19,"column":17}, "end": {"line":19,"column":26}},"value":"InputType"}},"defaultValue":{"kind":"ObjectValue","loc":{"start": {"line": 19,"column":29}, "end": {"line":19,"column":43}},"fields":[{"kind":"ObjectField","loc":{"start": {"line": 19,"column":30}, "end": {"line":19,"column":42}},"name":{"kind":"Name","loc":{"start": {"line": 19,"column":30}, "end": {"line":19,"column":33}},"value":"key"},"value":{"kind":"StringValue","loc":{"start": {"line": 19,"column":35}, "end": {"line":19,"column":42}},"value":"value"}}]},"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 19,"column":46}, "end": {"line":19,"column":50}},"name":{"kind":"Name","loc":{"start": {"line": 19,"column":46}, "end": {"line":19,"column":50}},"value":"Type"}},"directives":null},{"kind":"FieldDefinition","loc":{"start": {"line": 20,"column":3}, "end": {"line":20,"column":36}},"name":{"kind":"Name","loc":{"start": {"line": 20,"column":3}, "end": {"line":20,"column":8}},"value":"seven"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 20,"column":9}, "end": {"line":20,"column":29}},"name":{"kind":"Name","loc":{"start": {"line": 20,"column":9}, "end": {"line":20,"column":17}},"value":"argument"},"type":{"kind":"NamedType","loc":{"start": {"line": 20,"column":19}, "end": {"line":20,"column":22}},"name":{"kind":"Name","loc":{"start": {"line": 20,"column":19}, "end": {"line":20,"column":22}},"value":"Int"}},"defaultValue":{"kind":"NullValue","loc":{"start": {"line": 20,"column":25}, "end": {"line":20,"column":29}}},"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 20,"column":32}, "end": {"line":20,"column":36}},"name":{"kind":"Name","loc":{"start": {"line": 20,"column":32}, "end": {"line":20,"column":36}},"value":"Type"}},"directives":null}]},{"kind":"ObjectTypeDefinition","loc":{"start": {"line": 23,"column":1}, "end": {"line":25,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 23,"column":6}, "end": {"line":23,"column":21}},"value":"AnnotatedObject"},"interfaces":null,"directives":[{"kind":"Directive","loc":{"start": {"line": 23,"column":22}, "end": {"line":23,"column":45}},"name":{"kind":"Name","loc":{"start": {"line": 23,"column":23}, "end": {"line":23,"column":31}},"value":"onObject"},"arguments":[{"kind":"Argument","loc":{"start": {"line": 23,"column":32}, "end": {"line":23,"column":44}},"name":{"kind":"Name","loc":{"start": {"line": 23,"column":32}, "end": {"line":23,"column":35}},"value":"arg"},"value":{"kind":"StringValue","loc":{"start": {"line": 23,"column":37}, "end": {"line":23,"column":44}},"value":"value"}}]}],"fields":[{"kind":"FieldDefinition","loc":{"start": {"line": 24,"column":3}, "end": {"line":24,"column":62}},"name":{"kind":"Name","loc":{"start": {"line": 24,"column":3}, "end": {"line":24,"column":17}},"value":"annotatedField"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 24,"column":18}, "end": {"line":24,"column":46}},"name":{"kind":"Name","loc":{"start": {"line": 24,"column":18}, "end": {"line":24,"column":21}},"value":"arg"},"type":{"kind":"NamedType","loc":{"start": {"line": 24,"column":23}, "end": {"line":24,"column":27}},"name":{"kind":"Name","loc":{"start": {"line": 24,"column":23}, "end": {"line":24,"column":27}},"value":"Type"}},"defaultValue":{"kind":"StringValue","loc":{"start": {"line": 24,"column":30}, "end": {"line":24,"column":39}},"value":"default"},"directives":[{"kind":"Directive","loc":{"start": {"line": 24,"column":40}, "end": {"line":24,"column":46}},"name":{"kind":"Name","loc":{"start": {"line": 24,"column":41}, "end": {"line":24,"column":46}},"value":"onArg"},"arguments":null}]}],"type":{"kind":"NamedType","loc":{"start": {"line": 24,"column":49}, "end": {"line":24,"column":53}},"name":{"kind":"Name","loc":{"start": {"line": 24,"column":49}, "end": {"line":24,"column":53}},"value":"Type"}},"directives":[{"kind":"Directive","loc":{"start": {"line": 24,"column":54}, "end": {"line":24,"column":62}},"name":{"kind":"Name","loc":{"start": {"line": 24,"column":55}, "end": {"line":24,"column":62}},"value":"onField"},"arguments":null}]}]},{"kind":"InterfaceTypeDefinition","loc":{"start": {"line": 27,"column":1}, "end": {"line":30,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 27,"column":11}, "end": {"line":27,"column":14}},"value":"Bar"},"directives":null,"fields":[{"kind":"FieldDefinition","loc":{"start": {"line": 28,"column":3}, "end": {"line":28,"column":12}},"name":{"kind":"Name","loc":{"start": {"line": 28,"column":3}, "end": {"line":28,"column":6}},"value":"one"},"arguments":null,"type":{"kind":"NamedType","loc":{"start": {"line": 28,"column":8}, "end": {"line":28,"column":12}},"name":{"kind":"Name","loc":{"start": {"line": 28,"column":8}, "end": {"line":28,"column":12}},"value":"Type"}},"directives":null},{"kind":"FieldDefinition","loc":{"start": {"line": 29,"column":3}, "end": {"line":29,"column":44}},"name":{"kind":"Name","loc":{"start": {"line": 29,"column":3}, "end": {"line":29,"column":7}},"value":"four"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 29,"column":8}, "end": {"line":29,"column":35}},"name":{"kind":"Name","loc":{"start": {"line": 29,"column":8}, "end": {"line":29,"column":16}},"value":"argument"},"type":{"kind":"NamedType","loc":{"start": {"line": 29,"column":18}, "end": {"line":29,"column":24}},"name":{"kind":"Name","loc":{"start": {"line": 29,"column":18}, "end": {"line":29,"column":24}},"value":"String"}},"defaultValue":{"kind":"StringValue","loc":{"start": {"line": 29,"column":27}, "end": {"line":29,"column":35}},"value":"string"},"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 29,"column":38}, "end": {"line":29,"column":44}},"name":{"kind":"Name","loc":{"start": {"line": 29,"column":38}, "end": {"line":29,"column":44}},"value":"String"}},"directives":null}]},{"kind":"InterfaceTypeDefinition","loc":{"start": {"line": 32,"column":1}, "end": {"line":34,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 32,"column":11}, "end": {"line":32,"column":29}},"value":"AnnotatedInterface"},"directives":[{"kind":"Directive","loc":{"start": {"line": 32,"column":30}, "end": {"line":32,"column":42}},"name":{"kind":"Name","loc":{"start": {"line": 32,"column":31}, "end": {"line":32,"column":42}},"value":"onInterface"},"arguments":null}],"fields":[{"kind":"FieldDefinition","loc":{"start": {"line": 33,"column":3}, "end": {"line":33,"column":50}},"name":{"kind":"Name","loc":{"start": {"line": 33,"column":3}, "end": {"line":33,"column":17}},"value":"annotatedField"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 33,"column":18}, "end": {"line":33,"column":34}},"name":{"kind":"Name","loc":{"start": {"line": 33,"column":18}, "end": {"line":33,"column":21}},"value":"arg"},"type":{"kind":"NamedType","loc":{"start": {"line": 33,"column":23}, "end": {"line":33,"column":27}},"name":{"kind":"Name","loc":{"start": {"line": 33,"column":23}, "end": {"line":33,"column":27}},"value":"Type"}},"defaultValue":null,"directives":[{"kind":"Directive","loc":{"start": {"line": 33,"column":28}, "end": {"line":33,"column":34}},"name":{"kind":"Name","loc":{"start": {"line": 33,"column":29}, "end": {"line":33,"column":34}},"value":"onArg"},"arguments":null}]}],"type":{"kind":"NamedType","loc":{"start": {"line": 33,"column":37}, "end": {"line":33,"column":41}},"name":{"kind":"Name","loc":{"start": {"line": 33,"column":37}, "end": {"line":33,"column":41}},"value":"Type"}},"directives":[{"kind":"Directive","loc":{"start": {"line": 33,"column":42}, "end": {"line":33,"column":50}},"name":{"kind":"Name","loc":{"start": {"line": 33,"column":43}, "end": {"line":33,"column":50}},"value":"onField"},"arguments":null}]}]},{"kind":"UnionTypeDefinition","loc":{"start": {"line": 36,"column":1}, "end": {"line":36,"column":38}},"name":{"kind":"Name","loc":{"start": {"line": 36,"column":7}, "end": {"line":36,"column":11}},"value":"Feed"},"directives":null,"types":[{"kind":"NamedType","loc":{"start": {"line": 36,"column":14}, "end": {"line":36,"column":19}},"name":{"kind":"Name","loc":{"start": {"line": 36,"column":14}, "end": {"line":36,"column":19}},"value":"Story"}},{"kind":"NamedType","loc":{"start": {"line": 36,"column":22}, "end": {"line":36,"column":29}},"name":{"kind":"Name","loc":{"start": {"line": 36,"column":22}, "end": {"line":36,"column":29}},"value":"Article"}},{"kind":"NamedType","loc":{"start": {"line": 36,"column":32}, "end": {"line":36,"column":38}},"name":{"kind":"Name","loc":{"start": {"line": 36,"column":32}, "end": {"line":36,"column":38}},"value":"Advert"}}]},{"kind":"UnionTypeDefinition","loc":{"start": {"line": 38,"column":1}, "end": {"line":38,"column":38}},"name":{"kind":"Name","loc":{"start": {"line": 38,"column":7}, "end": {"line":38,"column":21}},"value":"AnnotatedUnion"},"directives":[{"kind":"Directive","loc":{"start": {"line": 38,"column":22}, "end": {"line":38,"column":30}},"name":{"kind":"Name","loc":{"start": {"line": 38,"column":23}, "end": {"line":38,"column":30}},"value":"onUnion"},"arguments":null}],"types":[{"kind":"NamedType","loc":{"start": {"line": 38,"column":33}, "end": {"line":38,"column":34}},"name":{"kind":"Name","loc":{"start": {"line": 38,"column":33}, "end": {"line":38,"column":34}},"value":"A"}},{"kind":"NamedType","loc":{"start": {"line": 38,"column":37}, "end": {"line":38,"column":38}},"name":{"kind":"Name","loc":{"start": {"line": 38,"column":37}, "end": {"line":38,"column":38}},"value":"B"}}]},{"kind":"ScalarTypeDefinition","loc":{"start": {"line": 40,"column":1}, "end": {"line":40,"column":20}},"name":{"kind":"Name","loc":{"start": {"line": 40,"column":8}, "end": {"line":40,"column":20}},"value":"CustomScalar"},"directives":null},{"kind":"ScalarTypeDefinition","loc":{"start": {"line": 42,"column":1}, "end": {"line":42,"column":33}},"name":{"kind":"Name","loc":{"start": {"line": 42,"column":8}, "end": {"line":42,"column":23}},"value":"AnnotatedScalar"},"directives":[{"kind":"Directive","loc":{"start": {"line": 42,"column":24}, "end": {"line":42,"column":33}},"name":{"kind":"Name","loc":{"start": {"line": 42,"column":25}, "end": {"line":42,"column":33}},"value":"onScalar"},"arguments":null}]},{"kind":"EnumTypeDefinition","loc":{"start": {"line": 44,"column":1}, "end": {"line":47,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 44,"column":6}, "end": {"line":44,"column":10}},"value":"Site"},"directives":null,"values":[{"kind":"EnumValueDefinition","loc":{"start": {"line": 45,"column":3}, "end": {"line":45,"column":10}},"name":{"kind":"Name","loc":{"start": {"line": 45,"column":3}, "end": {"line":45,"column":10}},"value":"DESKTOP"},"directives":null},{"kind":"EnumValueDefinition","loc":{"start": {"line": 46,"column":3}, "end": {"line":46,"column":9}},"name":{"kind":"Name","loc":{"start": {"line": 46,"column":3}, "end": {"line":46,"column":9}},"value":"MOBILE"},"directives":null}]},{"kind":"EnumTypeDefinition","loc":{"start": {"line": 49,"column":1}, "end": {"line":52,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 49,"column":6}, "end": {"line":49,"column":19}},"value":"AnnotatedEnum"},"directives":[{"kind":"Directive","loc":{"start": {"line": 49,"column":20}, "end": {"line":49,"column":27}},"name":{"kind":"Name","loc":{"start": {"line": 49,"column":21}, "end": {"line":49,"column":27}},"value":"onEnum"},"arguments":null}],"values":[{"kind":"EnumValueDefinition","loc":{"start": {"line": 50,"column":3}, "end": {"line":50,"column":31}},"name":{"kind":"Name","loc":{"start": {"line": 50,"column":3}, "end": {"line":50,"column":18}},"value":"ANNOTATED_VALUE"},"directives":[{"kind":"Directive","loc":{"start": {"line": 50,"column":19}, "end": {"line":50,"column":31}},"name":{"kind":"Name","loc":{"start": {"line": 50,"column":20}, "end": {"line":50,"column":31}},"value":"onEnumValue"},"arguments":null}]},{"kind":"EnumValueDefinition","loc":{"start": {"line": 51,"column":3}, "end": {"line":51,"column":14}},"name":{"kind":"Name","loc":{"start": {"line": 51,"column":3}, "end": {"line":51,"column":14}},"value":"OTHER_VALUE"},"directives":null}]},{"kind":"InputObjectTypeDefinition","loc":{"start": {"line": 54,"column":1}, "end": {"line":57,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 54,"column":7}, "end": {"line":54,"column":16}},"value":"InputType"},"directives":null,"fields":[{"kind":"InputValueDefinition","loc":{"start": {"line": 55,"column":3}, "end": {"line":55,"column":15}},"name":{"kind":"Name","loc":{"start": {"line": 55,"column":3}, "end": {"line":55,"column":6}},"value":"key"},"type":{"kind":"NonNullType","loc":{"start": {"line": 55,"column":8}, "end": {"line":55,"column":15}},"type":{"kind":"NamedType","loc":{"start": {"line": 55,"column":8}, "end": {"line":55,"column":14}},"name":{"kind":"Name","loc":{"start": {"line": 55,"column":8}, "end": {"line":55,"column":14}},"value":"String"}}},"defaultValue":null,"directives":null},{"kind":"InputValueDefinition","loc":{"start": {"line": 56,"column":3}, "end": {"line":56,"column":19}},"name":{"kind":"Name","loc":{"start": {"line": 56,"column":3}, "end": {"line":56,"column":9}},"value":"answer"},"type":{"kind":"NamedType","loc":{"start": {"line": 56,"column":11}, "end": {"line":56,"column":14}},"name":{"kind":"Name","loc":{"start": {"line": 56,"column":11}, "end": {"line":56,"column":14}},"value":"Int"}},"defaultValue":{"kind":"IntValue","loc":{"start": {"line": 56,"column":17}, "end": {"line":56,"column":19}},"value":"42"},"directives":null}]},{"kind":"InputObjectTypeDefinition","loc":{"start": {"line": 59,"column":1}, "end": {"line":61,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 59,"column":7}, "end": {"line":59,"column":21}},"value":"AnnotatedInput"},"directives":[{"kind":"Directive","loc":{"start": {"line": 59,"column":22}, "end": {"line":59,"column":40}},"name":{"kind":"Name","loc":{"start": {"line": 59,"column":23}, "end": {"line":59,"column":40}},"value":"onInputObjectType"},"arguments":null}],"fields":[{"kind":"InputValueDefinition","loc":{"start": {"line": 60,"column":3}, "end": {"line":60,"column":32}},"name":{"kind":"Name","loc":{"start": {"line": 60,"column":3}, "end": {"line":60,"column":17}},"value":"annotatedField"},"type":{"kind":"NamedType","loc":{"start": {"line": 60,"column":19}, "end": {"line":60,"column":23}},"name":{"kind":"Name","loc":{"start": {"line": 60,"column":19}, "end": {"line":60,"column":23}},"value":"Type"}},"defaultValue":null,"directives":[{"kind":"Directive","loc":{"start": {"line": 60,"column":24}, "end": {"line":60,"column":32}},"name":{"kind":"Name","loc":{"start": {"line": 60,"column":25}, "end": {"line":60,"column":32}},"value":"onField"},"arguments":null}]}]},{"kind":"TypeExtensionDefinition","loc":{"start": {"line": 63,"column":1}, "end": {"line":65,"column":2}},"definition":{"kind":"ObjectTypeDefinition","loc":{"start": {"line": 63,"column":8}, "end": {"line":65,"column":2}},"name":{"kind":"Name","loc":{"start": {"line": 63,"column":13}, "end": {"line":63,"column":16}},"value":"Foo"},"interfaces":null,"directives":null,"fields":[{"kind":"FieldDefinition","loc":{"start": {"line": 64,"column":3}, "end": {"line":64,"column":34}},"name":{"kind":"Name","loc":{"start": {"line": 64,"column":3}, "end": {"line":64,"column":8}},"value":"seven"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 64,"column":9}, "end": {"line":64,"column":27}},"name":{"kind":"Name","loc":{"start": {"line": 64,"column":9}, "end": {"line":64,"column":17}},"value":"argument"},"type":{"kind":"ListType","loc":{"start": {"line": 64,"column":19}, "end": {"line":64,"column":27}},"type":{"kind":"NamedType","loc":{"start": {"line": 64,"column":20}, "end": {"line":64,"column":26}},"name":{"kind":"Name","loc":{"start": {"line": 64,"column":20}, "end": {"line":64,"column":26}},"value":"String"}}},"defaultValue":null,"directives":null}],"type":{"kind":"NamedType","loc":{"start": {"line": 64,"column":30}, "end": {"line":64,"column":34}},"name":{"kind":"Name","loc":{"start": {"line": 64,"column":30}, "end": {"line":64,"column":34}},"value":"Type"}},"directives":null}]}},{"kind":"DirectiveDefinition","loc":{"start": {"line": 73,"column":1}, "end": {"line":73,"column":75}},"name":{"kind":"Name","loc":{"start": {"line": 73,"column":12}, "end": {"line":73,"column":16}},"value":"skip"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 73,"column":17}, "end": {"line":73,"column":29}},"name":{"kind":"Name","loc":{"start": {"line": 73,"column":17}, "end": {"line":73,"column":19}},"value":"if"},"type":{"kind":"NonNullType","loc":{"start": {"line": 73,"column":21}, "end": {"line":73,"column":29}},"type":{"kind":"NamedType","loc":{"start": {"line": 73,"column":21}, "end": {"line":73,"column":28}},"name":{"kind":"Name","loc":{"start": {"line": 73,"column":21}, "end": {"line":73,"column":28}},"value":"Boolean"}}},"defaultValue":null,"directives":null}],"locations":[{"kind":"Name","loc":{"start": {"line": 73,"column":34}, "end": {"line":73,"column":39}},"value":"FIELD"},{"kind":"Name","loc":{"start": {"line": 73,"column":42}, "end": {"line":73,"column":57}},"value":"FRAGMENT_SPREAD"},{"kind":"Name","loc":{"start": {"line": 73,"column":60}, "end": {"line":73,"column":75}},"value":"INLINE_FRAGMENT"}]},{"kind":"DirectiveDefinition","loc":{"start": {"line": 75,"column":1}, "end": {"line":78,"column":21}},"name":{"kind":"Name","loc":{"start": {"line": 75,"column":12}, "end": {"line":75,"column":19}},"value":"include"},"arguments":[{"kind":"InputValueDefinition","loc":{"start": {"line": 75,"column":20}, "end": {"line":75,"column":32}},"name":{"kind":"Name","loc":{"start": {"line": 75,"column":20}, "end": {"line":75,"column":22}},"value":"if"},"type":{"kind":"NonNullType","loc":{"start": {"line": 75,"column":24}, "end": {"line":75,"column":32}},"type":{"kind":"NamedType","loc":{"start": {"line": 75,"column":24}, "end": {"line":75,"column":31}},"name":{"kind":"Name","loc":{"start": {"line": 75,"column":24}, "end": {"line":75,"column":31}},"value":"Boolean"}}},"defaultValue":null,"directives":null}],"locations":[{"kind":"Name","loc":{"start": {"line": 76,"column":6}, "end": {"line":76,"column":11}},"value":"FIELD"},{"kind":"Name","loc":{"start": {"line": 77,"column":6}, "end": {"line":77,"column":21}},"value":"FRAGMENT_SPREAD"},{"kind":"Name","loc":{"start": {"line": 78,"column":6}, "end": {"line":78,"column":21}},"value":"INLINE_FRAGMENT"}]}]}
@@ -0,0 +1,33 @@
1
+ {
2
+ <osx_strdup_query_string>
3
+ Memcheck:Cond
4
+ fun:strlen
5
+ fun:strdup
6
+ fun:_ZN2yy17GraphQLParserImpl5parseEv
7
+ fun:_ZN8facebook7graphqlL7doParseEPPKcPv
8
+ fun:_ZN8facebook7graphql11parseStringEPKcPS2_
9
+ fun:_ZL11expectErrorPKcS0_
10
+ fun:_ZN44ParserTests_TracksLocationAcrossStrings_Test8TestBodyEv
11
+ fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
12
+ fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
13
+ fun:_ZN7testing4Test3RunEv
14
+ fun:_ZN7testing8TestInfo3RunEv
15
+ fun:_ZN7testing8TestCase3RunEv
16
+ }
17
+
18
+ {
19
+ <unix_strdup_query_string>
20
+ Memcheck:Cond
21
+ fun:__GI_strlen
22
+ fun:strdup
23
+ fun:_ZN2yy17GraphQLParserImpl5parseEv
24
+ fun:_ZN8facebook7graphqlL7doParseEPPKcPv
25
+ fun:_ZN8facebook7graphql11parseStringEPKcPS2_
26
+ fun:_ZL11expectErrorPKcS0_
27
+ fun:_ZN44ParserTests_TracksLocationAcrossStrings_Test8TestBodyEv
28
+ fun:_ZN7testing8internal38HandleSehExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
29
+ fun:_ZN7testing8internal35HandleExceptionsInMethodIfSupportedINS_4TestEvEET0_PT_MS4_FS3_vEPKc
30
+ fun:_ZN7testing4Test3RunEv
31
+ fun:_ZN7testing8TestInfo3RunEv
32
+ fun:_ZN7testing8TestCase3RunEv
33
+ }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2020-present, VirtualShield
3
+ *
4
+ * This ensures GraphQL headers and provides minimal ruby initialization
5
+ *
6
+ * This source code is licensed under the MIT license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+
10
+ #include "ruby.h"
11
+
12
+ #include "c/GraphQLParser.cpp"
13
+
14
+ extern "C" {
15
+ void Init_graphqlparser() {
16
+ const char *version = GRAPHQLPARSER_VERSION;
17
+
18
+ VALUE mod = rb_define_module("GQLAst");
19
+ rb_define_const(mod, "VERSION", rb_str_new(version, strlen(version)));
20
+ }
21
+ }
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/base'
4
+
5
+ module GraphQL
6
+ module Generators
7
+ class ControllerGenerator < Rails::Generators::Base # :nodoc:
8
+ include Rails::GraphQL::BaseGenerator
9
+
10
+ desc 'Add a new controller that operates with GraphQL'
11
+ argument :name, type: :string, optional: true
12
+
13
+ def create_controller_file
14
+ template 'controller.erb', "app/controllers/#{controller_name.underscore}.rb"
15
+ end
16
+
17
+ def controller_name
18
+ @controller_name ||= (options[:name].presence&.classify || 'GraphQL') + 'Controller'
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rails/generators/base'
4
+
5
+ module GraphQL
6
+ module Generators
7
+ class SchemaGenerator < Rails::Generators::Base # :nodoc:
8
+ include Rails::GraphQL::BaseGenerator
9
+
10
+ desc 'Add a new GraphQL schema'
11
+ argument :name, type: :string, optional: true
12
+
13
+ def create_schema_file
14
+ template 'schema.erb', "#{options[:directory]}/#{schema_name.underscore}.rb"
15
+ end
16
+
17
+ def schema_name
18
+ @schema_name ||= options[:name].presence || "#{app_module_name}Schema"
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,5 @@
1
+ <% module_namespacing do -%>
2
+ class <%= controller_name %> < ApplicationController
3
+ include GraphQL::Controller
4
+ end
5
+ <% end -%>
@@ -0,0 +1,6 @@
1
+ module GraphQL
2
+ <% module_namespacing do -%>
3
+ class <%= schema_name %> < Schema
4
+ end
5
+ <% end -%>
6
+ end
Binary file
@@ -0,0 +1,2 @@
1
+ require 'graphqlparser'
2
+ require 'rails/graphql'
@@ -0,0 +1 @@
1
+ # frozen_string_literal: true
@@ -0,0 +1,185 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_model'
4
+ require 'active_support'
5
+
6
+ require 'active_support/core_ext/module/attribute_accessors_per_thread'
7
+ require 'active_support/core_ext/string/strip'
8
+
9
+ require 'rails/graphql/version'
10
+
11
+ ActiveSupport::Inflector.inflections(:en) do |inflect|
12
+ inflect.acronym 'GraphiQL'
13
+ inflect.acronym 'GraphQL'
14
+ inflect.acronym 'GQLAst'
15
+ end
16
+
17
+ module Rails # :nodoc:
18
+ # = Rails GraphQL
19
+ #
20
+ # This implementation tries to be as close as the GraphQL spec as possible,
21
+ # meaning that this lib shares most of the same names and directions provided
22
+ # by the GraphQL spec. You can use {Rails::GraphQL::SPEC_VERSION}[rdoc-ref:Rails::GraphQL]
23
+ # to check which spec is being sued.
24
+ #
25
+ # Using ActiveSupport, define all the needed objects but doesn't load them
26
+ # since it's better to trust on eager_load in order to proper load the objects.
27
+ #
28
+ # A very important concept is that Singleton definitions are a direct
29
+ # connection to a {GraphQL Introspection}[http://spec.graphql.org/June2018/#sec-Introspection],
30
+ # meaning that to query the introspection is to query everything defined and
31
+ # associated with the GraphQL objects, the only exception are arguments,
32
+ # directives and fields:
33
+ #
34
+ # * <tt>Arguments:</tt> They are strictly associated with the object that
35
+ # defined it, also arguments with the same name doesn't mean they have the
36
+ # same behavior or configuration.
37
+ # * <tt>Directives:</tt> A directive definition belongs to the introspection
38
+ # and is handled in the Singleton extent. They are handled as instance
39
+ # whenever a definition or an execution uses them.
40
+ # * <tt>Fields:</tt> Many other types and helper containers holds a serie of
41
+ # fields, which means that fields with the same name will probably behave
42
+ # differently.
43
+ #
44
+ # TODO: Create the concept of MutationSet as a way to group mutations under
45
+ # the same class but placed onto a reference
46
+ module GraphQL
47
+ extend ActiveSupport::Autoload
48
+
49
+ include ActiveSupport::Configurable
50
+
51
+ # Stores the version of the GraphQL spec used for this implementation
52
+ SPEC_VERSION = 'June 2018'
53
+
54
+ # Runtime registry for request execution time
55
+ RuntimeRegistry = Class.new { thread_mattr_accessor :gql_runtime }
56
+
57
+ autoload :ToGQL
58
+ autoload :Helpers
59
+ autoload :Collectors
60
+
61
+ eager_autoload do
62
+ autoload_under :railties do
63
+ autoload :BaseGenerator
64
+ autoload :Controller
65
+ autoload :ControllerRuntime
66
+ autoload :LogSubscriber
67
+ end
68
+
69
+ autoload :Callback
70
+ autoload :Event
71
+ autoload :Native
72
+ autoload :Request
73
+ autoload :Source
74
+ autoload :TypeMap
75
+
76
+ autoload :Argument
77
+ autoload :Directive
78
+ autoload :Field
79
+ autoload :Introspection
80
+ autoload :Schema
81
+ autoload :Type
82
+ end
83
+
84
+ class << self
85
+ # Access to the type mapper
86
+ def type_map
87
+ @@type_map ||= GraphQL::TypeMap.new
88
+ end
89
+
90
+ # Find the key associated with the given +adapter_name+
91
+ def ar_adapter_key(adapter_name)
92
+ config.ar_adapters[adapter_name]
93
+ end
94
+
95
+ # This is a little helper to require ActiveRecord adapter specific
96
+ # configurations
97
+ def enable_ar_adapter(adapter_name)
98
+ return if (@@loaded_adapters ||= Set.new).include?(adapter_name)
99
+
100
+ path = "adapters/#{ar_adapter_key(adapter_name)}_adapter"
101
+ $LOAD_PATH.any? do |load_path|
102
+ next unless load_path.to_s =~ %r{\/app\/graphql$}
103
+ next unless File.exist?("#{load_path}/#{path}.rb")
104
+ load "#{load_path}/#{path}.rb"
105
+ end || load("#{__dir__}/graphql/#{path}.rb")
106
+
107
+ @@loaded_adapters << adapter_name
108
+ end
109
+
110
+ # Due to reloader process, adapter settings need to be reloaded
111
+ def reload_ar_adapters!
112
+ return unless defined?(@@loaded_adapters)
113
+ adapters, @@loaded_adapters = @@loaded_adapters, Set.new
114
+ adapters.map(&method(:enable_ar_adapter))
115
+ end
116
+
117
+ # Turn the given object into its string representation as GraphQl
118
+ # See {ToGQL}[rdoc-ref:Rails::GraphQL::ToGQL] class.
119
+ def to_gql(object, **xargs)
120
+ ToGQL.compile(object, **xargs)
121
+ end
122
+
123
+ alias to_graphql to_gql
124
+
125
+ # Returns a set instance with uniq directives from the given list.
126
+ # If the same directive class is given twice, it will raise an exception,
127
+ # since they must be uniq within a list of directives.
128
+ #
129
+ # Use the others argument to provide a list of already defined directives
130
+ # so the check can be performed using a +inherited_collection+.
131
+ #
132
+ # If a +source+ is provided, then an +:attach+ event will be triggered
133
+ # for each directive on the givem source element.
134
+ def directives_to_set(list, others = [], event = nil, **xargs)
135
+ others = others.dup
136
+
137
+ if (source = xargs.delete(:source)).present?
138
+ location = xargs.delete(:location) || source.try(:directive_location)
139
+ event ||= GraphQL::Event.new(:attach, source, **xargs.reverse_merge(
140
+ phase: :definition,
141
+ ))
142
+ end
143
+
144
+ Array.wrap(list).each_with_object(Set.new) do |item, result|
145
+ raise ArgumentError, <<~MSG.squish unless item.kind_of?(GraphQL::Directive)
146
+ The "#{item.class}" is not a valid directive.
147
+ MSG
148
+
149
+ invalid = others.present? && (others.any? { |k| k.class.eql?(item.class) })
150
+ raise DuplicatedError, <<~MSG.squish if invalid
151
+ A @#{item.gql_name} directive have already been provided.
152
+ MSG
153
+
154
+ invalid_location = location.present? && !item.locations.include?(location)
155
+ raise ArgumentError, <<~MSG.squish if invalid_location
156
+ You cannot use @#{item.gql_name} directive due to location restriction.
157
+ MSG
158
+
159
+ unless event.nil?
160
+ item.assing_owner!(event.source)
161
+ event.trigger_object(item)
162
+ end
163
+
164
+ others << item
165
+ result << item
166
+ end
167
+ end
168
+
169
+ def eager_load! # :nodoc:
170
+ super
171
+
172
+ GraphQL::Request.eager_load!
173
+ GraphQL::Source.eager_load!
174
+
175
+ GraphQL::Directive.eager_load!
176
+ GraphQL::Type.eager_load!
177
+ end
178
+ end
179
+ end
180
+ end
181
+
182
+ require 'rails/graphql/config'
183
+ require 'rails/graphql/errors'
184
+ require 'rails/graphql/shortcuts'
185
+ require 'rails/graphql/railtie'
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails # :nodoc:
4
+ module GraphQL # :nodoc:
5
+ # Based on:
6
+ # SELECT t.oid, t.typname, format_type(t.oid, NULL) AS sql_type
7
+ # FROM pg_type t
8
+ # WHERE typtype = 'b'
9
+ # AND typcategory IN ('B', 'D', 'G', 'I', 'N', 'S', 'T', 'V')
10
+ # AND typowner = 10;
11
+ type_map.register_alias 'pg:boolean', :boolean
12
+ type_map.register_alias 'pg:integer', :int
13
+ type_map.register_alias 'pg:date', :date
14
+
15
+ type_map.register_alias 'pg:char', :string
16
+ type_map.register_alias 'pg:bigint', :bigint
17
+ type_map.register_alias 'pg:smallint', :int
18
+ type_map.register_alias 'pg:text', :string
19
+ type_map.register_alias 'pg:oid', :int
20
+ type_map.register_alias 'pg:real', :float
21
+ type_map.register_alias 'pg:double precision', :float
22
+ type_map.register_alias 'pg:money', :decimal
23
+ type_map.register_alias 'pg:character', :string
24
+ type_map.register_alias 'pg:character varying', :string
25
+ type_map.register_alias 'pg:timestamp', :date_time
26
+ type_map.register_alias 'pg:timestamp without time zone', :date_time
27
+ type_map.register_alias 'pg:timestamp with time zone', :date_time
28
+ type_map.register_alias 'pg:time without time zone', :time
29
+ type_map.register_alias 'pg:time with time zone', :time
30
+ type_map.register_alias 'pg:numeric', :decimal
31
+
32
+ module PG # :nodoc: all
33
+ module SourceMethods
34
+ protected
35
+
36
+ def pg_attributes
37
+ model.columns_hash.each_value do |column|
38
+ type_name = column.sql_type_metadata.sql_type
39
+ type = find_type!('pg:' + type_name.gsub(/(\(|\[).*/, ''), fallback: :string)
40
+
41
+ options = { array: type_name.include?('[]') }
42
+ yield column.name, type, options
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ Source::ActiveRecordSource.extend(PG::SourceMethods)
49
+ end
50
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails # :nodoc:
4
+ module GraphQL # :nodoc:
5
+
6
+ # Based on:
7
+ # https://github.com/rails/rails/blob/v6.0.0/activerecord/lib/active_record/
8
+ # connection_adapters/sqlite3_adapter.rb#L64
9
+ type_map.register_alias 'sqlite:primary_key', :id
10
+ type_map.register_alias 'sqlite:string', :string
11
+ type_map.register_alias 'sqlite:text', :string
12
+ type_map.register_alias 'sqlite:integer', :int
13
+ type_map.register_alias 'sqlite:float', :float
14
+ type_map.register_alias 'sqlite:decimal', :decimal
15
+ type_map.register_alias 'sqlite:datetime', :date_time
16
+ type_map.register_alias 'sqlite:time', :time
17
+ type_map.register_alias 'sqlite:date', :date
18
+ type_map.register_alias 'sqlite:binary', :binary
19
+ type_map.register_alias 'sqlite:boolean', :boolean
20
+ # TODO: Add support to JSON type
21
+ # type_map.register_alias 'pg:json', :json
22
+
23
+ module SQLite # :nodoc: all
24
+ module SourceMethods
25
+ protected
26
+
27
+ def sqlite_attributes
28
+ model.columns_hash.each_value do |column|
29
+ type_name = column.sql_type_metadata.sql_type
30
+ type = find_type!("sqlite:#{type_name}", fallback: :string)
31
+ yield column.name, type
32
+ end
33
+ end
34
+ end
35
+ end
36
+
37
+ Source::ActiveRecordSource.extend(SQLite::SourceMethods)
38
+ end
39
+ end
@@ -0,0 +1,220 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Rails # :nodoc:
4
+ module GraphQL # :nodoc:
5
+ # = GraphQL Argument
6
+ #
7
+ # This represents an item from the ArgumentsDefinition, which was supposed
8
+ # to be named InputValue, but for clarification, they work more like
9
+ # function arguments.
10
+ # See http://spec.graphql.org/June2018/#ArgumentsDefinition
11
+ #
12
+ # An argument also works very similar to an ActiveRecord column. For this
13
+ # reason, multi dimensional arrays are not supported. You can define custom
14
+ # input types in order to accomplish something similar to a multi-dimensional
15
+ # array as input.
16
+ #
17
+ # ==== Options
18
+ #
19
+ # * <tt>:owner</tt> - The may object that this argument belongs to.
20
+ # * <tt>:null</tt> - Marks if the overall type can be null
21
+ # (defaults to true).
22
+ # * <tt>:array</tt> - Marks if the type should be wrapped as an array
23
+ # (defaults to false).
24
+ # * <tt>:nullable</tt> - Marks if the internal values of an array can be null
25
+ # (defaults to true).
26
+ # * <tt>:full</tt> - Shortcut for +null: false, nullable: false, array: true+
27
+ # (defaults to false).
28
+ # * <tt>:default</tt> - Sets a default value for the argument
29
+ # (defaults to nil).
30
+ # * <tt>:desc</tt> - The description of the argument
31
+ # (defaults to nil).
32
+ class Argument
33
+ include Helpers::WithValidator
34
+
35
+ # TODO: When arguments are attached to output fields they can have
36
+ # directives so add this possibility
37
+
38
+ attr_reader :name, :gql_name, :type, :owner, :default
39
+ attr_accessor :node
40
+
41
+ delegate :namespaces, to: :owner
42
+
43
+ def initialize(
44
+ name,
45
+ type,
46
+ owner:,
47
+ null: true,
48
+ full: false,
49
+ array: false,
50
+ nullable: true,
51
+ default: nil,
52
+ desc: nil
53
+ )
54
+ @owner = owner
55
+ @name = name.to_s.underscore.to_sym
56
+ @gql_name = @name.to_s.camelize(:lower)
57
+
58
+ if type.is_a?(Module) && type < GraphQL::Type
59
+ @type_klass = type
60
+ @type = type.name
61
+ else
62
+ @type = type.to_s.underscore.to_sym
63
+ end
64
+
65
+ @null = full ? false : null
66
+ @array = full ? true : array
67
+ @nullable = full ? false : nullable
68
+
69
+ @default = default
70
+ @desc = desc&.strip_heredoc&.chomp
71
+ end
72
+
73
+ def initialize_copy(*)
74
+ super
75
+
76
+ @owner = nil
77
+ @type_klass = nil
78
+ end
79
+
80
+ # Check if the other argument is equivalent
81
+ def ==(other)
82
+ other.gql_name == gql_name && self =~ other
83
+ end
84
+
85
+ # Check if the other argument is equivalent, regardless the name
86
+ def =~(other)
87
+ return false unless other.is_a?(Argument)
88
+ other.type_klass == type_klass &&
89
+ other.array? == array? &&
90
+ (other.null? == null? || other.null? && !null?) &&
91
+ (other.nullable? == nullable? || other.nullable? && !nullable?)
92
+ end
93
+
94
+ # Return the class of the type object
95
+ def type_klass
96
+ @type_klass ||= GraphQL.type_map.fetch!(type,
97
+ namespaces: namespaces,
98
+ prevent_register: owner,
99
+ )
100
+ end
101
+
102
+ # Checks if the argument can be null
103
+ def null?
104
+ !!@null
105
+ end
106
+
107
+ # Checks if the argument can be an array
108
+ def array?
109
+ !!@array
110
+ end
111
+
112
+ # Checks if the argument can have null elements in the array
113
+ def nullable?
114
+ !!@nullable
115
+ end
116
+
117
+ # Return the description of the argument
118
+ def description
119
+ @desc
120
+ end
121
+
122
+ # Checks if a description was provided
123
+ def description?
124
+ !!@desc
125
+ end
126
+
127
+ # Checks if a given default value was provided
128
+ def default_value?
129
+ !@default.nil?
130
+ end
131
+
132
+ # Transforms the given value to its representation in a JSON string
133
+ def to_json(value = nil)
134
+ value = @default if value.nil?
135
+
136
+ return 'null' if value.nil?
137
+ return type_klass.to_json(value) unless array?
138
+ value.map { |part| type_klass.to_json(part) }
139
+ end
140
+
141
+ # Turn the given value into a JSON string representation
142
+ def as_json(value = nil)
143
+ value = @default if value.nil?
144
+
145
+ return if value.nil?
146
+ return type_klass.as_json(value) unless array?
147
+ value.map { |part| type_klass.as_json(part) }
148
+ end
149
+
150
+ # Turn the given value into a ruby object through deserialization
151
+ def deserialize(value = nil)
152
+ value = @default if value.nil?
153
+
154
+ return if value.nil?
155
+ return type_klass.deserialize(value) unless array?
156
+ value.map { |part| type_klass.deserialize(part) }
157
+ end
158
+
159
+ # This checks if a given serialized value is valid for this field
160
+ def valid_input?(value)
161
+ return null? if value.nil?
162
+ return valid_input_array?(value) if array?
163
+ type_klass.valid_input?(value)
164
+ end
165
+
166
+ alias valid? valid_input?
167
+
168
+ # Trigger the exception based value validator
169
+ def validate_output!(value)
170
+ super(value, :argument)
171
+ end
172
+
173
+ # Checks if the definition of the argument is valid
174
+ def validate!(*)
175
+ super if defined? super
176
+
177
+ raise NameError, <<~MSG.squish if gql_name.start_with?('__')
178
+ The name "#{gql_name}" is invalid. Argument names cannot start with "__".
179
+ MSG
180
+
181
+ raise ArgumentError, <<~MSG.squish unless type_klass.is_a?(Module)
182
+ Unable to find the "#{type.inspect}" input type on GraphQL context.
183
+ MSG
184
+
185
+ raise ArgumentError, <<~MSG.squish unless type_klass.input_type?
186
+ The "#{type_klass.gql_name}" is not a valid input type.
187
+ MSG
188
+
189
+ raise ArgumentError, <<~MSG.squish unless default.nil? || valid?(default)
190
+ The given default value "#{default.inspect}" is not valid for this argument.
191
+ MSG
192
+ end
193
+
194
+ # This allows combining arguments
195
+ def +(other)
196
+ [self, other].flatten
197
+ end
198
+
199
+ alias_method :&, :+
200
+
201
+ def inspect # :nodoc:
202
+ result = "#{name}: "
203
+ result += '[' if array?
204
+ result += type_klass.gql_name
205
+ result += '!' if array? && !nullable?
206
+ result += ']' if array?
207
+ result += '!' unless null?
208
+ result += " = #{to_hash.inspect}" if default_value?
209
+ result
210
+ end
211
+
212
+ private
213
+
214
+ def valid_input_array?(value)
215
+ return false unless value.is_a?(Enumerable)
216
+ value.all? { |val| (val.nil? && nullable?) || type_klass.valid_input?(val) }
217
+ end
218
+ end
219
+ end
220
+ end