graphql-idl-parser 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -1
- data/Rakefile +6 -4
- data/ext/graphql-idl-parser/graphql-idl-parser/Cargo.lock +295 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/Cargo.toml +16 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/LICENSE.txt +21 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/README.md +53 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/build.rs +5 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/Cargo.lock +305 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/Cargo.toml +18 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/README.md +48 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/example/example.c +33 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/includes/gql-idl-parser.h +138 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/src/lib.rs +128 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/src/types.rs +485 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-1d630313aa5d216c/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-1d630313aa5d216c/build_script_build-1d630313aa5d216c +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-3e27951e7158def5/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-3e27951e7158def5/build_script_build-3e27951e7158def5 +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-481c4176d6a6472d/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-481c4176d6a6472d/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-5e9a4656cd081ee1/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/graphql-idl-parser-5e9a4656cd081ee1/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-2b7eb293aa6c1ae8/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-2b7eb293aa6c1ae8/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-da175f6bc66f228c/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/kernel32-sys-da175f6bc66f228c/build_script_build-da175f6bc66f228c +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-d0f0dc8a044bb86f/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-d0f0dc8a044bb86f/build_script_build-d0f0dc8a044bb86f +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-db9b482018d6c515/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/build/lalrpop-db9b482018d6c515/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libaho_corasick-07ac37ff1c5ebb39.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libascii_canvas-37ba58d788f6e28b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libatty-3d34ead0eff1f49c.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libbit_set-05034a00bed6372c.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libbit_vec-ba66b7b721a96204.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libbuild-d4f96a70b883038d.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libdiff-9cac472257fa481b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libdocopt-5b3087b1b6e5d091.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libeither-8157fecd348c1485.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libena-b40ce2cd268672c3.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libfixedbitset-c7f65ed08cebcf3b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libgraphql_idl_parser-38237266b2814db0.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libgraphql_idl_parser-85dc5bc4abe95968.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libgraphqlidlparser.dylib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libitertools-8d570d6c59d3b2d0.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libkernel32-fa4855bd85e0519b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop-8888f5942735b084.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop_intern-70b4cf4d149e3995.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop_snap-695e4827988eac78.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblalrpop_util-90bdd1a9fd691a70.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblazy_static-a6b1325db7ee41a1.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/liblibc-0d055c7503ac4180.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libmemchr-7e8d0bb06e3caae0.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libordermap-f92645c599568d9f.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libpetgraph-62c5b51f9db3f0c7.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libregex-5d259a9431f27ed9.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libregex_syntax-e6a16469e776d773.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/librustc_serialize-21d20a12dd90991b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libstrsim-8e26967d29bdf2e6.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libterm-189de8985c74cf03.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libthread_local-036458f1fbee14fb.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libunicode_xid-8adffabb9e6dd184.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libunreachable-bd47b36c4e87f432.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libutf8_ranges-220e9d44a3644657.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libvoid-d761da60d30362e9.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/deps/libwinapi-753252e15931e6fc.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/libgraphqlidlparser.d +1 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/target/release/libgraphqlidlparser.dylib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar.c +673 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar.h +161 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/fixtures.h +54 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/fs.h +341 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/print.h +74 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar/sandbox.h +154 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/clar_test.h +19 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/enums.c +40 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/generate.py +243 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/helpers.c +60 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/helpers.h +6 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/input_objects.c +48 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/interfaces.c +41 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/main.c +35 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/objects.c +130 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/scalars.c +39 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/graphql-idl-parser-ffi/test/unions.c +38 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/script/compile +11 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/script/fmt +23 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/script/test +30 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/src/gqlidl.lalrpop +199 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/src/gqlidl.rs +29491 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/src/lib.rs +9 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/src/macros.rs +61 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/src/tests.rs +561 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/src/type_definition.rs +404 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0ed64d9cad312f79/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0ed64d9cad312f79/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build_script_build-0fa24f7f5e35d20a +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build_script_build-0fa24f7f5e35d20a.dSYM/Contents/Info.plist +20 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-0fa24f7f5e35d20a/build_script_build-0fa24f7f5e35d20a.dSYM/Contents/Resources/DWARF/build_script_build-0fa24f7f5e35d20a +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build_script_build-57f7e3c3ef8471d2 +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build_script_build-57f7e3c3ef8471d2.dSYM/Contents/Info.plist +20 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-57f7e3c3ef8471d2/build_script_build-57f7e3c3ef8471d2.dSYM/Contents/Resources/DWARF/build_script_build-57f7e3c3ef8471d2 +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-5e9a4656cd081ee1/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/graphql-idl-parser-5e9a4656cd081ee1/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-2b7eb293aa6c1ae8/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-2b7eb293aa6c1ae8/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build_script_build-d2306aba19864163 +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build_script_build-d2306aba19864163.dSYM/Contents/Info.plist +20 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/kernel32-sys-d2306aba19864163/build_script_build-d2306aba19864163.dSYM/Contents/Resources/DWARF/build_script_build-d2306aba19864163 +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build-script-build +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build_script_build-4a05302baa5fb2a2 +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build_script_build-4a05302baa5fb2a2.dSYM/Contents/Info.plist +20 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-4a05302baa5fb2a2/build_script_build-4a05302baa5fb2a2.dSYM/Contents/Resources/DWARF/build_script_build-4a05302baa5fb2a2 +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-db9b482018d6c515/output +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/build/lalrpop-db9b482018d6c515/stderr +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libaho_corasick-a9ec1f95080d1f6a.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libascii_canvas-92c3bf0cf98f6d67.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libatty-35b65e46cfc403bc.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libbit_set-d9484919f1726cf1.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libbit_vec-8716b059e7c4619b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libbuild-0b12b372edd4cd19.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libdiff-c81afd03f1d10610.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libdocopt-f02dfd6fea4878cc.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libeither-20b79fd67623dec7.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libena-e8706d9d37da725b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libfixedbitset-da616d0027237c90.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libgraphql_idl_parser-33a4c3bdcdc654b7.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libgraphql_idl_parser-d6636cf90a34aa47.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libitertools-34d50068529acf4d.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libkernel32-56b5a11a7716f7c7.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop-65f3c84608c05ce1.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop_intern-a3c97188386c0872.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop_snap-d6e467def27f0a55.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblalrpop_util-e59e6b2e2aec1b3e.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblazy_static-4518bdaa60b81936.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/liblibc-ab7be4fcfaa3a31b.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libmemchr-85dd561868acc188.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libordermap-4691b832eea88398.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libpetgraph-0220c5a13678d70e.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libregex-44e22d9874a5fb64.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libregex_syntax-490c2654111b5bf0.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/librustc_serialize-a7771718d4ee73a5.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libstrsim-038156debd12bd7a.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libterm-d12b955648e4f4b4.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libthread_local-84091b6b04cf1914.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libunicode_xid-89ce822c6e6dbe69.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libunreachable-654322b1fcb434b1.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libutf8_ranges-53f91d3b6e8885c9.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libvoid-181e881e54467554.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/deps/libwinapi-9c9d2aba65add76c.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/target/debug/libgraphql_idl_parser.rlib +0 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/test/enums.graphql +8 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/test/github.graphql +5115 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/test/input_objects.graphql +11 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/test/interfaces.graphql +5 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/test/objects.graphql +54 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/test/scalars.graphql +4 -0
- data/ext/graphql-idl-parser/graphql-idl-parser/test/unions.graphql +2 -0
- data/graphql-idl-parser.gemspec +8 -6
- data/lib/graphql-idl-parser/version.rb +1 -1
- data/test/graphql-idl-parser/enums_test.rb +20 -0
- data/test/graphql-idl-parser/graphql-idl-parser_test.rb +48 -0
- data/test/graphql-idl-parser/input_objects_test.rb +28 -0
- data/test/graphql-idl-parser/interfaces_test.rb +20 -0
- data/test/graphql-idl-parser/objects_test.rb +104 -0
- data/test/graphql-idl-parser/scalars_test.rb +19 -0
- data/test/graphql-idl-parser/unions_test.rb +18 -0
- data/test/test_helper.rb +12 -0
- metadata +194 -12
- data/.gitignore +0 -18
- data/.gitmodules +0 -4
- data/.rubocop.yml +0 -10
- data/.travis.yml +0 -28
- data/Gemfile +0 -4
- data/script/bootstrap +0 -11
- data/script/cibuild +0 -5
- data/script/update_submodules +0 -21
@@ -0,0 +1,61 @@
|
|
1
|
+
macro_rules! impl_graphql_meta_methods {
|
2
|
+
($($type_: ty),*) => {
|
3
|
+
$(
|
4
|
+
impl $type_ {
|
5
|
+
pub fn description(&self) -> Option<&str> { self.description.as_ref().map(|s| s.as_ref()) }
|
6
|
+
|
7
|
+
pub fn name(&self) -> &str { self.name.as_ref() }
|
8
|
+
}
|
9
|
+
)*
|
10
|
+
};
|
11
|
+
}
|
12
|
+
|
13
|
+
macro_rules! impl_graphql_directive_methods {
|
14
|
+
($($type_: ty),*) => {
|
15
|
+
$(
|
16
|
+
impl $type_ {
|
17
|
+
pub fn directives(&self) -> Option<Vec<GraphQLDirective>> {
|
18
|
+
self.directives.clone()
|
19
|
+
}
|
20
|
+
}
|
21
|
+
)*
|
22
|
+
};
|
23
|
+
}
|
24
|
+
|
25
|
+
macro_rules! impl_graphql_type_methods {
|
26
|
+
($($type_: ty),*) => {
|
27
|
+
$(
|
28
|
+
impl $type_ {
|
29
|
+
pub fn typeinfo(&self) -> FieldType {
|
30
|
+
self.typeinfo.to_owned()
|
31
|
+
}
|
32
|
+
}
|
33
|
+
)*
|
34
|
+
};
|
35
|
+
}
|
36
|
+
|
37
|
+
macro_rules! impl_graphql_objects_common_methods {
|
38
|
+
(
|
39
|
+
$(
|
40
|
+
$x:ident:$y:ident
|
41
|
+
),*
|
42
|
+
) => {
|
43
|
+
pub fn description(&self) -> Option<&str> {
|
44
|
+
match *self {
|
45
|
+
$(
|
46
|
+
TypeDefinition::$x($y{ ref description, .. }) => {
|
47
|
+
description.as_ref().map(|s| s.as_ref())
|
48
|
+
}
|
49
|
+
),*
|
50
|
+
}
|
51
|
+
}
|
52
|
+
|
53
|
+
pub fn name(&self) -> &str {
|
54
|
+
match *self {
|
55
|
+
$(
|
56
|
+
TypeDefinition::$x($y{ ref name, .. }) => &name
|
57
|
+
),*
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}
|
61
|
+
}
|
@@ -0,0 +1,561 @@
|
|
1
|
+
use std::fs::File;
|
2
|
+
use std::io::Read;
|
3
|
+
|
4
|
+
use gqlidl;
|
5
|
+
|
6
|
+
#[test]
|
7
|
+
#[allow(unused)]
|
8
|
+
fn sanity_check() {
|
9
|
+
let mut array = [
|
10
|
+
"scalars",
|
11
|
+
"objects",
|
12
|
+
"enums",
|
13
|
+
"interfaces",
|
14
|
+
"unions",
|
15
|
+
"input_objects",
|
16
|
+
];
|
17
|
+
let mut contents = String::new();
|
18
|
+
for (_, f) in array.iter_mut().enumerate() {
|
19
|
+
let mut file = File::open(format!("test/{}.graphql", f)).expect("Unable to open file");
|
20
|
+
file.read_to_string(&mut contents);
|
21
|
+
}
|
22
|
+
let definitions = gqlidl::parse_schema(contents.as_str()).unwrap();
|
23
|
+
}
|
24
|
+
|
25
|
+
#[test]
|
26
|
+
#[allow(unused)]
|
27
|
+
fn github_sanity_check() {
|
28
|
+
let mut file = File::open("test/github.graphql").expect("Unable to open file");
|
29
|
+
let mut contents = String::new();
|
30
|
+
file.read_to_string(&mut contents);
|
31
|
+
|
32
|
+
let definitions = gqlidl::parse_schema(contents.as_str()).unwrap();
|
33
|
+
}
|
34
|
+
|
35
|
+
#[test]
|
36
|
+
fn scalar_no_description() {
|
37
|
+
let def = gqlidl::parse_schema("scalar DateTime")
|
38
|
+
.unwrap()
|
39
|
+
.pop()
|
40
|
+
.unwrap();
|
41
|
+
|
42
|
+
assert_eq!(None, def.description());
|
43
|
+
assert_eq!("scalar", def.typename());
|
44
|
+
assert_eq!("DateTime", def.name());
|
45
|
+
}
|
46
|
+
|
47
|
+
#[test]
|
48
|
+
fn scalar_with_description() {
|
49
|
+
let def = gqlidl::parse_schema("# An ISO-8601 encoded UTC date string.\nscalar DateTime")
|
50
|
+
.unwrap()
|
51
|
+
.pop()
|
52
|
+
.unwrap();
|
53
|
+
|
54
|
+
assert_eq!(
|
55
|
+
"An ISO-8601 encoded UTC date string.",
|
56
|
+
def.description().unwrap()
|
57
|
+
);
|
58
|
+
assert_eq!("scalar", def.typename());
|
59
|
+
assert_eq!("DateTime", def.name());
|
60
|
+
}
|
61
|
+
|
62
|
+
#[test]
|
63
|
+
fn scalar_with_tricky_description() {
|
64
|
+
let def = gqlidl::parse_schema(
|
65
|
+
"# An ISO-8601 encoded UTC, scalar, date string.\nscalar DateTime",
|
66
|
+
).unwrap()
|
67
|
+
.pop()
|
68
|
+
.unwrap();
|
69
|
+
|
70
|
+
assert_eq!(
|
71
|
+
"An ISO-8601 encoded UTC, scalar, date string.",
|
72
|
+
def.description().unwrap()
|
73
|
+
);
|
74
|
+
assert_eq!("scalar", def.typename());
|
75
|
+
assert_eq!("DateTime", def.name());
|
76
|
+
}
|
77
|
+
|
78
|
+
#[test]
|
79
|
+
fn type_no_description() {
|
80
|
+
let def = gqlidl::parse_schema("type CodeOfConduct {}")
|
81
|
+
.unwrap()
|
82
|
+
.pop()
|
83
|
+
.unwrap();
|
84
|
+
|
85
|
+
assert_eq!(None, def.description());
|
86
|
+
assert_eq!("object", def.typename());
|
87
|
+
assert_eq!("CodeOfConduct", def.name());
|
88
|
+
}
|
89
|
+
|
90
|
+
#[test]
|
91
|
+
fn type_with_description() {
|
92
|
+
let def = gqlidl::parse_schema(
|
93
|
+
"# The Code of Conduct for a repository\ntype CodeOfConduct {}",
|
94
|
+
).unwrap()
|
95
|
+
.pop()
|
96
|
+
.unwrap();
|
97
|
+
|
98
|
+
assert_eq!(
|
99
|
+
"The Code of Conduct for a repository",
|
100
|
+
def.description().unwrap()
|
101
|
+
);
|
102
|
+
assert_eq!("object", def.typename());
|
103
|
+
assert_eq!("CodeOfConduct", def.name());
|
104
|
+
assert_eq!(None, def.implements());
|
105
|
+
}
|
106
|
+
|
107
|
+
#[test]
|
108
|
+
fn type_with_one_implements() {
|
109
|
+
let def = gqlidl::parse_schema("type PushAllowance implements Node {}")
|
110
|
+
.unwrap()
|
111
|
+
.pop()
|
112
|
+
.unwrap();
|
113
|
+
|
114
|
+
assert_eq!(None, def.description());
|
115
|
+
assert_eq!("object", def.typename());
|
116
|
+
assert_eq!("PushAllowance", def.name());
|
117
|
+
|
118
|
+
let implement = def.implements().unwrap().pop().unwrap();
|
119
|
+
|
120
|
+
assert_eq!("Node", implement);
|
121
|
+
}
|
122
|
+
|
123
|
+
#[test]
|
124
|
+
fn type_with_multiple_implements() {
|
125
|
+
let def = gqlidl::parse_schema("type Release implements Node, UniformResourceLocatable {}")
|
126
|
+
.unwrap()
|
127
|
+
.pop()
|
128
|
+
.unwrap();
|
129
|
+
|
130
|
+
assert_eq!(None, def.description());
|
131
|
+
assert_eq!("object", def.typename());
|
132
|
+
assert_eq!("Release", def.name());
|
133
|
+
|
134
|
+
let mut implement = def.implements().unwrap().remove(0);
|
135
|
+
|
136
|
+
assert_eq!("Node", implement);
|
137
|
+
implement = def.implements().unwrap().remove(1);
|
138
|
+
assert_eq!("UniformResourceLocatable", implement);
|
139
|
+
}
|
140
|
+
|
141
|
+
#[test]
|
142
|
+
fn type_with_field() {
|
143
|
+
let def = gqlidl::parse_schema(
|
144
|
+
"# The Code of Conduct for a repository\ntype CodeOfConduct { body: String }",
|
145
|
+
).unwrap()
|
146
|
+
.pop()
|
147
|
+
.unwrap();
|
148
|
+
|
149
|
+
assert_eq!(
|
150
|
+
"The Code of Conduct for a repository",
|
151
|
+
def.description().unwrap()
|
152
|
+
);
|
153
|
+
assert_eq!("object", def.typename());
|
154
|
+
assert_eq!("CodeOfConduct", def.name());
|
155
|
+
|
156
|
+
let field = def.fields().unwrap().pop().unwrap();
|
157
|
+
|
158
|
+
assert_eq!(None, field.description());
|
159
|
+
assert_eq!("body", field.name());
|
160
|
+
assert_eq!("String", field.typeinfo().name());
|
161
|
+
assert_eq!("", field.typeinfo().info());
|
162
|
+
assert_eq!(None, field.arguments());
|
163
|
+
}
|
164
|
+
|
165
|
+
#[test]
|
166
|
+
fn type_with_field_and_description() {
|
167
|
+
let def = gqlidl::parse_schema(
|
168
|
+
"# The Code of Conduct for a repository\ntype CodeOfConduct { \n# The body of the CoC\n body: String }",
|
169
|
+
).unwrap()
|
170
|
+
.pop()
|
171
|
+
.unwrap();
|
172
|
+
|
173
|
+
assert_eq!(
|
174
|
+
"The Code of Conduct for a repository",
|
175
|
+
def.description().unwrap()
|
176
|
+
);
|
177
|
+
assert_eq!("object", def.typename());
|
178
|
+
assert_eq!("CodeOfConduct", def.name());
|
179
|
+
|
180
|
+
let field = def.fields().unwrap().pop().unwrap();
|
181
|
+
|
182
|
+
assert_eq!("The body of the CoC", field.description().unwrap());
|
183
|
+
assert_eq!("body", field.name());
|
184
|
+
assert_eq!("String", field.typeinfo().name());
|
185
|
+
assert_eq!("", field.typeinfo().info());
|
186
|
+
}
|
187
|
+
|
188
|
+
#[test]
|
189
|
+
fn type_with_required_field() {
|
190
|
+
let def = gqlidl::parse_schema(
|
191
|
+
"# The Code of Conduct for a repository\ntype CodeOfConduct { key: String! }",
|
192
|
+
).unwrap()
|
193
|
+
.pop()
|
194
|
+
.unwrap();
|
195
|
+
|
196
|
+
assert_eq!(
|
197
|
+
"The Code of Conduct for a repository",
|
198
|
+
def.description().unwrap()
|
199
|
+
);
|
200
|
+
assert_eq!("object", def.typename());
|
201
|
+
assert_eq!("CodeOfConduct", def.name());
|
202
|
+
|
203
|
+
let field = def.fields().unwrap().pop().unwrap();
|
204
|
+
|
205
|
+
assert_eq!(None, field.description());
|
206
|
+
assert_eq!("key", field.name());
|
207
|
+
assert_eq!("String", field.typeinfo().name());
|
208
|
+
assert_eq!("!", field.typeinfo().info());
|
209
|
+
}
|
210
|
+
|
211
|
+
#[test]
|
212
|
+
fn type_with_nullable_field_list() {
|
213
|
+
let def = gqlidl::parse_schema(
|
214
|
+
"type CommitCommentConnection { edges: [CommitCommentEdge] }",
|
215
|
+
).unwrap()
|
216
|
+
.pop()
|
217
|
+
.unwrap();
|
218
|
+
|
219
|
+
assert_eq!(None, def.description());
|
220
|
+
assert_eq!("object", def.typename());
|
221
|
+
assert_eq!("CommitCommentConnection", def.name());
|
222
|
+
|
223
|
+
let field = def.fields().unwrap().pop().unwrap();
|
224
|
+
|
225
|
+
assert_eq!(None, field.description());
|
226
|
+
assert_eq!("edges", field.name());
|
227
|
+
assert_eq!("CommitCommentEdge", field.typeinfo().name());
|
228
|
+
assert_eq!("[]", field.typeinfo().info());
|
229
|
+
}
|
230
|
+
|
231
|
+
#[test]
|
232
|
+
fn type_with_non_nullable_field_non_nullable_list() {
|
233
|
+
let def = gqlidl::parse_schema(
|
234
|
+
"type CommitComment { viewerCannotUpdateReasons: [CommentCannotUpdateReason!]! }",
|
235
|
+
).unwrap()
|
236
|
+
.pop()
|
237
|
+
.unwrap();
|
238
|
+
|
239
|
+
assert_eq!(None, def.description());
|
240
|
+
assert_eq!("object", def.typename());
|
241
|
+
assert_eq!("CommitComment", def.name());
|
242
|
+
|
243
|
+
let field = def.fields().unwrap().pop().unwrap();
|
244
|
+
|
245
|
+
assert_eq!(None, field.description());
|
246
|
+
assert_eq!("viewerCannotUpdateReasons", field.name());
|
247
|
+
assert_eq!("CommentCannotUpdateReason", field.typeinfo().name());
|
248
|
+
assert_eq!("[!]!", field.typeinfo().info());
|
249
|
+
}
|
250
|
+
|
251
|
+
#[test]
|
252
|
+
fn type_with_nullable_field_non_nullable_list() {
|
253
|
+
let def = gqlidl::parse_schema(
|
254
|
+
"type PullRequest { suggestedReviewers: [SuggestedReviewer]! }",
|
255
|
+
).unwrap()
|
256
|
+
.pop()
|
257
|
+
.unwrap();
|
258
|
+
|
259
|
+
assert_eq!(None, def.description());
|
260
|
+
assert_eq!("object", def.typename());
|
261
|
+
assert_eq!("PullRequest", def.name());
|
262
|
+
|
263
|
+
let field = def.fields().unwrap().pop().unwrap();
|
264
|
+
|
265
|
+
assert_eq!(None, field.description());
|
266
|
+
assert_eq!("suggestedReviewers", field.name());
|
267
|
+
assert_eq!("SuggestedReviewer", field.typeinfo().name());
|
268
|
+
assert_eq!("[]!", field.typeinfo().info());
|
269
|
+
}
|
270
|
+
|
271
|
+
#[test]
|
272
|
+
fn type_with_non_nullable_connection() {
|
273
|
+
let def = gqlidl::parse_schema(
|
274
|
+
"type User {
|
275
|
+
# A list of users the given user is followed by.
|
276
|
+
followers(
|
277
|
+
# Returns the elements in the list that come after the specified global ID.
|
278
|
+
after: String
|
279
|
+
|
280
|
+
# Returns the first _n_ elements from the list.
|
281
|
+
first: Int!
|
282
|
+
): FollowerConnection!
|
283
|
+
}
|
284
|
+
",
|
285
|
+
).unwrap()
|
286
|
+
.pop()
|
287
|
+
.unwrap();
|
288
|
+
|
289
|
+
assert_eq!(None, def.description());
|
290
|
+
assert_eq!("object", def.typename());
|
291
|
+
assert_eq!("User", def.name());
|
292
|
+
|
293
|
+
let connection = def.fields().unwrap().pop().unwrap();
|
294
|
+
|
295
|
+
assert_eq!(
|
296
|
+
"A list of users the given user is followed by.",
|
297
|
+
connection.description().unwrap()
|
298
|
+
);
|
299
|
+
assert_eq!("followers", connection.name());
|
300
|
+
assert_eq!("FollowerConnection", connection.typeinfo().name());
|
301
|
+
assert_eq!("!", connection.typeinfo().info());
|
302
|
+
|
303
|
+
let mut argument = connection.arguments().unwrap().remove(0);
|
304
|
+
|
305
|
+
assert_eq!(
|
306
|
+
"Returns the elements in the list that come after the specified global ID.",
|
307
|
+
argument.description().unwrap()
|
308
|
+
);
|
309
|
+
assert_eq!("String", argument.typeinfo().name());
|
310
|
+
assert_eq!("", argument.typeinfo().info());
|
311
|
+
|
312
|
+
argument = connection.arguments().unwrap().remove(1);
|
313
|
+
|
314
|
+
assert_eq!(
|
315
|
+
"Returns the first _n_ elements from the list.",
|
316
|
+
argument.description().unwrap()
|
317
|
+
);
|
318
|
+
assert_eq!("Int", argument.typeinfo().name());
|
319
|
+
assert_eq!("!", argument.typeinfo().info());
|
320
|
+
}
|
321
|
+
|
322
|
+
#[test]
|
323
|
+
fn type_with_deprecated_field() {
|
324
|
+
let def = gqlidl::parse_schema(
|
325
|
+
"type User {
|
326
|
+
databaseId: Int @deprecated
|
327
|
+
}
|
328
|
+
",
|
329
|
+
).unwrap()
|
330
|
+
.pop()
|
331
|
+
.unwrap();
|
332
|
+
|
333
|
+
assert_eq!(None, def.description());
|
334
|
+
assert_eq!("object", def.typename());
|
335
|
+
assert_eq!("User", def.name());
|
336
|
+
|
337
|
+
let field = def.fields().unwrap().pop().unwrap();
|
338
|
+
|
339
|
+
assert_eq!("databaseId", field.name());
|
340
|
+
assert_eq!("Int", field.typeinfo().name());
|
341
|
+
assert_eq!("", field.typeinfo().info());
|
342
|
+
let directive = field.directives().unwrap().pop().unwrap();
|
343
|
+
assert_eq!("deprecated", directive.name());
|
344
|
+
assert_eq!(None, directive.arguments());
|
345
|
+
}
|
346
|
+
|
347
|
+
#[test]
|
348
|
+
fn type_with_deprecated_field_and_reason() {
|
349
|
+
let def = gqlidl::parse_schema(
|
350
|
+
"type User {
|
351
|
+
databaseId: Int @deprecated(reason: \"Exposed database IDs will eventually be removed in favor of global Relay IDs.\")
|
352
|
+
}
|
353
|
+
",
|
354
|
+
).unwrap()
|
355
|
+
.pop()
|
356
|
+
.unwrap();
|
357
|
+
|
358
|
+
assert_eq!(None, def.description());
|
359
|
+
assert_eq!("object", def.typename());
|
360
|
+
assert_eq!("User", def.name());
|
361
|
+
|
362
|
+
let field = def.fields().unwrap().pop().unwrap();
|
363
|
+
|
364
|
+
assert_eq!("databaseId", field.name());
|
365
|
+
assert_eq!("Int", field.typeinfo().name());
|
366
|
+
assert_eq!("", field.typeinfo().info());
|
367
|
+
let directive = field.directives().unwrap().pop().unwrap();
|
368
|
+
assert_eq!("deprecated", directive.name());
|
369
|
+
let arg = directive.arguments().unwrap().pop().unwrap();
|
370
|
+
assert_eq!("reason", arg.name());
|
371
|
+
assert_eq!(
|
372
|
+
"Exposed database IDs will eventually be removed in favor of global Relay IDs.",
|
373
|
+
arg.value().unwrap()
|
374
|
+
);
|
375
|
+
}
|
376
|
+
|
377
|
+
#[test]
|
378
|
+
fn type_with_multiline_field_description() {
|
379
|
+
let def = gqlidl::parse_schema(
|
380
|
+
"
|
381
|
+
# Represents a range of information from a Git blame.
|
382
|
+
type BlameRange {
|
383
|
+
# Identifies the recency of the change, from 1 (new) to 10 (old). This is
|
384
|
+
# calculated as a 2-quantile and determines the length of distance between the
|
385
|
+
# median age of all the changes in the file and the recency of the current
|
386
|
+
# range's change.
|
387
|
+
age: Int!
|
388
|
+
}
|
389
|
+
",
|
390
|
+
).unwrap()
|
391
|
+
.pop()
|
392
|
+
.unwrap();
|
393
|
+
|
394
|
+
let field = def.fields().unwrap().remove(0);
|
395
|
+
|
396
|
+
assert_eq!(
|
397
|
+
"Identifies the recency of the change, from 1 (new) to 10 (old). This is calculated as a 2-quantile and determines the length of distance between the median age of all the changes in the file and the recency of the current range's change.",
|
398
|
+
field.description().unwrap()
|
399
|
+
);
|
400
|
+
assert_eq!("age", field.name());
|
401
|
+
assert_eq!("Int", field.typeinfo().name());
|
402
|
+
assert_eq!("!", field.typeinfo().info());
|
403
|
+
}
|
404
|
+
|
405
|
+
#[test]
|
406
|
+
fn enum_with_fields() {
|
407
|
+
let def = gqlidl::parse_schema(
|
408
|
+
"
|
409
|
+
# State of the project; either 'open' or 'closed'
|
410
|
+
enum ProjectState {
|
411
|
+
# The project is closed.
|
412
|
+
CLOSED
|
413
|
+
|
414
|
+
# The project is open.
|
415
|
+
OPEN
|
416
|
+
}
|
417
|
+
",
|
418
|
+
).unwrap()
|
419
|
+
.pop()
|
420
|
+
.unwrap();
|
421
|
+
|
422
|
+
assert_eq!(
|
423
|
+
"State of the project; either 'open' or 'closed'",
|
424
|
+
def.description().unwrap()
|
425
|
+
);
|
426
|
+
assert_eq!("enum", def.typename());
|
427
|
+
assert_eq!("ProjectState", def.name());
|
428
|
+
|
429
|
+
let mut value = def.values().unwrap().remove(0);
|
430
|
+
|
431
|
+
assert_eq!("The project is closed.", value.description().unwrap());
|
432
|
+
assert_eq!("CLOSED", value.name());
|
433
|
+
|
434
|
+
value = def.values().unwrap().remove(1);
|
435
|
+
|
436
|
+
assert_eq!("The project is open.", value.description().unwrap());
|
437
|
+
assert_eq!("OPEN", value.name());
|
438
|
+
}
|
439
|
+
|
440
|
+
#[test]
|
441
|
+
fn interface_with_field() {
|
442
|
+
let def = gqlidl::parse_schema(
|
443
|
+
"
|
444
|
+
# An object that can be closed
|
445
|
+
interface Closable {
|
446
|
+
# `true` if the object is closed (definition of closed may depend on type)
|
447
|
+
closed: Boolean!
|
448
|
+
}
|
449
|
+
",
|
450
|
+
).unwrap()
|
451
|
+
.pop()
|
452
|
+
.unwrap();
|
453
|
+
|
454
|
+
assert_eq!("An object that can be closed", def.description().unwrap());
|
455
|
+
assert_eq!("interface", def.typename());
|
456
|
+
assert_eq!("Closable", def.name());
|
457
|
+
|
458
|
+
let field = def.fields().unwrap().pop().unwrap();
|
459
|
+
|
460
|
+
assert_eq!(
|
461
|
+
"`true` if the object is closed (definition of closed may depend on type)",
|
462
|
+
field.description().unwrap()
|
463
|
+
);
|
464
|
+
assert_eq!("closed", field.name());
|
465
|
+
assert_eq!("Boolean", field.typeinfo().name());
|
466
|
+
assert_eq!("!", field.typeinfo().info());
|
467
|
+
}
|
468
|
+
|
469
|
+
#[test]
|
470
|
+
fn union_with_descriptions() {
|
471
|
+
let def = gqlidl::parse_schema(
|
472
|
+
"
|
473
|
+
# Any referencable object
|
474
|
+
union ReferencedSubject = Issue | PullRequest
|
475
|
+
",
|
476
|
+
).unwrap()
|
477
|
+
.pop()
|
478
|
+
.unwrap();
|
479
|
+
|
480
|
+
assert_eq!("Any referencable object", def.description().unwrap());
|
481
|
+
assert_eq!("union", def.typename());
|
482
|
+
assert_eq!("ReferencedSubject", def.name());
|
483
|
+
|
484
|
+
let mut _type = def.types().unwrap().remove(0);
|
485
|
+
|
486
|
+
assert_eq!("Issue", _type);
|
487
|
+
|
488
|
+
_type = def.types().unwrap().remove(1);
|
489
|
+
|
490
|
+
assert_eq!("PullRequest", _type);
|
491
|
+
}
|
492
|
+
|
493
|
+
#[test]
|
494
|
+
fn input_object_with_descriptions() {
|
495
|
+
let def = gqlidl::parse_schema(
|
496
|
+
"
|
497
|
+
# Autogenerated input type of UpdateTopics
|
498
|
+
input UpdateTopicsInput {
|
499
|
+
# A unique identifier for the client performing the mutation.
|
500
|
+
clientMutationId: String
|
501
|
+
|
502
|
+
# An array of topic names.
|
503
|
+
topicNames: [String!]!
|
504
|
+
}
|
505
|
+
",
|
506
|
+
).unwrap()
|
507
|
+
.pop()
|
508
|
+
.unwrap();
|
509
|
+
|
510
|
+
assert_eq!(
|
511
|
+
"Autogenerated input type of UpdateTopics",
|
512
|
+
def.description().unwrap()
|
513
|
+
);
|
514
|
+
assert_eq!("input_object", def.typename());
|
515
|
+
assert_eq!("UpdateTopicsInput", def.name());
|
516
|
+
|
517
|
+
let mut field = def.fields().unwrap().remove(0);
|
518
|
+
|
519
|
+
assert_eq!(
|
520
|
+
"A unique identifier for the client performing the mutation.",
|
521
|
+
field.description().unwrap()
|
522
|
+
);
|
523
|
+
assert_eq!("clientMutationId", field.name());
|
524
|
+
assert_eq!("String", field.typeinfo().name());
|
525
|
+
assert_eq!("", field.typeinfo().info());
|
526
|
+
|
527
|
+
field = def.fields().unwrap().remove(1);
|
528
|
+
|
529
|
+
assert_eq!("An array of topic names.", field.description().unwrap());
|
530
|
+
assert_eq!("topicNames", field.name());
|
531
|
+
assert_eq!("String", field.typeinfo().name());
|
532
|
+
assert_eq!("[!]!", field.typeinfo().info());
|
533
|
+
}
|
534
|
+
|
535
|
+
#[test]
|
536
|
+
fn input_object_with_special_field_name() {
|
537
|
+
let def = gqlidl::parse_schema(
|
538
|
+
"
|
539
|
+
input RequestReviewsInput {
|
540
|
+
# Add users to the set rather than replace.
|
541
|
+
union: Boolean
|
542
|
+
}
|
543
|
+
",
|
544
|
+
).unwrap()
|
545
|
+
.pop()
|
546
|
+
.unwrap();
|
547
|
+
|
548
|
+
assert_eq!(None, def.description());
|
549
|
+
assert_eq!("input_object", def.typename());
|
550
|
+
assert_eq!("RequestReviewsInput", def.name());
|
551
|
+
|
552
|
+
let field = def.fields().unwrap().remove(0);
|
553
|
+
|
554
|
+
assert_eq!(
|
555
|
+
"Add users to the set rather than replace.",
|
556
|
+
field.description().unwrap()
|
557
|
+
);
|
558
|
+
assert_eq!("union", field.name());
|
559
|
+
assert_eq!("Boolean", field.typeinfo().name());
|
560
|
+
assert_eq!("", field.typeinfo().info());
|
561
|
+
}
|