diff --git a/.gitattributes b/.gitattributes index 07764a78d9..2072890461 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,2 @@ -* text eol=lf \ No newline at end of file +*.rs text eol=lf +*.md text eol=lf diff --git a/.gitignore b/.gitignore index c41741bc32..09c880ada4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,21 +3,16 @@ /.vscode .DS_Store .bsp -/cloudflare/node_modules -/cloudflare/.wrangler # direnv .direnv .envrc .env npm/@tailcallhq -npm/node_modules - -cloudflare/.wrangler -cloudflare/build -cloudflare/node_modules -cloudflare/pkg +node_modules/ +# cloudflare .wrangler/ +tailcall-/cloudflare/build *.snap.new diff --git a/Cargo.lock b/Cargo.lock index fe1834a557..ad9df39e9e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -297,8 +297,9 @@ dependencies = [ [[package]] name = "async-graphql-extension-apollo-tracing" -version = "3.2.14" -source = "git+https://github.com/tailcallhq/async_graphql_apollo_studio_extension/#b7537c56bef0ae0152d879f98c3676b82506f4cb" +version = "3.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c4d3cc0bb90e426ddedb5a0b30bd9c0a9aaec1351d0e96556d5919a18ff954" dependencies = [ "anyhow", "async-graphql", @@ -320,7 +321,7 @@ dependencies = [ "serde_json", "sha2 0.10.8", "tokio", - "tonic-build", + "tonic-build 0.10.2", "tracing", "uname", "uuid", @@ -438,9 +439,9 @@ dependencies = [ [[package]] name = "async-recursion" -version = "1.1.0" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30c5ef0ede93efbf733c1a727f3b6b5a1060bbedd5600183e66f6e4be4af0ec5" +checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", @@ -628,9 +629,9 @@ checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64" -version = "0.22.0" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9475866fec1451be56a3c2400fd081ff546538961565ccb5b7142cbd22bc7a51" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64-simd" @@ -658,7 +659,7 @@ version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e65938ed058ef47d92cf8b346cc76ef48984572ade631927e9937b5ffc7662c7" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "blowfish 0.9.1", "getrandom", "subtle", @@ -801,6 +802,12 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1bf2a5fb3207c12b5d208ebc145f967fea5cac41a021c37417ccc31ba40f39ee" +[[package]] +name = "camino" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" + [[package]] name = "cast" version = "0.3.0" @@ -1256,6 +1263,18 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7e962a19be5cfc3f3bf6dd8f61eb50107f356ad6270fbb3ed41476571db78be5" +[[package]] +name = "datatest-stable" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a560b3fd20463b56397bd457aa71243ccfdcffe696050b66e3b1e0ec0457e7f1" +dependencies = [ + "camino", + "fancy-regex", + "libtest-mimic", + "walkdir", +] + [[package]] name = "debugid" version = "0.8.0" @@ -1268,9 +1287,9 @@ dependencies = [ [[package]] name = "deno_core" -version = "0.275.0" +version = "0.278.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "010130fa045837285920b52a8a2b2a42a2e6aa05ee547adb796992c2de7097ff" +checksum = "353cd08b2c60ee71e3a3215f111bf273dc04be455bb084873d79723a941c57ec" dependencies = [ "anyhow", "bincode", @@ -1298,9 +1317,9 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.151.0" +version = "0.154.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01605540e65fcab72a454cddf67a23e007d1bf5ac7692dc186c6694cbbcb0e1d" +checksum = "e5402d2a4027026c876ab15b4bc46c60252c4a8704e80739ab62900af2d60e1f" dependencies = [ "proc-macro-rules", "proc-macro2", @@ -1497,6 +1516,15 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "escape8259" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba4f4911e3666fcd7826997b4745c8224295a6f3072f1418c3067b97a67557ee" +dependencies = [ + "rustversion", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -1572,6 +1600,17 @@ dependencies = [ "once_cell", ] +[[package]] +name = "fancy-regex" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "531e46835a22af56d1e3b66f04844bed63158bc094a628bec1d321d9b4c44bf2" +dependencies = [ + "bit-set", + "regex-automata 0.4.6", + "regex-syntax 0.8.3", +] + [[package]] name = "fast_chemail" version = "0.9.6" @@ -2496,9 +2535,9 @@ dependencies = [ [[package]] name = "inquire" -version = "0.7.4" +version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe95f33091b9b7b517a5849bce4dce1b550b430fc20d58059fcaa319ed895d8b" +checksum = "0fddf93031af70e75410a2511ec04d49e758ed2f26dad3404a934e0fb45cc12a" dependencies = [ "bitflags 2.5.0", "crossterm", @@ -2579,15 +2618,6 @@ dependencies = [ "either", ] -[[package]] -name = "itertools" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" -dependencies = [ - "either", -] - [[package]] name = "itoa" version = "1.0.11" @@ -2810,9 +2840,9 @@ dependencies = [ [[package]] name = "libmimalloc-sys" -version = "0.1.35" +version = "0.1.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3979b5c37ece694f1f5e51e7ecc871fdb0f517ed04ee45f88d15d6d553cb9664" +checksum = "81eb4061c0582dedea1cbc7aff2240300dd6982e0239d1c99e65c1dbf4a30ba7" dependencies = [ "cc", "libc", @@ -2828,6 +2858,18 @@ dependencies = [ "libc", ] +[[package]] +name = "libtest-mimic" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fefdf21230d6143476a28adbee3d930e2b68a3d56443c777cae3fe9340eebff9" +dependencies = [ + "clap", + "escape8259", + "termcolor", + "threadpool", +] + [[package]] name = "linked-hash-map" version = "0.5.6" @@ -2974,9 +3016,9 @@ checksum = "3e2e65a1a2e43cfcb47a895c4c8b10d1f4a61097f9f254f183aee60cad9c651d" [[package]] name = "markdown" -version = "1.0.0-alpha.16" +version = "1.0.0-alpha.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0f0025e8c0d89b84d6dc63e859475e40e8e82ab1a08be0a93ad5731513a508" +checksum = "21e27d6220ce21f80ce5c4201f23a37c6f1ad037c72c9d1ff215c2919605a5d6" dependencies = [ "unicode-id", ] @@ -3057,9 +3099,9 @@ dependencies = [ [[package]] name = "mimalloc" -version = "0.1.39" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa01922b5ea280a911e323e4d2fd24b7fe5cc4042e0d2cda3c40775cdc4bdc9c" +checksum = "9f41a2280ded0da56c8cf898babb86e8f10651a34adcfff190ae9a1159c6908d" dependencies = [ "libmimalloc-sys", ] @@ -3109,9 +3151,9 @@ dependencies = [ [[package]] name = "moka" -version = "0.12.6" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87bfd249f570638bfb0b4f9d258e6b8cddd2a5a7d0ed47e8bb8b176bfc0e7a17" +checksum = "9e0d88686dc561d743b40de8269b26eaf0dc58781bde087b0984646602021d08" dependencies = [ "async-lock 3.3.0", "async-trait", @@ -3555,7 +3597,7 @@ version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "serde", ] @@ -3638,7 +3680,7 @@ dependencies = [ "bincode", "either", "fnv", - "itertools 0.12.1", + "itertools 0.11.0", "lazy_static", "nom", "quick-xml", @@ -3871,7 +3913,7 @@ checksum = "80b776a1b2dc779f5ee0641f8ade0125bc1298dd41a9a0c16d8bd57b42d222b1" dependencies = [ "bytes", "heck 0.5.0", - "itertools 0.12.1", + "itertools 0.11.0", "log", "multimap", "once_cell", @@ -3891,7 +3933,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19de2de2a00075bf566bee3bd4db014b11587e84184d3f7a791bc17f1a8e9e48" dependencies = [ "anyhow", - "itertools 0.12.1", + "itertools 0.11.0", "proc-macro2", "quote", "syn 2.0.60", @@ -3903,7 +3945,7 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f5eec97d5d34bdd17ad2db2219aabf46b054c6c41bd5529767c9ce55be5898f" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "logos 0.14.0", "miette", "once_cell", @@ -3979,6 +4021,56 @@ dependencies = [ "thiserror", ] +[[package]] +name = "protoc-bin-vendored" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "005ca8623e5633e298ad1f917d8be0a44bcf406bf3cde3b80e63003e49a3f27d" +dependencies = [ + "protoc-bin-vendored-linux-aarch_64", + "protoc-bin-vendored-linux-ppcle_64", + "protoc-bin-vendored-linux-x86_32", + "protoc-bin-vendored-linux-x86_64", + "protoc-bin-vendored-macos-x86_64", + "protoc-bin-vendored-win32", +] + +[[package]] +name = "protoc-bin-vendored-linux-aarch_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fb9fc9cce84c8694b6ea01cc6296617b288b703719b725b8c9c65f7c5874435" + +[[package]] +name = "protoc-bin-vendored-linux-ppcle_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d2a07dcf7173a04d49974930ccbfb7fd4d74df30ecfc8762cf2f895a094516" + +[[package]] +name = "protoc-bin-vendored-linux-x86_32" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d54fef0b04fcacba64d1d80eed74a20356d96847da8497a59b0a0a436c9165b0" + +[[package]] +name = "protoc-bin-vendored-linux-x86_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8782f2ce7d43a9a5c74ea4936f001e9e8442205c244f7a3d4286bd4c37bc924" + +[[package]] +name = "protoc-bin-vendored-macos-x86_64" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5de656c7ee83f08e0ae5b81792ccfdc1d04e7876b1d9a38e6876a9e09e02537" + +[[package]] +name = "protoc-bin-vendored-win32" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9653c3ed92974e34c5a6e0a510864dab979760481714c172e0a34e437cb98804" + [[package]] name = "protox" version = "0.6.0" @@ -4381,9 +4473,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.4" +version = "0.23.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c4d6d8ad9f2492485e13453acbb291dd08f64441b6609c491f1c2cd2c6b4fe1" +checksum = "afabcee0551bd1aa3e18e5adbf2c0544722014b899adb31bd186ec638d3da97e" dependencies = [ "once_cell", "rustls-pki-types", @@ -4420,15 +4512,15 @@ version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" dependencies = [ - "base64 0.22.0", + "base64 0.22.1", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd36cc4259e3e4514335c4a138c6b43171a8d61d8f5c9348f9fc7529416f247" +checksum = "beb461507cee2c2ff151784c52762cf4d9ff6a61f3e80968600ed24fa837fa54" [[package]] name = "rustls-webpki" @@ -4483,9 +4575,9 @@ dependencies = [ [[package]] name = "schemars" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a28f4c49489add4ce10783f7911893516f15afe45d015608d41faca6bc4d29" +checksum = "7f55c82c700538496bdc329bb4918a81f87cc8888811bd123cf325a0f2f8d309" dependencies = [ "dyn-clone", "schemars_derive", @@ -4495,14 +4587,14 @@ dependencies = [ [[package]] name = "schemars_derive" -version = "0.8.16" +version = "0.8.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c767fd6fa65d9ccf9cf026122c1b555f2ef9a4f0cea69da4d7dbc3e258d30967" +checksum = "83263746fe5e32097f06356968a077f96089739c927a61450efa069905eec108" dependencies = [ "proc-macro2", "quote", "serde_derive_internals", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] @@ -4573,9 +4665,9 @@ checksum = "f638d531eccd6e23b980caf34876660d38e265409d8e99b397ab71eb3612fad0" [[package]] name = "serde" -version = "1.0.198" +version = "1.0.199" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc" +checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a" dependencies = [ "serde_derive", ] @@ -4623,9 +4715,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.198" +version = "1.0.199" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9" +checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" dependencies = [ "proc-macro2", "quote", @@ -4634,13 +4726,13 @@ dependencies = [ [[package]] name = "serde_derive_internals" -version = "0.26.0" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85bf8229e7920a9f636479437026331ce11aa132b4dde37d121944a44d6e5f3c" +checksum = "330f01ce65a3a5fe59a60c82f3c9a024b573b8a6e875bd233fe5f934e71d54e3" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.60", ] [[package]] @@ -4700,9 +4792,9 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.184.0" +version = "0.187.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c27d659c725a9bad587a4da48bc46da09cf9347dc536ec99dae8e228ba29b96f" +checksum = "572631c1ad3d7b304593d7afeb8b28805c00f8e15135db15200f59676d618fe2" dependencies = [ "bytes", "num-bigint", @@ -5079,12 +5171,14 @@ dependencies = [ "async-recursion", "async-std", "async-trait", + "base64 0.22.1", "cache_control", "chrono", "clap", "colored", "convert_case", "criterion", + "datatest-stable", "deno_core", "derive_setters", "dotenvy", @@ -5135,7 +5229,7 @@ dependencies = [ "reqwest", "reqwest-middleware", "resource", - "rustls 0.23.4", + "rustls 0.23.5", "rustls-pemfile 1.0.4", "rustls-pki-types", "schemars", @@ -5147,12 +5241,14 @@ dependencies = [ "serde_yaml", "stripmargin", "strum_macros 0.26.2", + "tailcall-fixtures", "tailcall-macros", "tailcall-prettier", "temp-env", "tempfile", "thiserror", "tokio", + "tokio-test", "tonic", "tonic-types", "tracing", @@ -5218,6 +5314,15 @@ dependencies = [ "worker", ] +[[package]] +name = "tailcall-fixtures" +version = "0.1.0" +dependencies = [ + "anyhow", + "convert_case", + "indenter", +] + [[package]] name = "tailcall-macros" version = "0.1.0" @@ -5237,6 +5342,35 @@ dependencies = [ "tokio", ] +[[package]] +name = "tailcall-upstream-grpc" +version = "0.1.0" +dependencies = [ + "anyhow", + "http-body-util", + "hyper 0.14.28", + "hyper-util", + "once_cell", + "opentelemetry 0.22.0", + "opentelemetry-http", + "opentelemetry-otlp", + "opentelemetry-semantic-conventions", + "opentelemetry_sdk", + "prost", + "prost-types", + "protoc-bin-vendored", + "tailcall-fixtures", + "tokio", + "tonic", + "tonic-build 0.11.0", + "tonic-reflection", + "tonic-tracing-opentelemetry", + "tower", + "tracing", + "tracing-opentelemetry", + "tracing-subscriber", +] + [[package]] name = "tailcall_query_plan" version = "0.1.0" @@ -5250,6 +5384,7 @@ dependencies = [ "indexmap 2.2.6", "insta", "tailcall", + "tailcall-fixtures", "tokio", ] @@ -5300,20 +5435,29 @@ dependencies = [ "winapi", ] +[[package]] +name = "termcolor" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" +dependencies = [ + "winapi-util", +] + [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" dependencies = [ "proc-macro2", "quote", @@ -5330,6 +5474,15 @@ dependencies = [ "once_cell", ] +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + [[package]] name = "time" version = "0.3.36" @@ -5467,6 +5620,19 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-test" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2468baabc3311435b55dd935f702f42cd1b8abb7e754fb7dfb16bd36aa88f9f7" +dependencies = [ + "async-stream", + "bytes", + "futures-core", + "tokio", + "tokio-stream", +] + [[package]] name = "tokio-util" version = "0.7.10" @@ -5542,6 +5708,51 @@ dependencies = [ "syn 2.0.60", ] +[[package]] +name = "tonic-build" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be4ef6dd70a610078cb4e338a0f79d06bc759ff1b22d2120c2ff02ae264ba9c2" +dependencies = [ + "prettyplease", + "proc-macro2", + "prost-build", + "quote", + "syn 2.0.60", +] + +[[package]] +name = "tonic-reflection" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "548c227bd5c0fae5925812c4ec6c66ffcfced23ea370cb823f4d18f0fc1cb6a7" +dependencies = [ + "prost", + "prost-types", + "tokio", + "tokio-stream", + "tonic", +] + +[[package]] +name = "tonic-tracing-opentelemetry" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91f7d16858362cbf0beac4aae1a1421afe89688ac9a5c17439e315c1a477b764" +dependencies = [ + "futures-core", + "futures-util", + "http 0.2.12", + "http-body 0.4.6", + "hyper 0.14.28", + "opentelemetry 0.22.0", + "pin-project-lite", + "tonic", + "tower", + "tracing", + "tracing-opentelemetry", +] + [[package]] name = "tonic-types" version = "0.11.0" @@ -5852,9 +6063,9 @@ dependencies = [ [[package]] name = "v8" -version = "0.90.1" +version = "0.91.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bcf540b968aed8a609e790ec7d25d064a70d62b48677cc9cff085528c56918" +checksum = "03bdee44e85d6235cff99e1ed5b1016c53822c70d1cce3d51f421b27a125a1e8" dependencies = [ "bitflags 2.5.0", "fslock", @@ -6015,9 +6226,9 @@ dependencies = [ [[package]] name = "webbrowser" -version = "0.8.15" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db67ae75a9405634f5882791678772c94ff5f16a66535aae186e26aa0841fc8b" +checksum = "60b6f804e41d0852e16d2eaee61c7e4f7d3e8ffdb7b8ed85886aeb0791fe9fcd" dependencies = [ "core-foundation", "home", @@ -6345,9 +6556,9 @@ checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904" [[package]] name = "worker" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14de2480a9278dd4c34ad21747adc2d76819c3c47a02edd8b5f807ecabd04228" +checksum = "aa130f6f7e5a0b716e0f5472d412fe97962ded204d76ddaf3eeba7360dfcae93" dependencies = [ "async-trait", "bytes", @@ -6376,9 +6587,9 @@ dependencies = [ [[package]] name = "worker-kv" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d4b9fe1a87b7aef252fceb4f30bf6303036a5de329c81ccad9be9c35d1fdbc7" +checksum = "7f06d4d1416a9f8346ee9123b0d9a11b3cfa38e6cfb5a139698017d1597c4d41" dependencies = [ "js-sys", "serde", @@ -6391,9 +6602,9 @@ dependencies = [ [[package]] name = "worker-macros" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8c25dc4a582a7f335da489e04e2cc464f1cb01d1682b6d72871e455fb49dac8" +checksum = "6a0f7f15151a77dca96813d0eff10ab9b29114533fae0267d00c466c13081e69" dependencies = [ "async-trait", "proc-macro2", @@ -6407,9 +6618,9 @@ dependencies = [ [[package]] name = "worker-sys" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70e4a9c5b182745bf87e7893e968c71df8e3f27fc280c38f0a99846b11b3ba50" +checksum = "14ee9baa2ef3c7dea0e2165ff8aaad15e4c4cedb2d30a7deefd4999cd0ae96a3" dependencies = [ "cfg-if", "js-sys", diff --git a/Cargo.toml b/Cargo.toml index 6be84e5d2a..083687db41 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,7 @@ path = "src/main.rs" anyhow = "1.0.82" async-graphql = { version = "7.0.3" } futures-util = { version = "0.3.30" } -indexmap = "2.2" +indexmap = "2.2.6" insta = { version = "1.38.0", features = ["json"] } tokio = { version = "1.37.0", features = ["rt", "time"] } @@ -19,19 +19,19 @@ tokio = { version = "1.37.0", features = ["rt", "time"] } # dependencies specific to CLI must have optional = true and the dep should be added to default feature. # one needs to add default feature tag if it is something IO related or might conflict with WASM -mimalloc = { version = "0.1.39", default-features = false, optional = true } +mimalloc = { version = "0.1.41", default-features = false, optional = true } http-cache-reqwest = { version = "0.13.0", features = [ "manager-moka", ], default-features = false, optional = true } -moka = { version = "0.12.6", default-features = false, features = [ +moka = { version = "0.12.7", default-features = false, features = [ "future", ], optional = true } hyper-rustls = { version = "0.25.0", optional = true } -rustls = { version = "0.23.3", optional = true, features = [ +rustls = { version = "0.23.5", optional = true, features = [ "std", ], default-features = false } -rustls-pki-types = "1.4.1" -inquire = { version = "0.7.4", optional = true } +rustls-pki-types = "1.5.0" +inquire = { version = "0.7.5", optional = true } opentelemetry-otlp = { version = "0.15.0", features = [ "trace", "logs", @@ -44,12 +44,12 @@ opentelemetry-system-metrics = { version = "0.1.8", optional = true } # dependencies safe for wasm: rustls-pemfile = { version = "1.0.4" } -schemars = { version = "0.8.16", features = ["derive"] } -hyper = { version = "0.14", features = ["server"], default-features = false } +schemars = { version = "0.8.17", features = ["derive"] } +hyper = { version = "0.14.28", features = ["server"], default-features = false } tokio = { workspace = true } anyhow = { workspace = true } derive_setters = "0.1.6" -thiserror = "1.0.58" +thiserror = "1.0.59" serde_json = { version = "1.0", features = ["preserve_order"] } serde = { version = "1.0", features = ["derive"] } serde_qs = "0.13" @@ -63,7 +63,7 @@ reqwest = { version = "0.11", features = [ indexmap = { workspace = true } once_cell = "1.19.0" clap = { version = "4.5.4", features = ["derive"] } -colored = "2" +colored = "2.1.0" regex = "1.10.4" reqwest-middleware = "0.2.5" async-trait = "0.1.80" @@ -79,7 +79,7 @@ futures-channel = { version = "0.3.30" } futures-timer = { version = "3.0.3", features = ["wasm-bindgen"] } futures-util = { workspace = true } lru = { version = "0.12.3" } -webbrowser = { version = "0.8.15", features = ["hardened", "disable-wsl"] } +webbrowser = { version = "1.0.0", features = ["hardened", "disable-wsl"] } async-std = { version = "1.12.0", features = [ "wasm-bindgen-futures", "unstable", @@ -95,9 +95,9 @@ update-informer = { version = "1.1.0", default-features = false, features = [ ], optional = true } lazy_static = "1.4.0" which = { version = "6.0.1", optional = true } -async-recursion = "1.1.0" +async-recursion = "1.1.1" tempfile = "3.10.1" -deno_core = { version = "0.275.0", optional = true, features = [ +deno_core = { version = "0.278.0", optional = true, features = [ "v8_use_custom_libcxx", ], default-features = false } strum_macros = "0.26.2" @@ -129,7 +129,7 @@ opentelemetry-appender-tracing = { version = "0.3.0" } opentelemetry-prometheus = "0.15.0" phonenumber = "0.3.4" chrono = "0.4.38" -async-graphql-extension-apollo-tracing = { git = "https://github.com/tailcallhq/async_graphql_apollo_studio_extension/" } +async-graphql-extension-apollo-tracing = { version = "3.2.15" } headers = "0.3.9" # previous version until hyper is updated to 1+ mime = "0.3.17" htpasswd-verify = { version = "0.3.0", git = "https://github.com/twistedfall/htpasswd-verify", rev = "ff14703083cbd639f7d05622b398926f3e718d61" } # fork version that is wasm compatible @@ -141,11 +141,14 @@ async-graphql = { workspace = true, features = [ "apollo_tracing", "opentelemetry", ] } -dotenvy = "0.15" +dotenvy = "0.15.7" convert_case = "0.6.0" rand = "0.8.5" tailcall-macros = { path = "tailcall-macros" } tonic-types = "0.11.0" +datatest-stable = "0.2.9" +tokio-test = "0.4.4" +base64 = "0.22.1" [dev-dependencies] @@ -154,11 +157,12 @@ criterion = "0.5.1" httpmock = "0.7.0" pretty_assertions = "1.4.0" stripmargin = "0.1.1" -markdown = "1.0.0-alpha.16" +markdown = "1.0.0-alpha.17" insta = { workspace = true } tempfile = "3.10.1" temp-env = "0.3.6" maplit = "1.0.2" +tailcall-fixtures = { path = "./tailcall-fixtures" } [features] @@ -201,6 +205,8 @@ members = [ "tailcall-macros", "tailcall-prettier", "tailcall-query-plan", + "tailcall-fixtures", + "tailcall-upstream-grpc" ] # Boost execution_spec snapshot diffing performance @@ -241,3 +247,8 @@ harness = false [[bench]] name = "protobuf_convert_output" harness = false + +[[test]] +name = "execution_spec" +harness = false + diff --git a/README.md b/README.md index eae6486f90..646291f793 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -81,7 +81,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/assets/Tailcall Timeline 2023.png b/assets/Tailcall Timeline 2023.png deleted file mode 100644 index 0532837856..0000000000 Binary files a/assets/Tailcall Timeline 2023.png and /dev/null differ diff --git a/assets/Tailcall Timeline 2023.svg b/assets/Tailcall Timeline 2023.svg deleted file mode 100644 index 38d356e9cc..0000000000 --- a/assets/Tailcall Timeline 2023.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/logging.png b/assets/logging.png deleted file mode 100644 index 77470fe2cd..0000000000 Binary files a/assets/logging.png and /dev/null differ diff --git a/assets/logo_main.png b/assets/logo_main.png deleted file mode 100644 index 7225fe1cf1..0000000000 Binary files a/assets/logo_main.png and /dev/null differ diff --git a/assets/startup_command.png b/assets/startup_command.png deleted file mode 100644 index d0f0f6f81a..0000000000 Binary files a/assets/startup_command.png and /dev/null differ diff --git a/ci-benchmark/benchmark.graphql b/ci-benchmark/benchmark.graphql index 7543878906..aac44a69ad 100644 --- a/ci-benchmark/benchmark.graphql +++ b/ci-benchmark/benchmark.graphql @@ -22,5 +22,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/auth.graphql b/examples/auth.graphql index fdafd9fe1f..f8d50d242e 100644 --- a/examples/auth.graphql +++ b/examples/auth.graphql @@ -9,11 +9,11 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type Mutation { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User @protected { @@ -30,5 +30,5 @@ type Post { userId: Int! title: String! body: String! @protected - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/call.graphql b/examples/call.graphql index 8849d9b436..76da11d1d0 100644 --- a/examples/call.graphql +++ b/examples/call.graphql @@ -10,13 +10,13 @@ type Post { } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") firstUser: User @call(steps: [{query: "user", args: {id: 1}}]) - postFromUser(userId: Int!): [Post] @http(path: "/posts?userId={{args.userId}}") + postFromUser(userId: Int!): [Post] @http(path: "/posts?userId={{.args.userId}}") } type User { id: Int name: String - posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{.value.id}}"}}]) } diff --git a/examples/cors.graphql b/examples/cors.graphql index 7dfc04dd04..3d4c4af23a 100644 --- a/examples/cors.graphql +++ b/examples/cors.graphql @@ -3,29 +3,19 @@ schema port: 8000 graphiql: true hostname: "0.0.0.0" - headers: {cors: {allowOrigins: ["abc.xyz"], allowHeaders: ["Authorization"], allowMethods: [POST, GET, OPTIONS]}} + headers: {cors: {allowOrigins: ["*"], allowHeaders: ["*"], allowMethods: [POST, GET, OPTIONS]}} ) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { query: Query } -type Query @cache(maxAge: 30000) { +type Query { posts: [Post] @http(path: "/posts") } -type User { - id: Int! - name: String! - username: String! - email: String! - phone: String - website: String -} - type Post { id: Int! userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") } diff --git a/examples/graphql-composition.graphql b/examples/graphql-composition.graphql index 008051561c..e7079e1250 100644 --- a/examples/graphql-composition.graphql +++ b/examples/graphql-composition.graphql @@ -17,7 +17,7 @@ type Post { userId: Int! title: String! body: String! - user: User @graphQL(name: "user", args: [{key: "id", value: "{{value.userId}}"}]) + user: User @graphQL(name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type User { diff --git a/examples/grpc-reflection.graphql b/examples/grpc-reflection.graphql new file mode 100644 index 0000000000..1d96f10149 --- /dev/null +++ b/examples/grpc-reflection.graphql @@ -0,0 +1,36 @@ +# for test upstream server see [repo](https://github.com/tailcallhq/tailcall/tree/main/tailcall-upstream-grpc) +schema + @server(port: 8000, graphiql: true) + @upstream(baseURL: "http://localhost:50051", httpCache: true, batch: {delay: 10}) + @link(src: "http://localhost:50051", type: Grpc) { + query: Query +} + +type Query { + news: NewsData! @grpc(method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}") + newsByIdBatch(news: NewsInput!): News! + @grpc(method: "news.NewsService.GetMultipleNews", body: "{{args.news}}", batchKey: ["news", "id"]) +} + +type News { + id: Int + title: String + body: String + postImage: String + status: Status +} + +enum Status { + PUBLISHED + DRAFT + DELETED +} + +input NewsInput { + id: Int +} + +type NewsData { + news: [News]! +} diff --git a/examples/grpc.graphql b/examples/grpc.graphql index 6e775b291a..e358218d71 100644 --- a/examples/grpc.graphql +++ b/examples/grpc.graphql @@ -2,15 +2,15 @@ schema @server(port: 8000, graphiql: true) @upstream(baseURL: "http://localhost:50051", httpCache: true, batch: {delay: 10}) - @link(id: "news", src: "../src/grpc/tests/proto/news.proto", type: Protobuf) { + @link(id: "news", src: "../tailcall-fixtures/fixtures/protobuf/news.proto", type: Protobuf) { query: Query } type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}") + newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{.args.news}}") newsByIdBatch(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetMultipleNews", body: "{{args.news}}", batchKey: ["news", "id"]) + @grpc(method: "news.NewsService.GetMultipleNews", body: "{{.args.news}}", batchKey: ["news", "id"]) } type News { @@ -18,6 +18,13 @@ type News { title: String body: String postImage: String + status: Status +} + +enum Status { + PUBLISHED + DRAFT + DELETED } input NewsInput { diff --git a/examples/jsonplaceholder.graphql b/examples/jsonplaceholder.graphql index 622f9af1ae..028bc1b047 100644 --- a/examples/jsonplaceholder.graphql +++ b/examples/jsonplaceholder.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, headers: {cors: {allowOrigins: ["*"], allowHeaders: ["*"], allowMethods: [POST, GET, OPTIONS]}}) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true, batch: {delay: 100}) { query: Query } @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } diff --git a/examples/jsonplaceholder_batch.graphql b/examples/jsonplaceholder_batch.graphql index 979d3d372a..4c5eb45081 100644 --- a/examples/jsonplaceholder_batch.graphql +++ b/examples/jsonplaceholder_batch.graphql @@ -22,5 +22,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}], batchKey: ["id"]) + user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}], batchKey: ["id"]) } diff --git a/examples/jsonplaceholder_http_2.graphql b/examples/jsonplaceholder_http_2.graphql index 2432391877..5ac363643f 100644 --- a/examples/jsonplaceholder_http_2.graphql +++ b/examples/jsonplaceholder_http_2.graphql @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/jsonplaceholder_script.graphql b/examples/jsonplaceholder_script.graphql index b1ad5250c1..ab23e05e47 100644 --- a/examples/jsonplaceholder_script.graphql +++ b/examples/jsonplaceholder_script.graphql @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/lint.sh b/examples/lint.sh index ae375988bf..c12b62f68b 100755 --- a/examples/lint.sh +++ b/examples/lint.sh @@ -14,9 +14,10 @@ check_files() { local depth=1 local -a extensions=("-name" "*.json" -o "-name" "*.yml" -o "-name" "*.yaml" -o "-name" "*.graphql" -o "-name" "*.gql") local command="./target/debug/tailcall check" + local -a ignore=("!" "-name" "grpc-reflection.graphql") # Execute find command with constructed options and extensions - find "$path" -maxdepth "$depth" \( "${extensions[@]}" \) -exec sh -c ' + find "$path" -maxdepth "$depth" \( "${extensions[@]}" \) "${ignore[@]}" -exec sh -c ' for file; do echo "Checking file: $file" '"$command"' "$file" || exit 255 diff --git a/examples/rest-api.graphql b/examples/rest-api.graphql index 21ef0c6d80..11191d3586 100644 --- a/examples/rest-api.graphql +++ b/examples/rest-api.graphql @@ -8,7 +8,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -25,5 +25,5 @@ type Post { userId: Int! title: String! body: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } diff --git a/examples/telemetry-otlp.graphql b/examples/telemetry-otlp.graphql index b3725c781e..e256dfd79a 100644 --- a/examples/telemetry-otlp.graphql +++ b/examples/telemetry-otlp.graphql @@ -2,14 +2,14 @@ schema @server(port: 8000, graphiql: true, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(type: Operation, src: "operations/routes.graphql") - @link(id: "news", src: "../src/grpc/tests/proto/news.proto", type: Protobuf) + @link(id: "news", src: "../tailcall-fixtures/fixtures/protobuf/news.proto", type: Protobuf) @telemetry( export: { otlp: { url: "https://api.honeycomb.io:443" # gather api key from https://ui.honeycomb.io and set it as env when running tailcall headers: [ - {key: "x-honeycomb-team", value: "{{env.HONEYCOMB_API_KEY}}"} + {key: "x-honeycomb-team", value: "{{.env.HONEYCOMB_API_KEY}}"} {key: "x-honeycomb-dataset", value: "tailcall"} ] } @@ -21,7 +21,7 @@ schema type Query { posts: [Post] @http(path: "/posts") @cache(maxAge: 3000) - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") users: [User] @http(path: "/users") news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") } @@ -40,7 +40,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type News { @@ -48,6 +48,13 @@ type News { title: String body: String postImage: String + status: Status +} + +enum Status { + PUBLISHED + DRAFT + DELETED } type NewsData { diff --git a/examples/telemetry-prometheus.graphql b/examples/telemetry-prometheus.graphql index 8b16fd9367..0fe17bd38d 100644 --- a/examples/telemetry-prometheus.graphql +++ b/examples/telemetry-prometheus.graphql @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") @cache(maxAge: 5000) - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/telemetry-stdout.graphql b/examples/telemetry-stdout.graphql index b57997e48d..572d980a1e 100644 --- a/examples/telemetry-stdout.graphql +++ b/examples/telemetry-stdout.graphql @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") @cache(maxAge: 5000) - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/generated/.tailcallrc.graphql b/generated/.tailcallrc.graphql index e1ead52f61..cbba820756 100644 --- a/generated/.tailcallrc.graphql +++ b/generated/.tailcallrc.graphql @@ -421,20 +421,20 @@ input Apollo { """ Setting `platform` for Apollo. """ - platform: String! + platform: String """ Setting `userVersion` for Apollo. """ - userVersion: String! + userVersion: String """ Setting `version` for Apollo. """ - version: String! + version: String } input Batch { delay: Int! headers: [String!] - maxSize: Int! + maxSize: Int } """ The @cache operator enables caching for the query, field or type it is applied to. @@ -682,6 +682,7 @@ enum LinkType { Operation Htpasswd Jwks + Grpc } enum Method { GET diff --git a/generated/.tailcallrc.schema.json b/generated/.tailcallrc.schema.json index 2843d575db..265020e9f4 100644 --- a/generated/.tailcallrc.schema.json +++ b/generated/.tailcallrc.schema.json @@ -103,18 +103,24 @@ }, "platform": { "description": "Setting `platform` for Apollo.", - "default": "platform", - "type": "string" + "type": [ + "string", + "null" + ] }, "userVersion": { "description": "Setting `userVersion` for Apollo.", - "default": "1.0", - "type": "string" + "type": [ + "string", + "null" + ] }, "version": { "description": "Setting `version` for Apollo.", - "default": "1.0", - "type": "string" + "type": [ + "string", + "null" + ] } } }, @@ -170,8 +176,10 @@ "uniqueItems": true }, "maxSize": { - "default": 100, - "type": "integer", + "type": [ + "integer", + "null" + ], "format": "uint", "minimum": 0.0 } @@ -784,7 +792,8 @@ "Key", "Operation", "Htpasswd", - "Jwks" + "Jwks", + "Grpc" ] }, "Method": { diff --git a/npm/package-lock.json b/npm/package-lock.json index 1dfcfedcb3..28ca47660e 100644 --- a/npm/package-lock.json +++ b/npm/package-lock.json @@ -800,9 +800,9 @@ } }, "node_modules/tsx": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.7.2.tgz", - "integrity": "sha512-BCNd4kz6fz12fyrgCTEdZHGJ9fWTGeUzXmQysh0RVocDY3h4frk05ZNCXSy4kIenF7y/QnrdiVpTsyNRn6vlAw==", + "version": "4.7.3", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.7.3.tgz", + "integrity": "sha512-+fQnMqIp/jxZEXLcj6WzYy9FhcS5/Dfk8y4AtzJ6ejKcKqmfTF8Gso/jtrzDggCF2zTU20gJa6n8XqPYwDAUYQ==", "dev": true, "dependencies": { "esbuild": "~0.19.10", @@ -819,9 +819,9 @@ } }, "node_modules/type-fest": { - "version": "4.15.0", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.15.0.tgz", - "integrity": "sha512-tB9lu0pQpX5KJq54g+oHOLumOx+pMep4RaM6liXh2PKmVRFF+/vAtUP0ZaJ0kOySfVNjF6doBWPHhBhISKdlIA==", + "version": "4.18.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.18.0.tgz", + "integrity": "sha512-+dbmiyliDY/2TTcjCS7NpI9yV2iEFlUDk5TKnsbkN7ZoRu5s7bT+zvYtNFhFXC2oLwURGT2frACAZvbbyNBI+w==", "engines": { "node": ">=16" }, @@ -858,9 +858,9 @@ } }, "node_modules/yaml": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.1.tgz", - "integrity": "sha512-pIXzoImaqmfOrL7teGUBt/T7ZDnyeGBWyXQBvOVhLkWLN37GXv8NMLK406UY6dS51JfcQHsmcW5cJ441bHg6Lg==", + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.4.2.tgz", + "integrity": "sha512-B3VqDZ+JAg1nZpaEmWtTXUlBneoGx6CPM9b0TENK6aoSu5t73dItudwdgmi6tHlIZZId4dZ9skcAQ2UbcyAeVA==", "bin": { "yaml": "bin.mjs" }, diff --git a/src/blueprint/into_schema.rs b/src/blueprint/into_schema.rs index b35d310129..9b886bb848 100644 --- a/src/blueprint/into_schema.rs +++ b/src/blueprint/into_schema.rs @@ -70,12 +70,12 @@ fn to_type(def: &Definition) -> dynamic::Type { let const_value = expr.eval(ctx, &Concurrent::Sequential).await?; - let p = match const_value { - ConstValue::List(a) => FieldValue::list(a), - a => FieldValue::from(a), + ConstValue::List(a) => Some(FieldValue::list(a)), + ConstValue::Null => FieldValue::NONE, + a => Some(FieldValue::from(a)), }; - Ok(Some(p)) + Ok(p) } .instrument(span) .inspect_err(|err| tracing::error!(?err)), diff --git a/src/blueprint/operators/grpc.rs b/src/blueprint/operators/grpc.rs index 4d97cc20be..3029469519 100644 --- a/src/blueprint/operators/grpc.rs +++ b/src/blueprint/operators/grpc.rs @@ -165,15 +165,17 @@ pub fn compile_grpc(inputs: CompileGrpc) -> Valid { Valid::from(GrpcMethod::try_from(grpc.method.as_str())) .and_then(|method| { - Valid::from_option( - config_module.extensions.get_file_descriptor_set(&method), - format!("File descriptor not found for method: {}", grpc.method), - ) - .and_then(|file_descriptor_set| to_operation(&method, file_descriptor_set.clone())) - .fuse(to_url(grpc, &method, config_module)) - .fuse(helpers::headers::to_mustache_headers(&grpc.headers)) - .fuse(helpers::body::to_body(grpc.body.as_deref())) - .into() + let file_descriptor_set = config_module.extensions.get_file_descriptor_set(); + + if file_descriptor_set.file.is_empty() { + return Valid::fail("Protobuf files were not specified in the config".to_string()); + } + + to_operation(&method, file_descriptor_set) + .fuse(to_url(grpc, &method, config_module)) + .fuse(helpers::headers::to_mustache_headers(&grpc.headers)) + .fuse(helpers::body::to_body(grpc.body.as_deref())) + .into() }) .and_then(|(operation, url, headers, body)| { let validation = if validate_with_schema { diff --git a/src/blueprint/upstream.rs b/src/blueprint/upstream.rs index 9e3340d955..279bbf1a55 100644 --- a/src/blueprint/upstream.rs +++ b/src/blueprint/upstream.rs @@ -32,7 +32,7 @@ pub struct Upstream { impl Upstream { pub fn is_batching_enabled(&self) -> bool { if let Some(batch) = self.batch.as_ref() { - batch.delay >= 1 || batch.max_size >= 1 + batch.delay >= 1 || batch.max_size.unwrap_or_default() >= 1 } else { false } @@ -88,7 +88,7 @@ fn get_batch(upstream: &config::Upstream) -> Valid, String> { || Valid::succeed(None), |batch| { Valid::succeed(Some(Batch { - max_size: (upstream).get_max_size(), + max_size: Some((upstream).get_max_size()), delay: (upstream).get_delay(), headers: batch.headers.clone(), })) diff --git a/src/cli/javascript/js_request.rs b/src/cli/javascript/js_request.rs index 14fb385a31..ad46afff4f 100644 --- a/src/cli/javascript/js_request.rs +++ b/src/cli/javascript/js_request.rs @@ -68,11 +68,13 @@ impl Display for Uri { .collect::>() .join("&"); + write!(f, "{}://{}{}{}", scheme, host, port, path)?; + if !query.is_empty() { - write!(f, "{}://{}:{}{}?{}", scheme, host, port, path, query) - } else { - write!(f, "{}://{}{}{}", scheme, host, port, path) + write!(f, "?{}", query)?; } + + Ok(()) } } @@ -118,6 +120,7 @@ impl TryFrom<&reqwest::Request> for JsRequest { #[cfg(test)] mod tests { + use hyper::HeaderMap; use pretty_assertions::assert_eq; use super::*; @@ -154,6 +157,23 @@ mod tests { assert_eq!(body_out, Some(body.to_string())); } + #[test] + fn test_js_request_to_reqwest_request_with_port_and_query() { + let js_request = JsRequest { + uri: Uri::parse("http://localhost:3000/?test=abc").unwrap(), + method: "GET".to_string(), + headers: BTreeMap::default(), + body: None, + }; + let reqwest_request: reqwest::Request = js_request.try_into().unwrap(); + assert_eq!(reqwest_request.method(), reqwest::Method::GET); + assert_eq!( + reqwest_request.url().as_str(), + "http://localhost:3000/?test=abc" + ); + assert_eq!(reqwest_request.headers(), &HeaderMap::default()); + } + #[test] fn test_reqwest_request_to_js_request() { let mut reqwest_request = diff --git a/src/cli/server/server_config.rs b/src/cli/server/server_config.rs index 8406a61a51..7538633f05 100644 --- a/src/cli/server/server_config.rs +++ b/src/cli/server/server_config.rs @@ -28,10 +28,10 @@ impl ServerConfig { let (graph_id, variant) = apollo.graph_ref.split_once('@').unwrap(); extensions.push(SchemaExtension::new(ApolloTracing::new( apollo.api_key.clone(), - apollo.platform.clone(), + apollo.platform.clone().unwrap_or_default(), graph_id.to_string(), variant.to_string(), - apollo.version.clone(), + apollo.version.clone().unwrap_or_default(), ))); } rt.add_extensions(extensions); diff --git a/src/config/apollo.rs b/src/config/apollo.rs index 7e01bef5f4..0a02765d74 100644 --- a/src/config/apollo.rs +++ b/src/config/apollo.rs @@ -1,6 +1,7 @@ use serde::{Deserialize, Serialize}; use crate::config::ConfigReaderContext; +use crate::is_default; use crate::mustache::Mustache; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq, Eq, schemars::JsonSchema)] @@ -14,28 +15,16 @@ pub struct Apollo { pub graph_ref: String, /// /// Setting `userVersion` for Apollo. - #[serde(default = "default_user_version")] - pub user_version: String, + #[serde(default, skip_serializing_if = "is_default")] + pub user_version: Option, /// /// Setting `platform` for Apollo. - #[serde(default = "default_platform")] - pub platform: String, + #[serde(default, skip_serializing_if = "is_default")] + pub platform: Option, /// /// Setting `version` for Apollo. - #[serde(default = "default_version")] - pub version: String, -} - -fn default_user_version() -> String { - "1.0".to_string() -} - -fn default_platform() -> String { - "platform".to_string() -} - -fn default_version() -> String { - "1.0".to_string() + #[serde(default, skip_serializing_if = "is_default")] + pub version: Option, } impl Apollo { @@ -48,14 +37,14 @@ impl Apollo { let graph_ref_tmpl = Mustache::parse(graph_ref)?; *graph_ref = graph_ref_tmpl.render(reader_ctx); - let user_version_tmpl = Mustache::parse(user_version)?; - *user_version = user_version_tmpl.render(reader_ctx); + let user_version_tmpl = Mustache::parse(user_version.as_deref().unwrap_or_default())?; + *user_version = Some(user_version_tmpl.render(reader_ctx)); - let platform_tmpl = Mustache::parse(platform)?; - *platform = platform_tmpl.render(reader_ctx); + let platform_tmpl = Mustache::parse(platform.as_deref().unwrap_or_default())?; + *platform = Some(platform_tmpl.render(reader_ctx)); - let version_tmpl = Mustache::parse(version)?; - *version = version_tmpl.render(reader_ctx); + let version_tmpl = Mustache::parse(version.as_deref().unwrap_or_default())?; + *version = Some(version_tmpl.render(reader_ctx)); Ok(()) } diff --git a/src/config/config_module.rs b/src/config/config_module.rs index 266c687b2f..12328ac5c8 100644 --- a/src/config/config_module.rs +++ b/src/config/config_module.rs @@ -1,16 +1,16 @@ -use std::collections::HashSet; +use std::collections::{HashMap, HashSet}; use std::ops::Deref; use std::sync::Arc; use derive_setters::Setters; use jsonwebtoken::jwk::JwkSet; -use prost_reflect::prost_types::FileDescriptorSet; +use prost_reflect::prost_types::{FileDescriptorProto, FileDescriptorSet}; use rustls_pki_types::{CertificateDer, PrivateKeyDer}; -use crate::blueprint::GrpcMethod; use crate::config::Config; use crate::macros::MergeRight; use crate::merge_right::MergeRight; +use crate::proto_reader::ProtoMetadata; use crate::rest::{EndpointSet, Unchecked}; use crate::scalar; @@ -42,8 +42,8 @@ impl Deref for Content { /// an IO operation, i.e., reading a file, making an HTTP call, etc. #[derive(Clone, Debug, Default, MergeRight)] pub struct Extensions { - /// Contains the file descriptor sets resolved from the links - pub grpc_file_descriptors: Vec>, + /// Contains the file descriptor set resolved from the links to proto files + pub grpc_file_descriptors: HashMap, /// Contains the contents of the JS file pub script: Option, @@ -63,16 +63,15 @@ pub struct Extensions { } impl Extensions { - pub fn get_file_descriptor_set(&self, grpc: &GrpcMethod) -> Option<&FileDescriptorSet> { - self.grpc_file_descriptors - .iter() - .find(|content| { - content - .file - .iter() - .any(|file| file.package == Some(grpc.package.to_owned())) - }) - .map(|a| &a.content) + pub fn add_proto(&mut self, metadata: ProtoMetadata) { + for file in metadata.descriptor_set.file { + self.grpc_file_descriptors + .insert(file.name().to_string(), file); + } + } + + pub fn get_file_descriptor_set(&self) -> FileDescriptorSet { + FileDescriptorSet { file: self.grpc_file_descriptors.values().cloned().collect() } } pub fn has_auth(&self) -> bool { @@ -80,6 +79,14 @@ impl Extensions { } } +impl MergeRight for FileDescriptorSet { + fn merge_right(mut self, other: Self) -> Self { + self.file.extend(other.file); + + self + } +} + impl Deref for ConfigModule { type Target = Config; fn deref(&self) -> &Self::Target { diff --git a/src/config/link.rs b/src/config/link.rs index dc714d4386..d236148541 100644 --- a/src/config/link.rs +++ b/src/config/link.rs @@ -23,6 +23,7 @@ pub enum LinkType { Operation, Htpasswd, Jwks, + Grpc, } /// The @link directive allows you to import external resources, such as diff --git a/src/config/reader.rs b/src/config/reader.rs index e9bd206860..680e58d79d 100644 --- a/src/config/reader.rs +++ b/src/config/reader.rs @@ -10,7 +10,7 @@ use super::{ConfigModule, Content, Link, LinkType}; use crate::config::{Config, ConfigReaderContext, Source}; use crate::merge_right::MergeRight; use crate::proto_reader::ProtoReader; -use crate::resource_reader::ResourceReader; +use crate::resource_reader::{Cached, ResourceReader}; use crate::rest::EndpointSet; use crate::runtime::TargetRuntime; @@ -18,16 +18,17 @@ use crate::runtime::TargetRuntime; /// linked extensions to create a ConfigModule. pub struct ConfigReader { runtime: TargetRuntime, - resource_reader: ResourceReader, + resource_reader: ResourceReader, proto_reader: ProtoReader, } impl ConfigReader { pub fn init(runtime: TargetRuntime) -> Self { + let resource_reader = ResourceReader::::cached(runtime.clone()); Self { runtime: runtime.clone(), - resource_reader: ResourceReader::init(runtime.clone()), - proto_reader: ProtoReader::init(runtime), + resource_reader: resource_reader.clone(), + proto_reader: ProtoReader::init(resource_reader, runtime), } } @@ -58,12 +59,11 @@ impl ConfigReader { for link in links.iter() { let path = Self::resolve_path(&link.src, parent_dir); - let source = self.resource_reader.read_file(&path).await?; - - let content = source.content; - match link.type_of { LinkType::Config => { + let source = self.resource_reader.read_file(&path).await?; + let content = source.content; + let config = Config::from_source(Source::detect(&source.path)?, &content)?; config_module = config_module.merge_right(ConfigModule::from(config.clone())); @@ -79,39 +79,46 @@ impl ConfigReader { } } LinkType::Protobuf => { - let path = Self::resolve_path(&link.src, parent_dir); let meta = self.proto_reader.read(path).await?; - config_module - .extensions - .grpc_file_descriptors - .push(Content { - id: link.id.clone(), - content: meta.descriptor_set.clone(), - }); + config_module.extensions.add_proto(meta); } LinkType::Script => { + let source = self.resource_reader.read_file(&path).await?; + let content = source.content; config_module.extensions.script = Some(content); } LinkType::Cert => { + let source = self.resource_reader.read_file(&path).await?; + let content = source.content; config_module .extensions .cert - .extend(self.load_cert(content.clone()).await?); + .extend(self.load_cert(content).await?); } LinkType::Key => { - config_module.extensions.keys = - Arc::new(self.load_private_key(content.clone()).await?) + let source = self.resource_reader.read_file(&path).await?; + let content = source.content; + config_module.extensions.keys = Arc::new(self.load_private_key(content).await?) } LinkType::Operation => { + let source = self.resource_reader.read_file(&path).await?; + let content = source.content; + config_module.extensions.endpoint_set = EndpointSet::try_new(&content)?; } LinkType::Htpasswd => { + let source = self.resource_reader.read_file(&path).await?; + let content = source.content; + config_module .extensions .htpasswd - .push(Content { id: link.id.clone(), content: content.clone() }); + .push(Content { id: link.id.clone(), content }); } LinkType::Jwks => { + let source = self.resource_reader.read_file(&path).await?; + let content = source.content; + let de = &mut serde_json::Deserializer::from_str(&content); config_module.extensions.jwks.push(Content { @@ -119,6 +126,13 @@ impl ConfigReader { content: serde_path_to_error::deserialize(de)?, }) } + LinkType::Grpc => { + let meta = self.proto_reader.fetch(link.src.as_str()).await?; + + for m in meta { + config_module.extensions.add_proto(m); + } + } } } @@ -157,12 +171,15 @@ impl ConfigReader { } /// Reads a single file and returns the config - pub async fn read(&self, file: T) -> anyhow::Result { + pub async fn read(&self, file: T) -> anyhow::Result { self.read_all(&[file]).await } /// Reads all the files and returns a merged config - pub async fn read_all(&self, files: &[T]) -> anyhow::Result { + pub async fn read_all( + &self, + files: &[T], + ) -> anyhow::Result { let files = self.resource_reader.read_files(files).await?; let mut config_module = ConfigModule::default(); @@ -199,12 +216,13 @@ impl ConfigReader { let server = &mut config_module.config.server; let reader_ctx = ConfigReaderContext { - env: self.runtime.env.clone(), + runtime: &self.runtime, vars: &server .vars .iter() .map(|vars| (vars.key.clone(), vars.value.clone())) .collect(), + headers: Default::default(), }; config_module @@ -249,7 +267,7 @@ mod reader_tests { cfg = cfg.types([("Test", Type::default())].to_vec()); let server = start_mock_server(); - let header_serv = server.mock(|when, then| { + let header_server = server.mock(|when, then| { when.method(httpmock::Method::GET).path("/bar.graphql"); then.status(200).body(cfg.to_sdl()); }); @@ -287,7 +305,7 @@ mod reader_tests { .collect::>() ); foo_json_server.assert(); // checks if the request was actually made - header_serv.assert(); + header_server.assert(); } #[tokio::test] diff --git a/src/config/reader_context.rs b/src/config/reader_context.rs index dc1641fef3..8c16f4783b 100644 --- a/src/config/reader_context.rs +++ b/src/config/reader_context.rs @@ -1,13 +1,16 @@ use std::borrow::Cow; use std::collections::BTreeMap; -use std::sync::Arc; +use headers::HeaderMap; + +use crate::has_headers::HasHeaders; use crate::path::PathString; -use crate::EnvIO; +use crate::runtime::TargetRuntime; pub struct ConfigReaderContext<'a> { - pub env: Arc, + pub runtime: &'a TargetRuntime, pub vars: &'a BTreeMap, + pub headers: HeaderMap, } impl<'a> PathString for ConfigReaderContext<'a> { @@ -19,25 +22,37 @@ impl<'a> PathString for ConfigReaderContext<'a> { path.split_first() .and_then(|(head, tail)| match head.as_ref() { "vars" => self.vars.get(tail[0].as_ref()).map(|v| v.into()), - "env" => self.env.get(tail[0].as_ref()), + "env" => self.runtime.env.get(tail[0].as_ref()), _ => None, }) } } +impl HasHeaders for ConfigReaderContext<'_> { + fn headers(&self) -> &HeaderMap { + &self.headers + } +} + #[cfg(test)] mod tests { + use std::sync::Arc; + use super::*; use crate::tests::TestEnvIO; #[test] fn path_string() { + let mut runtime = crate::runtime::test::init(None); + runtime.env = Arc::new(TestEnvIO::from_iter([( + "ENV_1".to_owned(), + "ENV_VAL".to_owned(), + )])); + let reader_context = ConfigReaderContext { - env: Arc::new(TestEnvIO::from_iter([( - "ENV_1".to_owned(), - "ENV_VAL".to_owned(), - )])), + runtime: &runtime, vars: &BTreeMap::from_iter([("VAR_1".to_owned(), "VAR_VAL".to_owned())]), + headers: Default::default(), }; assert_eq!( diff --git a/src/config/upstream.rs b/src/config/upstream.rs index a4d3b9b58b..837bbc03ea 100644 --- a/src/config/upstream.rs +++ b/src/config/upstream.rs @@ -7,6 +7,8 @@ use crate::is_default; use crate::macros::MergeRight; use crate::merge_right::MergeRight; +const DEFAULT_MAX_SIZE: usize = 100; + #[derive( Serialize, Deserialize, PartialEq, Eq, Clone, Debug, Setters, schemars::JsonSchema, MergeRight, )] @@ -14,12 +16,16 @@ use crate::merge_right::MergeRight; pub struct Batch { pub delay: usize, pub headers: BTreeSet, - pub max_size: usize, + #[serde(default, skip_serializing_if = "is_default")] + pub max_size: Option, } - impl Default for Batch { fn default() -> Self { - Batch { max_size: 100, delay: 0, headers: BTreeSet::new() } + Batch { + max_size: Some(DEFAULT_MAX_SIZE), + delay: 0, + headers: BTreeSet::new(), + } } } @@ -172,7 +178,9 @@ impl Upstream { } pub fn get_max_size(&self) -> usize { - self.batch.clone().unwrap_or_default().max_size + self.batch + .as_ref() + .map_or(DEFAULT_MAX_SIZE, |b| b.max_size.unwrap_or(DEFAULT_MAX_SIZE)) } pub fn get_http_2_only(&self) -> bool { diff --git a/src/generator/from_proto.rs b/src/generator/from_proto.rs index 75a4301c16..603d149fdc 100644 --- a/src/generator/from_proto.rs +++ b/src/generator/from_proto.rs @@ -270,8 +270,7 @@ mod test { use crate::generator::from_proto::from_proto; fn get_proto_file_descriptor(name: &str) -> anyhow::Result { - let path = - PathBuf::from(env!("CARGO_MANIFEST_DIR")).join(format!("src/generator/proto/{}", name)); + let path = PathBuf::from(tailcall_fixtures::generator::proto::SELF).join(name); Ok(protox_parse::parse( name, std::fs::read_to_string(path)?.as_str(), diff --git a/src/generator/generator.rs b/src/generator/generator.rs index 343ac9a3f3..ab0ee46314 100644 --- a/src/generator/generator.rs +++ b/src/generator/generator.rs @@ -5,6 +5,7 @@ use crate::generator::from_proto::from_proto; use crate::generator::source::Source; use crate::merge_right::MergeRight; use crate::proto_reader::ProtoReader; +use crate::resource_reader::ResourceReader; use crate::runtime::TargetRuntime; pub struct Generator { @@ -12,7 +13,9 @@ pub struct Generator { } impl Generator { pub fn init(runtime: TargetRuntime) -> Self { - Self { proto_reader: ProtoReader::init(runtime) } + Self { + proto_reader: ProtoReader::init(ResourceReader::cached(runtime.clone()), runtime), + } } pub async fn read_all>( @@ -53,7 +56,7 @@ mod test { async fn test_read_all() { let server = start_mock_server(); let runtime = crate::runtime::test::init(None); - let test_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("src/generator/proto"); + let test_dir = PathBuf::from(tailcall_fixtures::generator::proto::SELF); let news_content = runtime .file diff --git a/src/graphql/data_loader.rs b/src/graphql/data_loader.rs index 11dc1281b9..94d083c691 100644 --- a/src/graphql/data_loader.rs +++ b/src/graphql/data_loader.rs @@ -24,7 +24,7 @@ impl GraphqlDataLoader { pub fn to_data_loader(self, batch: Batch) -> DataLoader { DataLoader::new(self) .delay(Duration::from_millis(batch.delay as u64)) - .max_batch_size(batch.max_size) + .max_batch_size(batch.max_size.unwrap_or_default()) } } diff --git a/src/grpc/data_loader.rs b/src/grpc/data_loader.rs index cb29aa53fa..5172a77ae3 100644 --- a/src/grpc/data_loader.rs +++ b/src/grpc/data_loader.rs @@ -29,7 +29,7 @@ impl GrpcDataLoader { pub fn to_data_loader(self, batch: Batch) -> DataLoader { DataLoader::new(self) .delay(Duration::from_millis(batch.delay as u64)) - .max_batch_size(batch.max_size) + .max_batch_size(batch.max_size.unwrap_or_default()) } async fn load_dedupe_only( diff --git a/src/grpc/data_loader_request.rs b/src/grpc/data_loader_request.rs index 891e760c9b..3d18519efb 100644 --- a/src/grpc/data_loader_request.rs +++ b/src/grpc/data_loader_request.rs @@ -53,11 +53,11 @@ impl DataLoaderRequest { #[cfg(test)] mod tests { use std::collections::BTreeSet; - use std::path::PathBuf; use hyper::header::{HeaderName, HeaderValue}; use hyper::HeaderMap; use pretty_assertions::assert_eq; + use tailcall_fixtures::protobuf; use url::Url; use super::DataLoaderRequest; @@ -68,16 +68,10 @@ mod tests { use crate::grpc::request_template::RenderedRequestTemplate; pub async fn get_protobuf_op() -> ProtobufOperation { - let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let mut test_file = root_dir.join(file!()); - - test_file.pop(); - test_file.push("tests"); - test_file.push("proto"); - test_file.push("greetings.proto"); + let test_file = protobuf::GREETINGS; let mut config = Config::default().links(vec![Link { id: None, - src: test_file.to_str().unwrap().to_string(), + src: test_file.to_string(), type_of: LinkType::Protobuf, }]); let method = GrpcMethod { @@ -95,14 +89,9 @@ mod tests { let reader = ConfigReader::init(runtime); let config_module = reader.resolve(config, None).await.unwrap(); - let protobuf_set = ProtobufSet::from_proto_file( - config_module - .extensions - .get_file_descriptor_set(&method) - .unwrap() - .clone(), - ) - .unwrap(); + let protobuf_set = + ProtobufSet::from_proto_file(config_module.extensions.get_file_descriptor_set()) + .unwrap(); let service = protobuf_set.find_service(&method).unwrap(); diff --git a/src/grpc/protobuf.rs b/src/grpc/protobuf.rs index 47fe97cec7..4175ce73ad 100644 --- a/src/grpc/protobuf.rs +++ b/src/grpc/protobuf.rs @@ -79,17 +79,12 @@ impl ProtobufSet { } pub fn find_service(&self, grpc_method: &GrpcMethod) -> Result { + let service_name = format!("{}.{}", grpc_method.package, grpc_method.service); + let service_descriptor = self .descriptor_pool - .get_service_by_name( - format!("{}.{}", grpc_method.package, grpc_method.service).as_str(), - ) - .with_context(|| { - format!( - "Couldn't find definitions for service {}", - grpc_method.service - ) - })?; + .get_service_by_name(&service_name) + .with_context(|| format!("Couldn't find definitions for service {service_name}"))?; Ok(ProtobufService { service_descriptor }) } @@ -247,50 +242,31 @@ impl ProtobufOperation { #[cfg(test)] pub mod tests { - // TODO: Rewrite protobuf tests - use std::path::PathBuf; + use std::path::Path; + // TODO: Rewrite protobuf tests use anyhow::Result; - use once_cell::sync::Lazy; use prost_reflect::Value; use serde_json::json; + use tailcall_fixtures::protobuf; use super::*; use crate::blueprint::GrpcMethod; use crate::config::reader::ConfigReader; use crate::config::{Config, Field, Grpc, Link, LinkType, Type}; - static TEST_DIR: Lazy = Lazy::new(|| { - let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let mut test_dir = root_dir.join(file!()); - - test_dir.pop(); - test_dir.push("tests"); - - test_dir - }); - - fn get_test_file(name: &str) -> PathBuf { - let mut test_file = TEST_DIR.clone(); - - test_file.push(name); - test_file - } - - pub async fn get_proto_file(name: &str) -> Result { + pub async fn get_proto_file(path: &str) -> Result { let runtime = crate::runtime::test::init(None); let reader = ConfigReader::init(runtime); - let id = name.replace(".proto", ""); - - let name = format!("proto/{name}"); + let id = Path::new(path) + .file_stem() + .map(|s| s.to_string_lossy().to_string()) + .unwrap_or_default(); let mut config = Config::default().links(vec![Link { id: Some(id.clone()), - src: get_test_file(&name) - .to_str() - .context("Failed to parse or load proto file")? - .to_string(), + src: path.to_string(), type_of: LinkType::Protobuf, }]); @@ -304,9 +280,7 @@ pub mod tests { .resolve(config, None) .await? .extensions - .get_file_descriptor_set(&method) - .unwrap() - .to_owned()) + .get_file_descriptor_set()) } #[test] @@ -348,12 +322,12 @@ pub mod tests { #[tokio::test] async fn service_not_found() -> Result<()> { let grpc_method = GrpcMethod::try_from("greetings._unknown.foo").unwrap(); - let file = ProtobufSet::from_proto_file(get_proto_file("greetings.proto").await?)?; + let file = ProtobufSet::from_proto_file(get_proto_file(protobuf::GREETINGS).await?)?; let error = file.find_service(&grpc_method).unwrap_err(); assert_eq!( error.to_string(), - "Couldn't find definitions for service _unknown" + "Couldn't find definitions for service greetings._unknown" ); Ok(()) @@ -362,7 +336,7 @@ pub mod tests { #[tokio::test] async fn method_not_found() -> Result<()> { let grpc_method = GrpcMethod::try_from("greetings.Greeter._unknown").unwrap(); - let file = ProtobufSet::from_proto_file(get_proto_file("greetings.proto").await?)?; + let file = ProtobufSet::from_proto_file(get_proto_file(protobuf::GREETINGS).await?)?; let service = file.find_service(&grpc_method)?; let error = service.find_operation(&grpc_method).unwrap_err(); @@ -374,7 +348,7 @@ pub mod tests { #[tokio::test] async fn greetings_proto_file() -> Result<()> { let grpc_method = GrpcMethod::try_from("greetings.Greeter.SayHello").unwrap(); - let file = ProtobufSet::from_proto_file(get_proto_file("greetings.proto").await?)?; + let file = ProtobufSet::from_proto_file(get_proto_file(protobuf::GREETINGS).await?)?; let service = file.find_service(&grpc_method)?; let operation = service.find_operation(&grpc_method)?; @@ -396,7 +370,7 @@ pub mod tests { async fn news_proto_file() -> Result<()> { let grpc_method = GrpcMethod::try_from("news.NewsService.GetNews").unwrap(); - let file = ProtobufSet::from_proto_file(get_proto_file("news.proto").await?)?; + let file = ProtobufSet::from_proto_file(get_proto_file(protobuf::NEWS).await?)?; let service = file.find_service(&grpc_method)?; let operation = service.find_operation(&grpc_method)?; @@ -411,7 +385,7 @@ pub mod tests { assert_eq!( serde_json::to_value(parsed)?, json!({ - "id": 1, "title": "Note 1", "body": "Content 1", "postImage": "Post image 1" + "id": 1, "title": "Note 1", "body": "Content 1", "postImage": "Post image 1", "status": "PUBLISHED" }) ); @@ -421,7 +395,7 @@ pub mod tests { #[tokio::test] async fn news_proto_file_multiple_messages() -> Result<()> { let grpc_method = GrpcMethod::try_from("news.NewsService.GetMultipleNews").unwrap(); - let file = ProtobufSet::from_proto_file(get_proto_file("news.proto").await?)?; + let file = ProtobufSet::from_proto_file(get_proto_file(protobuf::NEWS).await?)?; let service = file.find_service(&grpc_method)?; let multiple_operation = service.find_operation(&grpc_method)?; @@ -439,18 +413,18 @@ pub mod tests { vec!["3".to_owned(), "5".to_owned(), "1".to_owned()] ); - let output = b"\0\0\0\0o\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x03\x12\x06Note 3\x1a\tContent 3\"\x0cPost image 3\n#\x08\x05\x12\x06Note 5\x1a\tContent 5\"\x0cPost image 5"; + let output = b"\0\0\0\0s\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n%\x08\x03\x12\x06Note 3\x1a\tContent 3\"\x0cPost image 3(\x01\n%\x08\x05\x12\x06Note 5\x1a\tContent 5\"\x0cPost image 5(\x02"; let parsed = multiple_operation.convert_output::(output)?; assert_eq!( serde_json::to_value(parsed)?, json!({ - "news": [ - { "id": 1, "title": "Note 1", "body": "Content 1", "postImage": "Post image 1" }, - { "id": 3, "title": "Note 3", "body": "Content 3", "postImage": "Post image 3" }, - { "id": 5, "title": "Note 5", "body": "Content 5", "postImage": "Post image 5" }, - ] + "news": [ + { "id": 1, "title": "Note 1", "body": "Content 1", "postImage": "Post image 1", "status": "PUBLISHED" }, + { "id": 3, "title": "Note 3", "body": "Content 3", "postImage": "Post image 3", "status": "DRAFT" }, + { "id": 5, "title": "Note 5", "body": "Content 5", "postImage": "Post image 5", "status": "DELETED" }, + ] }) ); diff --git a/src/grpc/request.rs b/src/grpc/request.rs index 492cb20a82..a47f9dd0e2 100644 --- a/src/grpc/request.rs +++ b/src/grpc/request.rs @@ -41,7 +41,6 @@ pub async fn execute_grpc_request( #[cfg(test)] mod tests { - use std::path::PathBuf; use std::sync::Arc; use anyhow::Result; @@ -50,6 +49,7 @@ mod tests { use reqwest::header::HeaderMap; use reqwest::{Method, Request, StatusCode}; use serde_json::json; + use tailcall_fixtures::protobuf; use tonic::{Code, Status}; use crate::blueprint::GrpcMethod; @@ -107,12 +107,10 @@ mod tests { let mut runtime = crate::runtime::test::init(None); runtime.http2_only = Arc::new(test_http); - let greetings_path = PathBuf::from("src/grpc/tests/proto/greetings.proto"); - let error_path = PathBuf::from("src/grpc/tests/proto/errors.proto"); - - let file_descriptor_set = protox::compile([greetings_path, error_path], ["."]); + let file_descriptor_set = + protox::compile([protobuf::GREETINGS, protobuf::ERRORS], [protobuf::SELF]); let grpc_method = GrpcMethod::try_from("greetings.Greeter.SayHello").unwrap(); - let file = ProtobufSet::from_proto_file(file_descriptor_set.unwrap_or_default())?; + let file = ProtobufSet::from_proto_file(file_descriptor_set.unwrap())?; let service = file.find_service(&grpc_method)?; let operation = service.find_operation(&grpc_method)?; diff --git a/src/grpc/request_template.rs b/src/grpc/request_template.rs index f5d01b205a..6d53a5d7fe 100644 --- a/src/grpc/request_template.rs +++ b/src/grpc/request_template.rs @@ -119,12 +119,12 @@ impl CacheKey for RequestTemplate { mod tests { use std::borrow::Cow; use std::collections::HashSet; - use std::path::PathBuf; use derive_setters::Setters; use hyper::header::{HeaderName, HeaderValue}; use hyper::{HeaderMap, Method}; use pretty_assertions::assert_eq; + use tailcall_fixtures::protobuf; use super::RequestTemplate; use crate::blueprint::GrpcMethod; @@ -135,13 +135,7 @@ mod tests { use crate::mustache::Mustache; async fn get_protobuf_op() -> ProtobufOperation { - let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let mut test_file = root_dir.join(file!()); - - test_file.pop(); - test_file.push("tests"); - test_file.push("proto"); - test_file.push("greetings.proto"); + let test_file = protobuf::GREETINGS; let id = "greetings".to_string(); @@ -149,7 +143,7 @@ mod tests { let reader = ConfigReader::init(runtime); let mut config = Config::default().links(vec![Link { id: Some(id.clone()), - src: test_file.to_str().unwrap().to_string(), + src: test_file.to_string(), type_of: LinkType::Protobuf, }]); let method = GrpcMethod { @@ -169,9 +163,7 @@ mod tests { .await .unwrap() .extensions - .get_file_descriptor_set(&method) - .unwrap() - .clone(), + .get_file_descriptor_set(), ) .unwrap(); diff --git a/src/grpc/tests/proto/cycle.proto b/src/grpc/tests/proto/cycle.proto deleted file mode 100644 index e3db248fb1..0000000000 --- a/src/grpc/tests/proto/cycle.proto +++ /dev/null @@ -1,6 +0,0 @@ -syntax = "proto3"; - -package cycle; - -import "src/grpc/tests/proto/nested0.proto"; -import "src/grpc/tests/proto/duplicate.proto"; diff --git a/src/grpc/tests/proto/duplicate.proto b/src/grpc/tests/proto/duplicate.proto deleted file mode 100644 index 8d6aa8fcd3..0000000000 --- a/src/grpc/tests/proto/duplicate.proto +++ /dev/null @@ -1,6 +0,0 @@ -syntax = "proto3"; - -package duplicate; - -import "src/grpc/tests/proto/greetings.proto"; -import "src/grpc/tests/proto/news.proto"; diff --git a/src/grpc/tests/proto/nested0.proto b/src/grpc/tests/proto/nested0.proto deleted file mode 100644 index 54dd8017ce..0000000000 --- a/src/grpc/tests/proto/nested0.proto +++ /dev/null @@ -1,7 +0,0 @@ -syntax = "proto3"; - -package nested0; - -import "src/grpc/tests/proto/greetings.proto"; -import "src/grpc/tests/proto/nested1.proto"; -import "src/grpc/tests/proto/news_no_pkg.proto"; \ No newline at end of file diff --git a/src/grpc/tests/proto/nested1.proto b/src/grpc/tests/proto/nested1.proto deleted file mode 100644 index 7f22d53a43..0000000000 --- a/src/grpc/tests/proto/nested1.proto +++ /dev/null @@ -1,6 +0,0 @@ -syntax = "proto3"; - -package nested1; - -import "src/grpc/tests/proto/news.proto"; -import "src/grpc/tests/proto/cycle.proto"; diff --git a/src/grpc/tests/proto/news.proto b/src/grpc/tests/proto/news.proto deleted file mode 100644 index 1c5860df3d..0000000000 --- a/src/grpc/tests/proto/news.proto +++ /dev/null @@ -1,33 +0,0 @@ -syntax = "proto3"; - -import "google/protobuf/empty.proto"; - -package news; - -message News { - int32 id = 1; - string title = 2; - string body = 3; - string post_image = 4; -} - -service NewsService { - rpc GetAllNews (google.protobuf.Empty) returns (NewsList) {} - rpc GetNews (NewsId) returns (News) {} - rpc GetMultipleNews (MultipleNewsId) returns (NewsList) {} - rpc DeleteNews (NewsId) returns (google.protobuf.Empty) {} - rpc EditNews (News) returns (News) {} - rpc AddNews (News) returns (News) {} -} - -message NewsId { - int32 id = 1; -} - -message MultipleNewsId { - repeated NewsId ids = 1; -} - -message NewsList { - repeated News news = 1; -} \ No newline at end of file diff --git a/src/http/data_loader.rs b/src/http/data_loader.rs index 749b8d0abf..1fdb328fdb 100644 --- a/src/http/data_loader.rs +++ b/src/http/data_loader.rs @@ -53,7 +53,7 @@ impl HttpDataLoader { pub fn to_data_loader(self, batch: Batch) -> DataLoader { DataLoader::new(self) .delay(Duration::from_millis(batch.delay as u64)) - .max_batch_size(batch.max_size) + .max_batch_size(batch.max_size.unwrap_or_default()) } } diff --git a/src/http/response.rs b/src/http/response.rs index 97e75e20b4..e4dcf41ad8 100644 --- a/src/http/response.rs +++ b/src/http/response.rs @@ -34,7 +34,14 @@ impl Response { } } - pub fn to_json(self) -> Result> { + pub fn to_json(self) -> Result> { + if self.body.is_empty() { + return Ok(Response { + status: self.status, + headers: self.headers, + body: Default::default(), + }); + } let body = serde_json::from_slice::(&self.body)?; Ok(Response { status: self.status, headers: self.headers, body }) } diff --git a/src/json/json_schema.rs b/src/json/json_schema.rs index 7fb0247f45..18bd92aa2f 100644 --- a/src/json/json_schema.rs +++ b/src/json/json_schema.rs @@ -240,6 +240,7 @@ mod tests { use async_graphql::Name; use indexmap::IndexMap; + use tailcall_fixtures::protobuf; use crate::blueprint::GrpcMethod; use crate::grpc::protobuf::tests::get_proto_file; @@ -310,7 +311,7 @@ mod tests { async fn test_from_protobuf_conversion() -> anyhow::Result<()> { let grpc_method = GrpcMethod::try_from("news.NewsService.GetNews").unwrap(); - let file = ProtobufSet::from_proto_file(get_proto_file("news.proto").await?)?; + let file = ProtobufSet::from_proto_file(get_proto_file(protobuf::NEWS).await?)?; let service = file.find_service(&grpc_method)?; let operation = service.find_operation(&grpc_method)?; @@ -326,6 +327,17 @@ mod tests { ("title".to_owned(), JsonSchema::Opt(JsonSchema::Str.into())), ("id".to_owned(), JsonSchema::Opt(JsonSchema::Num.into())), ("body".to_owned(), JsonSchema::Opt(JsonSchema::Str.into())), + ( + "status".to_owned(), + JsonSchema::Opt( + JsonSchema::Enum(BTreeSet::from_iter([ + "DELETED".to_owned(), + "DRAFT".to_owned(), + "PUBLISHED".to_owned() + ])) + .into() + ) + ) ])) ); diff --git a/src/main.rs b/src/main.rs index 09a423a71f..ef0806c1d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,6 +32,7 @@ fn run_blocking() -> anyhow::Result<()> { .on_thread_stop(|| { TRACING_GUARD.take(); }) + .enable_all() .build()?; rt.block_on(async { tailcall::cli::run().await }) } diff --git a/src/merge_right.rs b/src/merge_right.rs index 43df242828..1c04d67b6a 100644 --- a/src/merge_right.rs +++ b/src/merge_right.rs @@ -1,4 +1,4 @@ -use std::collections::{BTreeMap, BTreeSet, HashSet}; +use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet}; use std::sync::Arc; pub trait MergeRight { @@ -67,3 +67,13 @@ where self } } + +impl MergeRight for HashMap +where + K: Eq + std::hash::Hash, +{ + fn merge_right(mut self, other: Self) -> Self { + self.extend(other); + self + } +} diff --git a/src/mustache.rs b/src/mustache.rs index 51b595544e..689ce0b36f 100644 --- a/src/mustache.rs +++ b/src/mustache.rs @@ -1,3 +1,5 @@ +use std::fmt::Display; + use nom::branch::alt; use nom::bytes::complete::{tag, take_until}; use nom::character::complete::char; @@ -92,9 +94,9 @@ impl Mustache { } } -impl ToString for Mustache { - fn to_string(&self) -> String { - match self { +impl Display for Mustache { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { Mustache(segments) => segments .iter() .map(|segment| match segment { @@ -103,7 +105,8 @@ impl ToString for Mustache { }) .collect::>() .join(""), - } + }; + write!(f, "{}", str) } } @@ -127,8 +130,11 @@ fn parse_expression(input: &str) -> IResult<&str, Segment> { delimited( tag("{{"), map( - nom::multi::separated_list1(char('.'), parse_name), - Segment::Expression, + nom::sequence::tuple(( + nom::combinator::opt(char('.')), // Optional leading dot + nom::multi::separated_list1(char('.'), parse_name), + )), + |(_, expr_parts)| Segment::Expression(expr_parts), ), tag("}}"), )(input) @@ -347,6 +353,19 @@ mod tests { Mustache::from(vec![Segment::Literal("test:{SHA}string".to_string())]) ); } + + #[test] + fn test_optional_dot_expression() { + let s = r"{{.foo.bar}}"; + let mustache: Mustache = Mustache::parse(s).unwrap(); + assert_eq!( + mustache, + Mustache::from(vec![Segment::Expression(vec![ + "foo".to_string(), + "bar".to_string(), + ])]) + ); + } } mod render { diff --git a/src/proto_reader.rs b/src/proto_reader.rs deleted file mode 100644 index 92f922a824..0000000000 --- a/src/proto_reader.rs +++ /dev/null @@ -1,187 +0,0 @@ -use std::collections::{HashMap, VecDeque}; - -use anyhow::Context; -use futures_util::future::join_all; -use prost_reflect::prost_types::{FileDescriptorProto, FileDescriptorSet}; -use protox::file::{FileResolver, GoogleFileResolver}; - -use crate::resource_reader::ResourceReader; -use crate::runtime::TargetRuntime; - -pub struct ProtoReader { - resource_reader: ResourceReader, -} - -pub struct ProtoMetadata { - pub descriptor_set: FileDescriptorSet, - pub path: String, -} - -impl ProtoReader { - pub fn init(runtime: TargetRuntime) -> Self { - Self { resource_reader: ResourceReader::init(runtime) } - } - - pub async fn read_all>(&self, paths: &[T]) -> anyhow::Result> { - let resolved_protos = join_all(paths.iter().map(|v| self.read(v.as_ref()))) - .await - .into_iter() - .collect::>>()?; - Ok(resolved_protos) - } - - pub async fn read>(&self, path: T) -> anyhow::Result { - let file_read = self.read_proto(path.as_ref()).await?; - if file_read.package.is_none() { - anyhow::bail!("Package name is required"); - } - - let descriptors = self.resolve_descriptors(file_read).await?; - let metadata = ProtoMetadata { - descriptor_set: FileDescriptorSet { file: descriptors }, - path: path.as_ref().to_string(), - }; - Ok(metadata) - } - - /// Performs BFS to import all nested proto files - async fn resolve_descriptors( - &self, - parent_proto: FileDescriptorProto, - ) -> anyhow::Result> { - let mut descriptors: HashMap = HashMap::new(); - let mut queue = VecDeque::new(); - queue.push_back(parent_proto.clone()); - - while let Some(file) = queue.pop_front() { - let futures: Vec<_> = file - .dependency - .iter() - .map(|import| self.read_proto(import)) - .collect(); - - let results = join_all(futures).await; - - for result in results { - let proto = result?; - if descriptors.get(proto.name()).is_none() { - queue.push_back(proto.clone()); - descriptors.insert(proto.name().to_string(), proto); - } - } - } - - let mut descriptors_vec = descriptors - .into_values() - .collect::>(); - descriptors_vec.push(parent_proto); - Ok(descriptors_vec) - } - - /// Tries to load well-known google proto files and if not found uses normal - /// file and http IO to resolve them - async fn read_proto(&self, path: &str) -> anyhow::Result { - let content = if let Ok(file) = GoogleFileResolver::new().open_file(path) { - file.source() - .context("Unable to extract content of google well-known proto file")? - .to_string() - } else { - self.resource_reader.read_file(path).await?.content - }; - Ok(protox_parse::parse(path, &content)?) - } -} - -#[cfg(test)] -mod test_proto_config { - use std::path::{Path, PathBuf}; - - use anyhow::{Context, Result}; - use pretty_assertions::assert_eq; - - use crate::proto_reader::ProtoReader; - - #[tokio::test] - async fn test_resolve() { - // Skipping IO tests as they are covered in reader.rs - let reader = ProtoReader::init(crate::runtime::test::init(None)); - reader - .read_proto("google/protobuf/empty.proto") - .await - .unwrap(); - } - - #[tokio::test] - async fn test_nested_imports() -> Result<()> { - let root_dir = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - let mut test_dir = root_dir.join(file!()); - test_dir.pop(); // src - - let mut root = test_dir.clone(); - root.pop(); - - test_dir.push("grpc"); // grpc - test_dir.push("tests"); // tests - test_dir.push("proto"); // proto - - let mut test_file = test_dir.clone(); - - test_file.push("nested0.proto"); // nested0.proto - assert!(test_file.exists()); - let test_file = test_file.to_str().unwrap().to_string(); - - let runtime = crate::runtime::test::init(None); - let file_rt = runtime.file.clone(); - - let reader = ProtoReader::init(runtime); - let helper_map = reader - .resolve_descriptors(reader.read_proto(&test_file).await?) - .await?; - let files = test_dir.read_dir()?; - for file in files { - let file = file?; - let path = file.path(); - let path_str = - path_to_file_name(path.as_path()).context("It must be able to extract path")?; - let source = file_rt.read(&path_str).await?; - let expected = protox_parse::parse(&path_str, &source)?; - let actual = helper_map - .iter() - .find(|v| v.package.eq(&expected.package)) - .unwrap(); - - assert_eq!(&expected.dependency, &actual.dependency); - } - - Ok(()) - } - - fn path_to_file_name(path: &Path) -> Option { - let components: Vec<_> = path.components().collect(); - - // Find the index of the "src" component - if let Some(src_index) = components.iter().position(|&c| c.as_os_str() == "src") { - // Reconstruct the path from the "src" component onwards - let after_src_components = &components[src_index..]; - let result = after_src_components - .iter() - .fold(PathBuf::new(), |mut acc, comp| { - acc.push(comp); - acc - }); - Some(result.to_str().unwrap().to_string()) - } else { - None - } - } - #[tokio::test] - async fn test_proto_no_pkg() -> Result<()> { - let runtime = crate::runtime::test::init(None); - let reader = ProtoReader::init(runtime); - let mut proto_no_pkg = PathBuf::from(env!("CARGO_MANIFEST_DIR")); - proto_no_pkg.push("src/grpc/tests/proto_no_pkg.graphql"); - let config_module = reader.read(proto_no_pkg.to_str().unwrap()).await; - assert!(config_module.is_err()); - Ok(()) - } -} diff --git a/src/proto_reader/fetch.rs b/src/proto_reader/fetch.rs new file mode 100644 index 0000000000..deabef7d0f --- /dev/null +++ b/src/proto_reader/fetch.rs @@ -0,0 +1,310 @@ +use anyhow::{Context, Result}; +use base64::prelude::BASE64_STANDARD; +use base64::Engine; +use hyper::header::HeaderName; +use nom::AsBytes; +use prost::Message; +use prost_reflect::prost_types::{FileDescriptorProto, FileDescriptorSet}; +use serde::{Deserialize, Serialize}; +use serde_json::json; + +use crate::blueprint::GrpcMethod; +use crate::config::ConfigReaderContext; +use crate::grpc::protobuf::ProtobufSet; +use crate::grpc::RequestTemplate; +use crate::mustache::Mustache; +use crate::runtime::TargetRuntime; + +/// +/// Loading reflection proto +/// https://github.com/grpc/grpc/blob/master/src/proto/grpc/reflection/v1alpha/reflection.proto +const REFLECTION_PROTO: &str = include_str!(concat!( + env!("CARGO_MANIFEST_DIR"), + "/src/proto_reader/proto/reflection.proto" +)); + +/// This function is just used for better exception handling +fn get_protobuf_set() -> Result { + let descriptor = protox_parse::parse("reflection", REFLECTION_PROTO)?; + let mut descriptor_set = FileDescriptorSet::default(); + descriptor_set.file.push(descriptor); + ProtobufSet::from_proto_file(descriptor_set) +} + +#[derive(Debug, Serialize, Deserialize)] +struct Service { + name: String, +} + +#[derive(Debug, Serialize, Deserialize)] +struct ListServicesResponse { + service: Vec, +} + +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct FileDescriptorProtoResponse { + file_descriptor_proto: Vec, +} + +impl FileDescriptorProtoResponse { + fn get(self) -> Result> { + let file_descriptor_proto = self + .file_descriptor_proto + .first() + .context("Received empty fileDescriptorProto")?; + + BASE64_STANDARD + .decode(file_descriptor_proto) + .context("Failed to decode fileDescriptorProto from BASE64") + } +} + +/// Used for serializing all kinds of GRPC Reflection responses +#[derive(Debug, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct ReflectionResponse { + list_services_response: Option, + file_descriptor_response: Option, +} + +pub struct GrpcReflection { + server_reflection_method: GrpcMethod, + url: String, + target_runtime: TargetRuntime, +} + +impl GrpcReflection { + pub fn new>(url: T, target_runtime: TargetRuntime) -> Self { + let server_reflection_method = GrpcMethod { + package: "grpc.reflection.v1alpha".to_string(), + service: "ServerReflection".to_string(), + name: "ServerReflectionInfo".to_string(), + }; + Self { + server_reflection_method, + url: url.as_ref().to_string(), + target_runtime, + } + } + /// Makes `ListService` request to the grpc reflection server + pub async fn list_all_files(&self) -> Result> { + // Extracting names from services + let methods: Vec = self + .execute(json!({"list_services": ""})) + .await? + .list_services_response + .context("Couldn't find definitions for service ServerReflection")? + .service + .iter() + .map(|s| s.name.clone()) + .collect(); + + Ok(methods) + } + + /// Makes `Get Service` request to the grpc reflection server + pub async fn get_by_service(&self, service: &str) -> Result { + let resp = self + .execute(json!({"file_containing_symbol": service})) + .await?; + + request_proto(resp).await + } + + async fn execute(&self, body: serde_json::Value) -> Result { + let server_reflection_method = &self.server_reflection_method; + let protobuf_set = get_protobuf_set()?; + let reflection_service = protobuf_set.find_service(server_reflection_method)?; + let operation = reflection_service.find_operation(server_reflection_method)?; + let mut url: url::Url = self.url.parse()?; + url.set_path( + format!( + "{}.{}/{}", + server_reflection_method.package, + server_reflection_method.service, + server_reflection_method.name + ) + .as_str(), + ); + let req_template = RequestTemplate { + url: Mustache::parse(url.as_str())?, + headers: vec![( + HeaderName::from_static("content-type"), + Mustache::parse("application/grpc+proto")?, + )], + body: Mustache::parse(body.to_string().as_str()).ok(), + operation: operation.clone(), + operation_type: Default::default(), + }; + + let ctx = ConfigReaderContext { + runtime: &self.target_runtime, + vars: &Default::default(), + headers: Default::default(), + }; + + let req = req_template.render(&ctx)?.to_request()?; + + let resp = self.target_runtime.http.execute(req).await?; + let body = resp.body.as_bytes(); + + let response: ReflectionResponse = operation.convert_output(body)?; + Ok(response) + } +} + +/// For extracting `FileDescriptorProto` from `CustomResponse` +async fn request_proto(response: ReflectionResponse) -> Result { + let file_descriptor_resp = response + .file_descriptor_response + .context("Expected fileDescriptorResponse but found none")?; + let file_descriptor_proto = + FileDescriptorProto::decode(file_descriptor_resp.get()?.as_bytes())?; + + Ok(file_descriptor_proto) +} + +#[cfg(test)] +mod grpc_fetch { + use std::path::PathBuf; + + use anyhow::Result; + + use super::*; + + fn get_fake_descriptor() -> Vec { + let mut path = PathBuf::from(file!()); + path.pop(); + path.push("fixtures/descriptor_b64.txt"); + + let bytes = std::fs::read(path).unwrap(); + + BASE64_STANDARD.decode(bytes).unwrap() + } + + fn get_fake_resp() -> Vec { + let mut path = PathBuf::from(file!()); + path.pop(); + path.push("fixtures/response_b64.txt"); + + let bytes = std::fs::read(path).unwrap(); + + BASE64_STANDARD.decode(bytes).unwrap() + } + + fn start_mock_server() -> httpmock::MockServer { + httpmock::MockServer::start() + } + + #[tokio::test] + async fn test_resp_service() -> Result<()> { + let server = start_mock_server(); + + let http_reflection_file_mock = server.mock(|when, then| { + when.method(httpmock::Method::POST) + .path("/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo") + .body("\0\0\0\0\x12\"\x10news.NewsService"); + then.status(200).body(get_fake_descriptor()); + }); + + let grpc_reflection = GrpcReflection::new( + format!("http://localhost:{}", server.port()), + crate::runtime::test::init(None), + ); + + let runtime = crate::runtime::test::init(None); + let resp = grpc_reflection.get_by_service("news.NewsService").await?; + + let content = runtime.file.read(tailcall_fixtures::protobuf::NEWS).await?; + let expected = protox_parse::parse("news.proto", &content)?; + + assert_eq!(expected.name(), resp.name()); + + http_reflection_file_mock.assert(); + Ok(()) + } + + #[tokio::test] + async fn test_resp_list_all() -> Result<()> { + let server = start_mock_server(); + + let http_reflection_list_all = server.mock(|when, then| { + when.method(httpmock::Method::POST) + .path("/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo") + .body("\0\0\0\0\x02:\0"); + then.status(200).body(get_fake_resp()); + }); + + let runtime = crate::runtime::test::init(None); + + let grpc_reflection = + GrpcReflection::new(format!("http://localhost:{}", server.port()), runtime); + + let resp = grpc_reflection.list_all_files().await?; + + assert_eq!( + [ + "news.NewsService".to_string(), + "grpc.reflection.v1alpha.ServerReflection".to_string() + ] + .to_vec(), + resp + ); + + http_reflection_list_all.assert(); + + Ok(()) + } + + #[tokio::test] + async fn test_list_all_files_empty_response() -> Result<()> { + let server = start_mock_server(); + + let http_reflection_list_all_empty = server.mock(|when, then| { + when.method(httpmock::Method::POST) + .path("/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo") + .body("\0\0\0\0\x02:\0"); + then.status(200).body("\0\0\0\0\x02:\0"); // Mock an empty response + }); + + let runtime = crate::runtime::test::init(None); + + let grpc_reflection = + GrpcReflection::new(format!("http://localhost:{}", server.port()), runtime); + + let resp = grpc_reflection.list_all_files().await; + + assert_eq!( + "Couldn't find definitions for service ServerReflection", + resp.err().unwrap().to_string() + ); + + http_reflection_list_all_empty.assert(); + + Ok(()) + } + + #[tokio::test] + async fn test_get_by_service_not_found() -> Result<()> { + let server = start_mock_server(); + + let http_reflection_service_not_found = server.mock(|when, then| { + when.method(httpmock::Method::POST) + .path("/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo"); + then.status(404); // Mock a 404 not found response + }); + + let runtime = crate::runtime::test::init(None); + + let grpc_reflection = + GrpcReflection::new(format!("http://localhost:{}", server.port()), runtime); + + let result = grpc_reflection.get_by_service("nonexistent.Service").await; + assert!(result.is_err()); + + http_reflection_service_not_found.assert(); + + Ok(()) + } +} diff --git a/src/proto_reader/fixtures/descriptor_b64.txt b/src/proto_reader/fixtures/descriptor_b64.txt new file mode 100644 index 0000000000..8f93ea0ced --- /dev/null +++ b/src/proto_reader/fixtures/descriptor_b64.txt @@ -0,0 +1 @@ +AAAABVgSEiIQbmV3cy5OZXdzU2VydmljZSLBCgq+CgoKbmV3cy5wcm90bxIEbmV3cxobZ29vZ2xlL3Byb3RvYnVmL2VtcHR5LnByb3RvIkIKBE5ld3MSCgoCaWQYASABKAUSDQoFdGl0bGUYAiABKAkSDAoEYm9keRgDIAEoCRIRCglwb3N0SW1hZ2UYBCABKAkiFAoGTmV3c0lkEgoKAmlkGAEgASgFIiMKDk11bHRpcGxlTmV3c0lkEhEKA2lkcxgBIAMyBk5ld3NJZCIcCghOZXdzTGlzdBIQCgRuZXdzGAEgAzIETmV3czLeAQoLTmV3c1NlcnZpY2USLQoKR2V0QWxsTmV3cxIVZ29vZ2xlLnByb3RvYnVmLkVtcHR5GghOZXdzTGlzdBIXCgdHZXROZXdzEgZOZXdzSWQaBE5ld3MSKwoPR2V0TXVsdGlwbGVOZXdzEg5NdWx0aXBsZU5ld3NJZBoITmV3c0xpc3QSKwoKRGVsZXRlTmV3cxIGTmV3c0lkGhVnb29nbGUucHJvdG9idWYuRW1wdHkSFgoIRWRpdE5ld3MSBE5ld3MaBE5ld3MSFQoHQWRkTmV3cxIETmV3cxoETmV3c0qGBwoGEgQAACABCggKAQISAwQADQoJCgIDABIDAgAlCgoKAgQAEgQGAAsBCgoKAwQAARIDBggMCgsKBAQAAgASAwcEEQoMCgUEAAIAARIDBwoMCgwKBQQAAgADEgMHDxAKDAoFBAACAAUSAwcECQoLCgQEAAIBEgMIBBUKDAoFBAACAQESAwgLEAoMCgUEAAIBAxIDCBMUCgwKBQQAAgEFEgMIBAoKCwoEBAACAhIDCQQUCgwKBQQAAgIBEgMJCw8KDAoFBAACAgMSAwkSEwoMCgUEAAICBRIDCQQKCgsKBAQAAgMSAwoEGQoMCgUEAAIDARIDCgsUCgwKBQQAAgMDEgMKFxgKDAoFBAACAwUSAwoECgoKCgIEARIEFgAYAQoKCgMEAQESAxYIDgoLCgQEAQIAEgMXBBEKDAoFBAECAAESAxcKDAoMCgUEAQIAAxIDFw8QCgwKBQQBAgAFEgMXBAkKCgoCBAISBBoAHAEKCgoDBAIBEgMaCBYKCwoEBAICABIDGwQcCgwKBQQCAgABEgMbFBcKDAoFBAICAAMSAxsaGwoMCgUEAgIABBIDGwQMCgwKBQQCAgAGEgMbDRMKCgoCBAMSBB4AIAEKCgoDBAMBEgMeCBAKCwoEBAMCABIDHwMaCgwKBQQDAgABEgMfERUKDAoFBAMCAAMSAx8YGQoMCgUEAwIABBIDHwMLCgwKBQQDAgAGEgMfDBAKCgoCBgASBA0AFAEKCgoDBgABEgMNCBMKCwoEBgACABIDDgRACgwKBQYAAgABEgMOCBIKDAoFBgACAAISAw4UKQoMCgUGAAIAAxIDDjQ8CgsKBAYAAgESAw8EKgoMCgUGAAIBARIDDwgPCgwKBQYAAgECEgMPERcKDAoFBgACAQMSAw8iJgoLCgQGAAICEgMQBD4KDAoFBgACAgESAxAIFwoMCgUGAAICAhIDEBknCgwKBQYAAgIDEgMQMjoKCwoEBgACAxIDEQQ+CgwKBQYAAgMBEgMRCBIKDAoFBgACAwISAxEUGgoMCgUGAAIDAxIDESU6CgsKBAYAAgQSAxIEKQoMCgUGAAIEARIDEggQCgwKBQYAAgQCEgMSEhYKDAoFBgACBAMSAxIhJQoLCgQGAAIFEgMTBCgKDAoFBgACBQESAxMIDwoMCgUGAAIFAhIDExEVCgwKBQYAAgUDEgMTICQKCAoBDBIDAAASYgZwcm90bzM= \ No newline at end of file diff --git a/src/proto_reader/fixtures/response_b64.txt b/src/proto_reader/fixtures/response_b64.txt new file mode 100644 index 0000000000..a989c3aec2 --- /dev/null +++ b/src/proto_reader/fixtures/response_b64.txt @@ -0,0 +1 @@ +AAAAAEYSAjoAMkAKEgoQbmV3cy5OZXdzU2VydmljZQoqCihncnBjLnJlZmxlY3Rpb24udjFhbHBoYS5TZXJ2ZXJSZWZsZWN0aW9u \ No newline at end of file diff --git a/src/proto_reader/mod.rs b/src/proto_reader/mod.rs new file mode 100644 index 0000000000..06af656e55 --- /dev/null +++ b/src/proto_reader/mod.rs @@ -0,0 +1,3 @@ +pub use reader::*; +mod fetch; +mod reader; diff --git a/src/proto_reader/proto/reflection.proto b/src/proto_reader/proto/reflection.proto new file mode 100644 index 0000000000..462e85a222 --- /dev/null +++ b/src/proto_reader/proto/reflection.proto @@ -0,0 +1,136 @@ +// Copyright 2016 gRPC authors. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Service exported by server reflection + +syntax = "proto3"; + +package grpc.reflection.v1alpha; + +service ServerReflection { + // The reflection service is structured as a bidirectional stream, ensuring + // all related requests go to a single server. + rpc ServerReflectionInfo(stream ServerReflectionRequest) + returns (stream ServerReflectionResponse); +} + +// The message sent by the client when calling ServerReflectionInfo method. +message ServerReflectionRequest { + string host = 1; + // To use reflection service, the client should set one of the following + // fields in message_request. The server distinguishes requests by their + // defined field and then handles them using corresponding methods. + oneof message_request { + // Find a proto file by the file name. + string file_by_filename = 3; + + // Find the proto file that declares the given fully-qualified symbol name. + // This field should be a fully-qualified symbol name + // (e.g. .[.] or .). + string file_containing_symbol = 4; + + // Find the proto file which defines an extension extending the given + // message type with the given field number. + ExtensionRequest file_containing_extension = 5; + + // Finds the tag numbers used by all known extensions of the given message + // type, and appends them to ExtensionNumberResponse in an undefined order. + // Its corresponding method is best-effort: it's not guaranteed that the + // reflection service will implement this method, and it's not guaranteed + // that this method will provide all extensions. Returns + // StatusCode::UNIMPLEMENTED if it's not implemented. + // This field should be a fully-qualified type name. The format is + // . + string all_extension_numbers_of_type = 6; + + // List the full names of registered services. The content will not be + // checked. + string list_services = 7; + } +} + +// The type name and extension number sent by the client when requesting +// file_containing_extension. +message ExtensionRequest { + // Fully-qualified type name. The format should be . + string containing_type = 1; + int32 extension_number = 2; +} + +// The message sent by the server to answer ServerReflectionInfo method. +message ServerReflectionResponse { + string valid_host = 1; + ServerReflectionRequest original_request = 2; + // The server set one of the following fields accroding to the message_request + // in the request. + oneof message_response { + // This message is used to answer file_by_filename, file_containing_symbol, + // file_containing_extension requests with transitive dependencies. As + // the repeated label is not allowed in oneof fields, we use a + // FileDescriptorResponse message to encapsulate the repeated fields. + // The reflection service is allowed to avoid sending FileDescriptorProtos + // that were previously sent in response to earlier requests in the stream. + FileDescriptorResponse file_descriptor_response = 4; + + // This message is used to answer all_extension_numbers_of_type requst. + ExtensionNumberResponse all_extension_numbers_response = 5; + + // This message is used to answer list_services request. + ListServiceResponse list_services_response = 6; + + // This message is used when an error occurs. + ErrorResponse error_response = 7; + } +} + +// Serialized FileDescriptorProto messages sent by the server answering +// a file_by_filename, file_containing_symbol, or file_containing_extension +// request. +message FileDescriptorResponse { + // Serialized FileDescriptorProto messages. We avoid taking a dependency on + // descriptor.proto, which uses proto2 only features, by making them opaque + // bytes instead. + repeated bytes file_descriptor_proto = 1; +} + +// A list of extension numbers sent by the server answering +// all_extension_numbers_of_type request. +message ExtensionNumberResponse { + // Full name of the base type, including the package name. The format + // is . + string base_type_name = 1; + repeated int32 extension_number = 2; +} + +// A list of ServiceResponse sent by the server answering list_services request. +message ListServiceResponse { + // The information of each service may be expanded in the future, so we use + // ServiceResponse message to encapsulate it. + repeated ServiceResponse service = 1; +} + +// The information of a single service used by ListServiceResponse to answer +// list_services request. +message ServiceResponse { + // Full name of a registered service, including its package name. The format + // is . + string name = 1; +} + +// The error code and error message sent by the server when an error occurs. +message ErrorResponse { + // This field uses the error codes defined in grpc::StatusCode. + int32 error_code = 1; + string error_message = 2; +} \ No newline at end of file diff --git a/src/proto_reader/reader.rs b/src/proto_reader/reader.rs new file mode 100644 index 0000000000..8b3327f06a --- /dev/null +++ b/src/proto_reader/reader.rs @@ -0,0 +1,211 @@ +use std::collections::{HashMap, VecDeque}; +use std::path::{Path, PathBuf}; + +use anyhow::Context; +use futures_util::future::join_all; +use prost_reflect::prost_types::{FileDescriptorProto, FileDescriptorSet}; +use protox::file::{FileResolver, GoogleFileResolver}; + +use crate::proto_reader::fetch::GrpcReflection; +use crate::resource_reader::{Cached, ResourceReader}; +use crate::runtime::TargetRuntime; + +pub struct ProtoReader { + reader: ResourceReader, + runtime: TargetRuntime, +} + +pub struct ProtoMetadata { + pub descriptor_set: FileDescriptorSet, + pub path: String, +} + +impl ProtoReader { + /// Initializes the proto reader with a resource reader and target runtime + pub fn init(reader: ResourceReader, runtime: TargetRuntime) -> Self { + Self { reader, runtime } + } + + /// Fetches proto files from a grpc server (grpc reflection) + pub async fn fetch>(&self, url: T) -> anyhow::Result> { + let grpc_reflection = GrpcReflection::new(url.as_ref(), self.runtime.clone()); + + let mut proto_metadata = vec![]; + let service_list = grpc_reflection.list_all_files().await?; + for service in service_list { + if service.eq("grpc.reflection.v1alpha.ServerReflection") { + continue; + } + let file_descriptor_proto = grpc_reflection.get_by_service(&service).await?; + Self::check_package(&file_descriptor_proto)?; + let descriptors = self.resolve(file_descriptor_proto, None).await?; + let metadata = ProtoMetadata { + descriptor_set: FileDescriptorSet { file: descriptors }, + path: url.as_ref().to_string(), + }; + proto_metadata.push(metadata); + } + Ok(proto_metadata) + } + + /// Asynchronously reads all proto files from a list of paths + pub async fn read_all>(&self, paths: &[T]) -> anyhow::Result> { + let resolved_protos = join_all(paths.iter().map(|v| self.read(v.as_ref()))) + .await + .into_iter() + .collect::>>()?; + Ok(resolved_protos) + } + + /// Reads a proto file from a path + pub async fn read>(&self, path: T) -> anyhow::Result { + let file_read = self.read_proto(path.as_ref(), None).await?; + Self::check_package(&file_read)?; + + let descriptors = self + .resolve(file_read, PathBuf::from(path.as_ref()).parent()) + .await?; + let metadata = ProtoMetadata { + descriptor_set: FileDescriptorSet { file: descriptors }, + path: path.as_ref().to_string(), + }; + Ok(metadata) + } + + /// Performs BFS to import all nested proto files + async fn resolve( + &self, + parent_proto: FileDescriptorProto, + parent_path: Option<&Path>, + ) -> anyhow::Result> { + let mut descriptors: HashMap = HashMap::new(); + let mut queue = VecDeque::new(); + queue.push_back(parent_proto.clone()); + + while let Some(file) = queue.pop_front() { + let futures: Vec<_> = file + .dependency + .iter() + .map(|import| self.read_proto(import, parent_path)) + .collect(); + + let results = join_all(futures).await; + + for result in results { + let proto = result?; + if descriptors.get(proto.name()).is_none() { + queue.push_back(proto.clone()); + descriptors.insert(proto.name().to_string(), proto); + } + } + } + + let mut descriptors_vec = descriptors + .into_values() + .collect::>(); + descriptors_vec.push(parent_proto); + Ok(descriptors_vec) + } + + /// Tries to load well-known google proto files and if not found uses normal + /// file and http IO to resolve them + async fn read_proto>( + &self, + path: T, + parent_dir: Option<&Path>, + ) -> anyhow::Result { + let content = if let Ok(file) = GoogleFileResolver::new().open_file(path.as_ref()) { + file.source() + .context("Unable to extract content of google well-known proto file")? + .to_string() + } else { + let path = Self::resolve_path(path.as_ref(), parent_dir); + self.reader.read_file(path).await?.content + }; + Ok(protox_parse::parse(path.as_ref(), &content)?) + } + /// Checks if path is absolute else it joins file path with relative dir + /// path + fn resolve_path(src: &str, root_dir: Option<&Path>) -> String { + if src.starts_with("http") { + return src.to_string(); + } + + if Path::new(&src).is_absolute() { + src.to_string() + } else if let Some(path) = root_dir { + path.join(src).to_string_lossy().to_string() + } else { + src.to_string() + } + } + fn check_package(proto: &FileDescriptorProto) -> anyhow::Result<()> { + if proto.package.is_none() { + anyhow::bail!("Package name is required"); + } + Ok(()) + } +} + +#[cfg(test)] +mod test_proto_config { + use std::path::{Path, PathBuf}; + + use anyhow::Result; + use pretty_assertions::assert_eq; + use tailcall_fixtures::protobuf; + + use crate::proto_reader::ProtoReader; + use crate::resource_reader::{Cached, ResourceReader}; + + #[tokio::test] + async fn test_resolve() { + // Skipping IO tests as they are covered in reader.rs + let runtime = crate::runtime::test::init(None); + let reader = ProtoReader::init(ResourceReader::::cached(runtime.clone()), runtime); + reader + .read_proto("google/protobuf/empty.proto", None) + .await + .unwrap(); + } + + #[tokio::test] + async fn test_nested_imports() -> Result<()> { + let test_dir = Path::new(protobuf::SELF); + let test_file = protobuf::NESTED_0; + + let runtime = crate::runtime::test::init(None); + let file_rt = runtime.file.clone(); + + let reader = ProtoReader::init(ResourceReader::::cached(runtime.clone()), runtime); + let helper_map = reader + .resolve(reader.read_proto(&test_file, None).await?, Some(test_dir)) + .await?; + let files = test_dir.read_dir()?; + for file in files { + let path = file?.path(); + let path = path.to_string_lossy(); + let source = file_rt.read(&path).await?; + let expected = protox_parse::parse(&path, &source)?; + let actual = helper_map + .iter() + .find(|v| v.package.eq(&expected.package)) + .unwrap(); + + assert_eq!(&expected.dependency, &actual.dependency); + } + + Ok(()) + } + + #[tokio::test] + async fn test_proto_no_pkg() -> Result<()> { + let runtime = crate::runtime::test::init(None); + let reader = ProtoReader::init(ResourceReader::::cached(runtime.clone()), runtime); + let proto_no_pkg = + PathBuf::from(tailcall_fixtures::configs::SELF).join("proto_no_pkg.graphql"); + let config_module = reader.read(proto_no_pkg.to_str().unwrap()).await; + assert!(config_module.is_err()); + Ok(()) + } +} diff --git a/src/resource_reader.rs b/src/resource_reader.rs index f633ff3f2f..291765245b 100644 --- a/src/resource_reader.rs +++ b/src/resource_reader.rs @@ -1,3 +1,6 @@ +use std::collections::HashMap; +use std::sync::{Arc, Mutex}; + use futures_util::future::join_all; use futures_util::TryFutureExt; use url::Url; @@ -11,16 +14,58 @@ pub struct FileRead { pub path: String, } -pub struct ResourceReader { +#[derive(Clone)] +pub struct ResourceReader(A); + +impl ResourceReader { + /// Reads all the files in parallel + pub async fn read_files( + &self, + files: &[T], + ) -> anyhow::Result> { + let files = files.iter().map(|x| { + self.read_file(x.to_string()) + .map_err(|e| e.context(x.to_string())) + }); + let content = join_all(files) + .await + .into_iter() + .collect::>>()?; + Ok(content) + } + + pub async fn read_file(&self, file: T) -> anyhow::Result { + self.0.read(file).await + } +} + +impl ResourceReader { + pub fn cached(runtime: TargetRuntime) -> Self { + ResourceReader(Cached::init(runtime)) + } +} + +#[async_trait::async_trait] +pub trait Reader { + async fn read(&self, file: T) -> anyhow::Result; +} + +/// Reads the files directly from the filesystem or from an HTTP URL +#[derive(Clone)] +pub struct Direct { runtime: TargetRuntime, } -impl ResourceReader { +impl Direct { pub fn init(runtime: TargetRuntime) -> Self { Self { runtime } } +} + +#[async_trait::async_trait] +impl Reader for Direct { /// Reads a file from the filesystem or from an HTTP URL - pub async fn read_file(&self, file: T) -> anyhow::Result { + async fn read(&self, file: T) -> anyhow::Result { // Is an HTTP URL let content = if let Ok(url) = Url::parse(&file.to_string()) { if url.scheme().starts_with("http") { @@ -41,20 +86,49 @@ impl ResourceReader { self.runtime.file.read(&file.to_string()).await? }; - Ok(FileRead { content, path: file.to_string() }) } +} - /// Reads all the files in parallel - pub async fn read_files(&self, files: &[T]) -> anyhow::Result> { - let files = files.iter().map(|x| { - self.read_file(x.to_string()) - .map_err(|e| e.context(x.to_string())) - }); - let content = join_all(files) - .await - .into_iter() - .collect::>>()?; - Ok(content) +/// Reads the files from the filesystem or from an HTTP URL with cache +#[derive(Clone)] +pub struct Cached { + direct: Direct, + // Cache file content, path -> content + cache: Arc>>, +} + +impl Cached { + pub fn init(runtime: TargetRuntime) -> Self { + Self { direct: Direct::init(runtime), cache: Default::default() } + } +} + +#[async_trait::async_trait] +impl Reader for Cached { + /// Reads a file from the filesystem or from an HTTP URL with cache + async fn read(&self, file: T) -> anyhow::Result { + // check cache + let file_path = file.to_string(); + let content = self + .cache + .as_ref() + .lock() + .unwrap() + .get(&file_path) + .map(|v| v.to_owned()); + let content = if let Some(content) = content { + content.to_owned() + } else { + let file_read = self.direct.read(file.to_string()).await?; + self.cache + .as_ref() + .lock() + .unwrap() + .insert(file_path.to_owned(), file_read.content.clone()); + file_read.content + }; + + Ok(FileRead { content, path: file_path }) } } diff --git a/tailcall-autogen/Cargo.toml b/tailcall-autogen/Cargo.toml index 009bc608e6..826bfe08db 100644 --- a/tailcall-autogen/Cargo.toml +++ b/tailcall-autogen/Cargo.toml @@ -9,8 +9,8 @@ edition = "2021" [dependencies] anyhow = "1.0.82" lazy_static = "1.4.0" -schemars = "0.8.16" -serde = "1.0.198" +schemars = "0.8.17" +serde = "1.0.199" serde_json = "1.0.116" tailcall = { path = "../" } tokio = { version = "1.37.0", features = ["full"] } diff --git a/tailcall-aws-lambda/Cargo.toml b/tailcall-aws-lambda/Cargo.toml index 7ea6c02822..b42f167c0c 100644 --- a/tailcall-aws-lambda/Cargo.toml +++ b/tailcall-aws-lambda/Cargo.toml @@ -20,10 +20,10 @@ lambda_runtime = "0.11.1" tokio = { version = "1", features = ["macros", "fs"] } tracing = { version = "0.1", features = ["log"] } tracing-subscriber = { version = "0.3", default-features = false, features = ["fmt"] } -dotenvy = "0.15" +dotenvy = "0.15.7" anyhow = "1.0.82" async-trait = "0.1.80" -hyper = { version = "0.14", default-features = false } +hyper = { version = "0.14.28", default-features = false } reqwest = { version = "0.11", default-features = false } tailcall = { path = "..", default-features = false } diff --git a/tailcall-cloudflare/Cargo.toml b/tailcall-cloudflare/Cargo.toml index 8416f224aa..9438cdbb99 100644 --- a/tailcall-cloudflare/Cargo.toml +++ b/tailcall-cloudflare/Cargo.toml @@ -9,8 +9,8 @@ edition = "2021" crate-type = ["cdylib", "rlib"] [dependencies] -hyper = { version = "0.14", default-features = false } -worker = "0.1.0" +hyper = { version = "0.14.28", default-features = false } +worker = "0.2.0" tailcall = { path = "..", default-features = false } lazy_static = "1.4.0" anyhow = "1.0.82" diff --git a/tailcall-cloudflare/package-lock.json b/tailcall-cloudflare/package-lock.json index 5d1351d6a0..03161d2c67 100644 --- a/tailcall-cloudflare/package-lock.json +++ b/tailcall-cloudflare/package-lock.json @@ -15,18 +15,21 @@ } }, "node_modules/@cloudflare/kv-asset-handler": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.1.tgz", - "integrity": "sha512-lKN2XCfKCmpKb86a1tl4GIwsJYDy9TGuwjhDELLmpKygQhw8X2xR4dusgpC5Tg7q1pB96Eb0rBo81kxSILQMwA==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.2.tgz", + "integrity": "sha512-EeEjMobfuJrwoctj7FA1y1KEbM0+Q1xSjobIEyie9k4haVEBB7vkDvsasw1pM3rO39mL2akxIAzLMUAtrMHZhA==", "dev": true, "dependencies": { "mime": "^3.0.0" + }, + "engines": { + "node": ">=16.13" } }, "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240405.0.tgz", - "integrity": "sha512-ut8kwpHmlz9dNSjoov6v1b6jS50J46Mj9QcMA0t1Hne36InaQk/qqPSd12fN5p2GesZ9OOBJvBdDsTblVdyJ1w==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240419.0.tgz", + "integrity": "sha512-PGVe9sYWULHfvGhN0IZh8MsskNG/ufnBSqPbgFCxJHCTrVXLPuC35EoVaforyqjKRwj3U35XMyGo9KHcGnTeHQ==", "cpu": [ "x64" ], @@ -40,9 +43,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240405.0.tgz", - "integrity": "sha512-x3A3Ym+J2DH1uYnw0aedeKOTnUebEo312+Aladv7bFri97pjRJcqVbYhMtOHLkHjwYn7bpKSY2eL5iM+0XT29A==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240419.0.tgz", + "integrity": "sha512-z4etQSPiD5Gcjs962LiC7ZdmXnN6SGof5KrYoFiSI9X9kUvpuGH/lnjVVPd+NnVNeDU2kzmcAIgyZjkjTaqVXQ==", "cpu": [ "arm64" ], @@ -56,9 +59,9 @@ } }, "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240405.0.tgz", - "integrity": "sha512-3tYpfjtxEQ0R30Pna7OF3Bz0CTx30hc0QNtH61KnkvXtaeYMkWutSKQKXIuVlPa/7v1MHp+8ViBXMflmS7HquA==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240419.0.tgz", + "integrity": "sha512-lBwhg0j3sYTFMsEb4bOClbVje8nqrYOu0H3feQlX+Eks94JIhWPkf8ywK4at/BUc1comPMhCgzDHwc2OMPUGgg==", "cpu": [ "x64" ], @@ -72,9 +75,9 @@ } }, "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240405.0.tgz", - "integrity": "sha512-NpKZlvmdgcX/m4tP5zM91AfJpZrue2/GRA+Sl3szxAivu2uE5jDVf5SS9dzqzCVfPrdhylqH7yeL4U/cafFNOg==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240419.0.tgz", + "integrity": "sha512-ZMY6wwWkxL+WPq8ydOp/irSYjAnMhBz1OC1+4z+OANtDs2beaZODmq7LEB3hb5WUAaTPY7DIjZh3DfDfty0nYg==", "cpu": [ "arm64" ], @@ -88,9 +91,9 @@ } }, "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240405.0.tgz", - "integrity": "sha512-REBeJMxvUCjwuEVzSSIBtzAyM69QjToab8qBst0S9vdih+9DObym4dw8CevdBQhDbFrHiyL9E6pAZpLPNHVgCw==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240419.0.tgz", + "integrity": "sha512-YJjgaJN2yGTkV7Cr4K3i8N4dUwVQTclT3Pr3NpRZCcLjTszwlE53++XXDnHMKGXBbSguIizaVbmcU2EtmIXyeQ==", "cpu": [ "x64" ], @@ -104,9 +107,9 @@ } }, "node_modules/@cloudflare/workers-types": { - "version": "4.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240405.0.tgz", - "integrity": "sha512-sEVOhyOgXUwfLkgHqbLZa/sfkSYrh7/zLmI6EZNibPaVPvAnAcItbNNl3SAlLyLKuwf8m4wAIAgu9meKWCvXjg==", + "version": "4.20240423.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240423.0.tgz", + "integrity": "sha512-ssuccb3j+URp6mP2p0PcQE9vmS3YeKBQnALHF9P3yQfUAFozuhTsDTbqmL+zPrJvUcG7SL2xVQkNDF9QJeKDZw==", "dev": true }, "node_modules/@cspotcode/source-map-support": { @@ -764,12 +767,6 @@ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, - "node_modules/@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, "node_modules/@types/node": { "version": "20.11.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz", @@ -789,13 +786,13 @@ } }, "node_modules/@vitest/expect": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.5.0.tgz", - "integrity": "sha512-0pzuCI6KYi2SIC3LQezmxujU9RK/vwC1U9R0rLuGlNGcOuDWxqWKu6nUdFsX9tH1WU0SXtAxToOsEjeUn1s3hA==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.5.3.tgz", + "integrity": "sha512-y+waPz31pOFr3rD7vWTbwiLe5+MgsMm40jTZbQE8p8/qXyBX3CQsIXRx9XK12IbY7q/t5a5aM/ckt33b4PxK2g==", "dev": true, "dependencies": { - "@vitest/spy": "1.5.0", - "@vitest/utils": "1.5.0", + "@vitest/spy": "1.5.3", + "@vitest/utils": "1.5.3", "chai": "^4.3.10" }, "funding": { @@ -803,12 +800,12 @@ } }, "node_modules/@vitest/runner": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.5.0.tgz", - "integrity": "sha512-7HWwdxXP5yDoe7DTpbif9l6ZmDwCzcSIK38kTSIt6CFEpMjX4EpCgT6wUmS0xTXqMI6E/ONmfgRKmaujpabjZQ==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.5.3.tgz", + "integrity": "sha512-7PlfuReN8692IKQIdCxwir1AOaP5THfNkp0Uc4BKr2na+9lALNit7ub9l3/R7MP8aV61+mHKRGiqEKRIwu6iiQ==", "dev": true, "dependencies": { - "@vitest/utils": "1.5.0", + "@vitest/utils": "1.5.3", "p-limit": "^5.0.0", "pathe": "^1.1.1" }, @@ -817,9 +814,9 @@ } }, "node_modules/@vitest/snapshot": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.5.0.tgz", - "integrity": "sha512-qpv3fSEuNrhAO3FpH6YYRdaECnnRjg9VxbhdtPwPRnzSfHVXnNzzrpX4cJxqiwgRMo7uRMWDFBlsBq4Cr+rO3A==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.5.3.tgz", + "integrity": "sha512-K3mvIsjyKYBhNIDujMD2gfQEzddLe51nNOAf45yKRt/QFJcUIeTQd2trRvv6M6oCBHNVnZwFWbQ4yj96ibiDsA==", "dev": true, "dependencies": { "magic-string": "^0.30.5", @@ -831,9 +828,9 @@ } }, "node_modules/@vitest/spy": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.5.0.tgz", - "integrity": "sha512-vu6vi6ew5N5MMHJjD5PoakMRKYdmIrNJmyfkhRpQt5d9Ewhw9nZ5Aqynbi3N61bvk9UvZ5UysMT6ayIrZ8GA9w==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.5.3.tgz", + "integrity": "sha512-Llj7Jgs6lbnL55WoshJUUacdJfjU2honvGcAJBxhra5TPEzTJH8ZuhI3p/JwqqfnTr4PmP7nDmOXP53MS7GJlg==", "dev": true, "dependencies": { "tinyspy": "^2.2.0" @@ -843,9 +840,9 @@ } }, "node_modules/@vitest/utils": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.5.0.tgz", - "integrity": "sha512-BDU0GNL8MWkRkSRdNFvCUCAVOeHaUlVJ9Tx0TYBZyXaaOTmGtUFObzchCivIBrIwKzvZA7A9sCejVhXM2aY98A==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.5.3.tgz", + "integrity": "sha512-rE9DTN1BRhzkzqNQO+kw8ZgfeEBCLXiHJwetk668shmNBpSagQxneT5eSqEBLP+cqSiAeecvQmbpFfdMyLcIQA==", "dev": true, "dependencies": { "diff-sequences": "^29.6.3", @@ -921,12 +918,6 @@ "node": "*" } }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, "node_modules/binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -942,15 +933,6 @@ "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", "dev": true }, - "node_modules/brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0" - } - }, "node_modules/braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", @@ -1039,15 +1021,6 @@ "fsevents": "~2.3.2" } }, - "node_modules/commander": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", - "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", - "dev": true, - "engines": { - "node": ">=18" - } - }, "node_modules/cookie": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", @@ -1221,12 +1194,6 @@ "node": ">=8" } }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, "node_modules/fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -1281,25 +1248,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -1339,22 +1287,6 @@ "node": ">=16.17.0" } }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, "node_modules/is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -1433,18 +1365,6 @@ "integrity": "sha512-UfJMcSJc+SEXEl9lH/VLHSZbThQyLpw1vLO1Lb+j4RWDvG3N2f7yj3PVQA3cmkTBNldJ9eFnM+xEXxHIXrYiJw==", "dev": true }, - "node_modules/json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true, - "bin": { - "json5": "lib/cli.js" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/jsonc-parser": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", @@ -1519,9 +1439,9 @@ } }, "node_modules/miniflare": { - "version": "3.20240405.2", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240405.2.tgz", - "integrity": "sha512-n/V5m9GVMN37U5gWdrNXKx2d1icLXtcIKcxWtLslH4RTaebZJdSRmp12UHyuQsKlaSpTkNqyzLVtCEgt2bhRSA==", + "version": "3.20240419.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240419.0.tgz", + "integrity": "sha512-fIev1PP4H+fQp5FtvzHqRY2v5s+jxh/a0xAhvM5fBNXvxWX7Zod1OatXfXwYbse3hqO3KeVMhb0osVtrW0NwJg==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "0.8.1", @@ -1532,7 +1452,7 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.2", - "workerd": "1.20240405.0", + "workerd": "1.20240419.0", "ws": "^8.11.0", "youch": "^3.2.2", "zod": "^3.20.6" @@ -1544,18 +1464,6 @@ "node": ">=16.13" } }, - "node_modules/minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=10" - } - }, "node_modules/mlly": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.5.0.tgz", @@ -1646,15 +1554,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, "node_modules/onetime": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", @@ -1927,15 +1826,6 @@ "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "dev": true }, - "node_modules/safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/selfsigned": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", @@ -2117,27 +2007,6 @@ "node": ">=8.0" } }, - "node_modules/ts-json-schema-generator": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-1.5.1.tgz", - "integrity": "sha512-apX5qG2+NA66j7b4AJm8q/DpdTeOsjfh7A3LpKsUiil0FepkNwtN28zYgjrsiiya2/OPhsr/PSjX5FUYg79rCg==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.15", - "commander": "^12.0.0", - "glob": "^8.0.3", - "json5": "^2.2.3", - "normalize-path": "^3.0.0", - "safe-stable-stringify": "^2.4.3", - "typescript": "~5.4.2" - }, - "bin": { - "ts-json-schema-generator": "bin/ts-json-schema-generator" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -2153,19 +2022,6 @@ "node": ">=4" } }, - "node_modules/typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/ufo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz", @@ -2246,9 +2102,9 @@ } }, "node_modules/vite-node": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.5.0.tgz", - "integrity": "sha512-tV8h6gMj6vPzVCa7l+VGq9lwoJjW8Y79vst8QZZGiuRAfijU+EEWuc0kFpmndQrWhMMhet1jdSF+40KSZUqIIw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.5.3.tgz", + "integrity": "sha512-axFo00qiCpU/JLd8N1gu9iEYL3xTbMbMrbe5nDp9GL0nb6gurIdZLkkFogZXWnE8Oyy5kfSLwNVIcVsnhE7lgQ==", "dev": true, "dependencies": { "cac": "^6.7.14", @@ -2268,16 +2124,16 @@ } }, "node_modules/vitest": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.5.0.tgz", - "integrity": "sha512-d8UKgR0m2kjdxDWX6911uwxout6GHS0XaGH1cksSIVVG8kRlE7G7aBw7myKQCvDI5dT4j7ZMa+l706BIORMDLw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.5.3.tgz", + "integrity": "sha512-2oM7nLXylw3mQlW6GXnRriw+7YvZFk/YNV8AxIC3Z3MfFbuziLGWP9GPxxu/7nRlXhqyxBikpamr+lEEj1sUEw==", "dev": true, "dependencies": { - "@vitest/expect": "1.5.0", - "@vitest/runner": "1.5.0", - "@vitest/snapshot": "1.5.0", - "@vitest/spy": "1.5.0", - "@vitest/utils": "1.5.0", + "@vitest/expect": "1.5.3", + "@vitest/runner": "1.5.3", + "@vitest/snapshot": "1.5.3", + "@vitest/spy": "1.5.3", + "@vitest/utils": "1.5.3", "acorn-walk": "^8.3.2", "chai": "^4.3.10", "debug": "^4.3.4", @@ -2291,7 +2147,7 @@ "tinybench": "^2.5.1", "tinypool": "^0.8.3", "vite": "^5.0.0", - "vite-node": "1.5.0", + "vite-node": "1.5.3", "why-is-node-running": "^2.2.2" }, "bin": { @@ -2306,8 +2162,8 @@ "peerDependencies": { "@edge-runtime/vm": "*", "@types/node": "^18.0.0 || >=20.0.0", - "@vitest/browser": "1.5.0", - "@vitest/ui": "1.5.0", + "@vitest/browser": "1.5.3", + "@vitest/ui": "1.5.3", "happy-dom": "*", "jsdom": "*" }, @@ -2364,9 +2220,9 @@ } }, "node_modules/workerd": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240405.0.tgz", - "integrity": "sha512-AWrOSBh4Ll7sBWHuh0aywm8hDkKqsZmcwnDB0PVGszWZM5mndNBI5iJ/8haXVpdoyqkJQEVdhET9JDi4yU8tRg==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240419.0.tgz", + "integrity": "sha512-9yV98KpkQgG+bdEsKEW8i1AYZgxns6NVSfdOVEB2Ue1pTMtIEYfUyqUE+O2amisRrfaC3Pw4EvjtTmVaoetfeg==", "dev": true, "hasInstallScript": true, "bin": { @@ -2376,33 +2232,32 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20240405.0", - "@cloudflare/workerd-darwin-arm64": "1.20240405.0", - "@cloudflare/workerd-linux-64": "1.20240405.0", - "@cloudflare/workerd-linux-arm64": "1.20240405.0", - "@cloudflare/workerd-windows-64": "1.20240405.0" + "@cloudflare/workerd-darwin-64": "1.20240419.0", + "@cloudflare/workerd-darwin-arm64": "1.20240419.0", + "@cloudflare/workerd-linux-64": "1.20240419.0", + "@cloudflare/workerd-linux-arm64": "1.20240419.0", + "@cloudflare/workerd-windows-64": "1.20240419.0" } }, "node_modules/wrangler": { - "version": "3.51.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.51.0.tgz", - "integrity": "sha512-1WVVbLTWeNP/djFjfctUkrMKbOdWyp/MrRAK6tefW3IgvQV8dEA9WU36GUIhnFhWLTQ2zHfg7jbaoP8n6ticrQ==", + "version": "3.53.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.53.0.tgz", + "integrity": "sha512-JxkvCQekL9j8Mu4CEKM/HEVyDnymWzKQuMUuJH0yum1AilutD5HAP9kVVYmvu7BvwlRyRUAj8TI5OUxXnLCEpQ==", "dev": true, "dependencies": { - "@cloudflare/kv-asset-handler": "0.3.1", + "@cloudflare/kv-asset-handler": "0.3.2", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "blake3-wasm": "^2.1.5", "chokidar": "^3.5.3", "esbuild": "0.17.19", - "miniflare": "3.20240405.2", + "miniflare": "3.20240419.0", "nanoid": "^3.3.3", "path-to-regexp": "^6.2.0", "resolve": "^1.22.8", "resolve.exports": "^2.0.2", "selfsigned": "^2.0.1", "source-map": "0.6.1", - "ts-json-schema-generator": "^1.5.0", "xxhash-wasm": "^1.0.1" }, "bin": { @@ -2416,7 +2271,7 @@ "fsevents": "~2.3.2" }, "peerDependencies": { - "@cloudflare/workers-types": "^4.20240405.0" + "@cloudflare/workers-types": "^4.20240419.0" }, "peerDependenciesMeta": { "@cloudflare/workers-types": { @@ -2813,38 +2668,6 @@ "@esbuild/win32-x64": "0.17.19" } }, - "node_modules/wrangler/node_modules/miniflare": { - "version": "3.20240405.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240405.1.tgz", - "integrity": "sha512-oShOR/ckr9JTO1bkPQH0nXvuSgJjoE+E5+M1tvP01Q8Z+Q0GJnzU2+FDYUH8yIK/atHv7snU8yy0X6KWVn1YdQ==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "0.8.1", - "acorn": "^8.8.0", - "acorn-walk": "^8.2.0", - "capnp-ts": "^0.7.0", - "exit-hook": "^2.2.1", - "glob-to-regexp": "^0.4.1", - "stoppable": "^1.1.0", - "undici": "^5.28.2", - "workerd": "1.20240405.0", - "ws": "^8.11.0", - "youch": "^3.2.2", - "zod": "^3.20.6" - }, - "bin": { - "miniflare": "bootstrap.js" - }, - "engines": { - "node": ">=16.13" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, "node_modules/ws": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", @@ -2907,53 +2730,53 @@ }, "dependencies": { "@cloudflare/kv-asset-handler": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.1.tgz", - "integrity": "sha512-lKN2XCfKCmpKb86a1tl4GIwsJYDy9TGuwjhDELLmpKygQhw8X2xR4dusgpC5Tg7q1pB96Eb0rBo81kxSILQMwA==", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@cloudflare/kv-asset-handler/-/kv-asset-handler-0.3.2.tgz", + "integrity": "sha512-EeEjMobfuJrwoctj7FA1y1KEbM0+Q1xSjobIEyie9k4haVEBB7vkDvsasw1pM3rO39mL2akxIAzLMUAtrMHZhA==", "dev": true, "requires": { "mime": "^3.0.0" } }, "@cloudflare/workerd-darwin-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240405.0.tgz", - "integrity": "sha512-ut8kwpHmlz9dNSjoov6v1b6jS50J46Mj9QcMA0t1Hne36InaQk/qqPSd12fN5p2GesZ9OOBJvBdDsTblVdyJ1w==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240419.0.tgz", + "integrity": "sha512-PGVe9sYWULHfvGhN0IZh8MsskNG/ufnBSqPbgFCxJHCTrVXLPuC35EoVaforyqjKRwj3U35XMyGo9KHcGnTeHQ==", "dev": true, "optional": true }, "@cloudflare/workerd-darwin-arm64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240405.0.tgz", - "integrity": "sha512-x3A3Ym+J2DH1uYnw0aedeKOTnUebEo312+Aladv7bFri97pjRJcqVbYhMtOHLkHjwYn7bpKSY2eL5iM+0XT29A==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240419.0.tgz", + "integrity": "sha512-z4etQSPiD5Gcjs962LiC7ZdmXnN6SGof5KrYoFiSI9X9kUvpuGH/lnjVVPd+NnVNeDU2kzmcAIgyZjkjTaqVXQ==", "dev": true, "optional": true }, "@cloudflare/workerd-linux-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240405.0.tgz", - "integrity": "sha512-3tYpfjtxEQ0R30Pna7OF3Bz0CTx30hc0QNtH61KnkvXtaeYMkWutSKQKXIuVlPa/7v1MHp+8ViBXMflmS7HquA==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240419.0.tgz", + "integrity": "sha512-lBwhg0j3sYTFMsEb4bOClbVje8nqrYOu0H3feQlX+Eks94JIhWPkf8ywK4at/BUc1comPMhCgzDHwc2OMPUGgg==", "dev": true, "optional": true }, "@cloudflare/workerd-linux-arm64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240405.0.tgz", - "integrity": "sha512-NpKZlvmdgcX/m4tP5zM91AfJpZrue2/GRA+Sl3szxAivu2uE5jDVf5SS9dzqzCVfPrdhylqH7yeL4U/cafFNOg==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240419.0.tgz", + "integrity": "sha512-ZMY6wwWkxL+WPq8ydOp/irSYjAnMhBz1OC1+4z+OANtDs2beaZODmq7LEB3hb5WUAaTPY7DIjZh3DfDfty0nYg==", "dev": true, "optional": true }, "@cloudflare/workerd-windows-64": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240405.0.tgz", - "integrity": "sha512-REBeJMxvUCjwuEVzSSIBtzAyM69QjToab8qBst0S9vdih+9DObym4dw8CevdBQhDbFrHiyL9E6pAZpLPNHVgCw==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240419.0.tgz", + "integrity": "sha512-YJjgaJN2yGTkV7Cr4K3i8N4dUwVQTclT3Pr3NpRZCcLjTszwlE53++XXDnHMKGXBbSguIizaVbmcU2EtmIXyeQ==", "dev": true, "optional": true }, "@cloudflare/workers-types": { - "version": "4.20240405.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240405.0.tgz", - "integrity": "sha512-sEVOhyOgXUwfLkgHqbLZa/sfkSYrh7/zLmI6EZNibPaVPvAnAcItbNNl3SAlLyLKuwf8m4wAIAgu9meKWCvXjg==", + "version": "4.20240423.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20240423.0.tgz", + "integrity": "sha512-ssuccb3j+URp6mP2p0PcQE9vmS3YeKBQnALHF9P3yQfUAFozuhTsDTbqmL+zPrJvUcG7SL2xVQkNDF9QJeKDZw==", "dev": true }, "@cspotcode/source-map-support": { @@ -3297,12 +3120,6 @@ "integrity": "sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==", "dev": true }, - "@types/json-schema": { - "version": "7.0.15", - "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.15.tgz", - "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", - "dev": true - }, "@types/node": { "version": "20.11.7", "resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.7.tgz", @@ -3322,31 +3139,31 @@ } }, "@vitest/expect": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.5.0.tgz", - "integrity": "sha512-0pzuCI6KYi2SIC3LQezmxujU9RK/vwC1U9R0rLuGlNGcOuDWxqWKu6nUdFsX9tH1WU0SXtAxToOsEjeUn1s3hA==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-1.5.3.tgz", + "integrity": "sha512-y+waPz31pOFr3rD7vWTbwiLe5+MgsMm40jTZbQE8p8/qXyBX3CQsIXRx9XK12IbY7q/t5a5aM/ckt33b4PxK2g==", "dev": true, "requires": { - "@vitest/spy": "1.5.0", - "@vitest/utils": "1.5.0", + "@vitest/spy": "1.5.3", + "@vitest/utils": "1.5.3", "chai": "^4.3.10" } }, "@vitest/runner": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.5.0.tgz", - "integrity": "sha512-7HWwdxXP5yDoe7DTpbif9l6ZmDwCzcSIK38kTSIt6CFEpMjX4EpCgT6wUmS0xTXqMI6E/ONmfgRKmaujpabjZQ==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-1.5.3.tgz", + "integrity": "sha512-7PlfuReN8692IKQIdCxwir1AOaP5THfNkp0Uc4BKr2na+9lALNit7ub9l3/R7MP8aV61+mHKRGiqEKRIwu6iiQ==", "dev": true, "requires": { - "@vitest/utils": "1.5.0", + "@vitest/utils": "1.5.3", "p-limit": "^5.0.0", "pathe": "^1.1.1" } }, "@vitest/snapshot": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.5.0.tgz", - "integrity": "sha512-qpv3fSEuNrhAO3FpH6YYRdaECnnRjg9VxbhdtPwPRnzSfHVXnNzzrpX4cJxqiwgRMo7uRMWDFBlsBq4Cr+rO3A==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-1.5.3.tgz", + "integrity": "sha512-K3mvIsjyKYBhNIDujMD2gfQEzddLe51nNOAf45yKRt/QFJcUIeTQd2trRvv6M6oCBHNVnZwFWbQ4yj96ibiDsA==", "dev": true, "requires": { "magic-string": "^0.30.5", @@ -3355,18 +3172,18 @@ } }, "@vitest/spy": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.5.0.tgz", - "integrity": "sha512-vu6vi6ew5N5MMHJjD5PoakMRKYdmIrNJmyfkhRpQt5d9Ewhw9nZ5Aqynbi3N61bvk9UvZ5UysMT6ayIrZ8GA9w==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-1.5.3.tgz", + "integrity": "sha512-Llj7Jgs6lbnL55WoshJUUacdJfjU2honvGcAJBxhra5TPEzTJH8ZuhI3p/JwqqfnTr4PmP7nDmOXP53MS7GJlg==", "dev": true, "requires": { "tinyspy": "^2.2.0" } }, "@vitest/utils": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.5.0.tgz", - "integrity": "sha512-BDU0GNL8MWkRkSRdNFvCUCAVOeHaUlVJ9Tx0TYBZyXaaOTmGtUFObzchCivIBrIwKzvZA7A9sCejVhXM2aY98A==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-1.5.3.tgz", + "integrity": "sha512-rE9DTN1BRhzkzqNQO+kw8ZgfeEBCLXiHJwetk668shmNBpSagQxneT5eSqEBLP+cqSiAeecvQmbpFfdMyLcIQA==", "dev": true, "requires": { "diff-sequences": "^29.6.3", @@ -3418,12 +3235,6 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, - "balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, "binary-extensions": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", @@ -3436,15 +3247,6 @@ "integrity": "sha512-F1+K8EbfOZE49dtoPtmxUQrpXaBIl3ICvasLh+nJta0xkz+9kF/7uet9fLnwKqhDrmj6g+6K3Tw9yQPUg2ka5g==", "dev": true }, - "brace-expansion": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", - "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", - "dev": true, - "requires": { - "balanced-match": "^1.0.0" - } - }, "braces": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", @@ -3510,12 +3312,6 @@ "readdirp": "~3.6.0" } }, - "commander": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.0.0.tgz", - "integrity": "sha512-MwVNWlYjDTtOjX5PiD7o5pK0UrFU/OYgcJfjjK4RaHZETNtjJqrZa9Y9ds88+A+f+d5lv+561eZ+yCKoS3gbAA==", - "dev": true - }, "cookie": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz", @@ -3641,12 +3437,6 @@ "to-regex-range": "^5.0.1" } }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", - "dev": true - }, "fsevents": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", @@ -3682,19 +3472,6 @@ "integrity": "sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==", "dev": true }, - "glob": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", - "integrity": "sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^5.0.1", - "once": "^1.3.0" - } - }, "glob-parent": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", @@ -3725,22 +3502,6 @@ "integrity": "sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==", "dev": true }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", - "dev": true - }, "is-binary-path": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", @@ -3798,12 +3559,6 @@ "integrity": "sha512-UfJMcSJc+SEXEl9lH/VLHSZbThQyLpw1vLO1Lb+j4RWDvG3N2f7yj3PVQA3cmkTBNldJ9eFnM+xEXxHIXrYiJw==", "dev": true }, - "json5": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", - "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", - "dev": true - }, "jsonc-parser": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.1.tgz", @@ -3857,9 +3612,9 @@ "dev": true }, "miniflare": { - "version": "3.20240405.2", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240405.2.tgz", - "integrity": "sha512-n/V5m9GVMN37U5gWdrNXKx2d1icLXtcIKcxWtLslH4RTaebZJdSRmp12UHyuQsKlaSpTkNqyzLVtCEgt2bhRSA==", + "version": "3.20240419.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240419.0.tgz", + "integrity": "sha512-fIev1PP4H+fQp5FtvzHqRY2v5s+jxh/a0xAhvM5fBNXvxWX7Zod1OatXfXwYbse3hqO3KeVMhb0osVtrW0NwJg==", "dev": true, "requires": { "@cspotcode/source-map-support": "0.8.1", @@ -3870,21 +3625,12 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.2", - "workerd": "1.20240405.0", + "workerd": "1.20240419.0", "ws": "^8.11.0", "youch": "^3.2.2", "zod": "^3.20.6" } }, - "minimatch": { - "version": "5.1.6", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.6.tgz", - "integrity": "sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==", - "dev": true, - "requires": { - "brace-expansion": "^2.0.1" - } - }, "mlly": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/mlly/-/mlly-1.5.0.tgz", @@ -3944,15 +3690,6 @@ } } }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", - "dev": true, - "requires": { - "wrappy": "1" - } - }, "onetime": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/onetime/-/onetime-6.0.0.tgz", @@ -4163,12 +3900,6 @@ } } }, - "safe-stable-stringify": { - "version": "2.4.3", - "resolved": "https://registry.npmjs.org/safe-stable-stringify/-/safe-stable-stringify-2.4.3.tgz", - "integrity": "sha512-e2bDA2WJT0wxseVd4lsDP4+3ONX6HpMXQa1ZhFQ7SU+GjvORCmShbCMltrtIDfkYhVHrOcPtj+KhmDBdPdZD1g==", - "dev": true - }, "selfsigned": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/selfsigned/-/selfsigned-2.4.1.tgz", @@ -4300,21 +4031,6 @@ "is-number": "^7.0.0" } }, - "ts-json-schema-generator": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/ts-json-schema-generator/-/ts-json-schema-generator-1.5.1.tgz", - "integrity": "sha512-apX5qG2+NA66j7b4AJm8q/DpdTeOsjfh7A3LpKsUiil0FepkNwtN28zYgjrsiiya2/OPhsr/PSjX5FUYg79rCg==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.15", - "commander": "^12.0.0", - "glob": "^8.0.3", - "json5": "^2.2.3", - "normalize-path": "^3.0.0", - "safe-stable-stringify": "^2.4.3", - "typescript": "~5.4.2" - } - }, "tslib": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.2.tgz", @@ -4327,12 +4043,6 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, - "typescript": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.4.5.tgz", - "integrity": "sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ==", - "dev": true - }, "ufo": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.3.2.tgz", @@ -4367,9 +4077,9 @@ } }, "vite-node": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.5.0.tgz", - "integrity": "sha512-tV8h6gMj6vPzVCa7l+VGq9lwoJjW8Y79vst8QZZGiuRAfijU+EEWuc0kFpmndQrWhMMhet1jdSF+40KSZUqIIw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-1.5.3.tgz", + "integrity": "sha512-axFo00qiCpU/JLd8N1gu9iEYL3xTbMbMrbe5nDp9GL0nb6gurIdZLkkFogZXWnE8Oyy5kfSLwNVIcVsnhE7lgQ==", "dev": true, "requires": { "cac": "^6.7.14", @@ -4380,16 +4090,16 @@ } }, "vitest": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.5.0.tgz", - "integrity": "sha512-d8UKgR0m2kjdxDWX6911uwxout6GHS0XaGH1cksSIVVG8kRlE7G7aBw7myKQCvDI5dT4j7ZMa+l706BIORMDLw==", + "version": "1.5.3", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-1.5.3.tgz", + "integrity": "sha512-2oM7nLXylw3mQlW6GXnRriw+7YvZFk/YNV8AxIC3Z3MfFbuziLGWP9GPxxu/7nRlXhqyxBikpamr+lEEj1sUEw==", "dev": true, "requires": { - "@vitest/expect": "1.5.0", - "@vitest/runner": "1.5.0", - "@vitest/snapshot": "1.5.0", - "@vitest/spy": "1.5.0", - "@vitest/utils": "1.5.0", + "@vitest/expect": "1.5.3", + "@vitest/runner": "1.5.3", + "@vitest/snapshot": "1.5.3", + "@vitest/spy": "1.5.3", + "@vitest/utils": "1.5.3", "acorn-walk": "^8.3.2", "chai": "^4.3.10", "debug": "^4.3.4", @@ -4403,7 +4113,7 @@ "tinybench": "^2.5.1", "tinypool": "^0.8.3", "vite": "^5.0.0", - "vite-node": "1.5.0", + "vite-node": "1.5.3", "why-is-node-running": "^2.2.2" } }, @@ -4427,39 +4137,38 @@ } }, "workerd": { - "version": "1.20240405.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240405.0.tgz", - "integrity": "sha512-AWrOSBh4Ll7sBWHuh0aywm8hDkKqsZmcwnDB0PVGszWZM5mndNBI5iJ/8haXVpdoyqkJQEVdhET9JDi4yU8tRg==", + "version": "1.20240419.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240419.0.tgz", + "integrity": "sha512-9yV98KpkQgG+bdEsKEW8i1AYZgxns6NVSfdOVEB2Ue1pTMtIEYfUyqUE+O2amisRrfaC3Pw4EvjtTmVaoetfeg==", "dev": true, "requires": { - "@cloudflare/workerd-darwin-64": "1.20240405.0", - "@cloudflare/workerd-darwin-arm64": "1.20240405.0", - "@cloudflare/workerd-linux-64": "1.20240405.0", - "@cloudflare/workerd-linux-arm64": "1.20240405.0", - "@cloudflare/workerd-windows-64": "1.20240405.0" + "@cloudflare/workerd-darwin-64": "1.20240419.0", + "@cloudflare/workerd-darwin-arm64": "1.20240419.0", + "@cloudflare/workerd-linux-64": "1.20240419.0", + "@cloudflare/workerd-linux-arm64": "1.20240419.0", + "@cloudflare/workerd-windows-64": "1.20240419.0" } }, "wrangler": { - "version": "3.51.0", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.51.0.tgz", - "integrity": "sha512-1WVVbLTWeNP/djFjfctUkrMKbOdWyp/MrRAK6tefW3IgvQV8dEA9WU36GUIhnFhWLTQ2zHfg7jbaoP8n6ticrQ==", + "version": "3.53.0", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.53.0.tgz", + "integrity": "sha512-JxkvCQekL9j8Mu4CEKM/HEVyDnymWzKQuMUuJH0yum1AilutD5HAP9kVVYmvu7BvwlRyRUAj8TI5OUxXnLCEpQ==", "dev": true, "requires": { - "@cloudflare/kv-asset-handler": "0.3.1", + "@cloudflare/kv-asset-handler": "0.3.2", "@esbuild-plugins/node-globals-polyfill": "^0.2.3", "@esbuild-plugins/node-modules-polyfill": "^0.2.2", "blake3-wasm": "^2.1.5", "chokidar": "^3.5.3", "esbuild": "0.17.19", "fsevents": "~2.3.2", - "miniflare": "3.20240405.2", + "miniflare": "3.20240419.0", "nanoid": "^3.3.3", "path-to-regexp": "^6.2.0", "resolve": "^1.22.8", "resolve.exports": "^2.0.2", "selfsigned": "^2.0.1", "source-map": "0.6.1", - "ts-json-schema-generator": "^1.5.0", "xxhash-wasm": "^1.0.1" }, "dependencies": { @@ -4646,35 +4355,9 @@ "@esbuild/win32-ia32": "0.17.19", "@esbuild/win32-x64": "0.17.19" } - }, - "miniflare": { - "version": "3.20240405.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240405.1.tgz", - "integrity": "sha512-oShOR/ckr9JTO1bkPQH0nXvuSgJjoE+E5+M1tvP01Q8Z+Q0GJnzU2+FDYUH8yIK/atHv7snU8yy0X6KWVn1YdQ==", - "dev": true, - "requires": { - "@cspotcode/source-map-support": "0.8.1", - "acorn": "^8.8.0", - "acorn-walk": "^8.2.0", - "capnp-ts": "^0.7.0", - "exit-hook": "^2.2.1", - "glob-to-regexp": "^0.4.1", - "stoppable": "^1.1.0", - "undici": "^5.28.2", - "workerd": "1.20240405.0", - "ws": "^8.11.0", - "youch": "^3.2.2", - "zod": "^3.20.6" - } } } }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", - "dev": true - }, "ws": { "version": "8.16.0", "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", diff --git a/tailcall-cloudflare/tests/cf_tests.spec.ts b/tailcall-cloudflare/tests/cf_tests.spec.ts index e89fcbcaff..8ea562bbbb 100644 --- a/tailcall-cloudflare/tests/cf_tests.spec.ts +++ b/tailcall-cloudflare/tests/cf_tests.spec.ts @@ -7,12 +7,12 @@ describe("fetch", () => { let placeholder = (await readFile("../examples/jsonplaceholder.graphql")).toString() let placeholder_batch = (await readFile("../examples/jsonplaceholder_batch.graphql")).toString() let grpc = (await readFile("../examples/grpc.graphql")).toString() - let news_proto = (await readFile("../src/grpc/tests/proto/news.proto")).toString() + let news_proto = (await readFile("../tailcall-fixtures/fixtures/protobuf/news.proto")).toString() let bucket = await mf.getR2Bucket("MY_R2") await bucket.put("examples/grpc.graphql", grpc) - await bucket.put("examples/../src/grpc/tests/proto/news.proto", news_proto) - await bucket.put("src/grpc/tests/proto/news.proto", grpc) + await bucket.put("examples/../tailcall-fixtures/fixtures/protobuf/news.proto", news_proto) + await bucket.put("tailcall-fixtures/fixtures/protobuf/news.proto", grpc) await bucket.put("examples/jsonplaceholder.graphql", placeholder) await bucket.put("examples/jsonplaceholder_batch.graphql", placeholder_batch) }) diff --git a/tailcall-fixtures/Cargo.toml b/tailcall-fixtures/Cargo.toml new file mode 100644 index 0000000000..b80ef04d51 --- /dev/null +++ b/tailcall-fixtures/Cargo.toml @@ -0,0 +1,10 @@ +[package] +name = "tailcall-fixtures" +version = "0.1.0" +edition = "2021" +publish = false + +[build-dependencies] +anyhow = { workspace = true } +convert_case = "0.6.0" +indenter = { version = "0.3.3", features = ["std"] } diff --git a/tailcall-fixtures/README.md b/tailcall-fixtures/README.md new file mode 100644 index 0000000000..beb81f5b2b --- /dev/null +++ b/tailcall-fixtures/README.md @@ -0,0 +1,3 @@ +# Tailcall fixtures + +Package that contains configs and fixtures used in tests and examples to be shared among different parts of tailcall plus helper functions to resolve these files in tests. diff --git a/tailcall-fixtures/build.rs b/tailcall-fixtures/build.rs new file mode 100644 index 0000000000..85199bfa85 --- /dev/null +++ b/tailcall-fixtures/build.rs @@ -0,0 +1,72 @@ +use std::fmt::Write; +use std::path::Path; +use std::{env, fs}; + +use anyhow::{Context, Result}; +use convert_case::{Case, Casing}; +use indenter::CodeFormatter; + +fn write_mod(path: &Path, f: &mut CodeFormatter, dir_name: Option<&str>) -> Result<()> { + let files = fs::read_dir(path)?; + + if let Some(dir_name) = dir_name { + writeln!( + f, + r#" + pub mod {dir_name} {{ + pub const SELF: &str = r"{}"; + "#, + path.display() + )?; + f.indent(1); + } + + for file in files { + let file = file?; + + if file.metadata()?.is_dir() { + write_mod(&file.path(), f, Some(&file.file_name().to_string_lossy()))?; + writeln!(f)?; + } else { + let name = file.file_name(); + let name = Path::new(&name) + .file_stem() + .context("Failed to resolve filename")? + .to_string_lossy(); + let name = name.as_ref().to_case(Case::UpperSnake); + let path = file.path(); + let path = path.display(); + + writeln!( + f, + r#" + pub const {name}: &str = r"{path}"; + "# + )?; + } + } + + if dir_name.is_some() { + f.dedent(1); + writeln!(f, "\n}}")?; + } + + Ok(()) +} + +// walk over `fixtures` directory and collect all files as const &str inside +// modules according to nested directories +fn main() -> Result<()> { + let fixtures_path = Path::new(env!("CARGO_MANIFEST_DIR")).join("fixtures"); + let dest_path = Path::new(&env::var_os("OUT_DIR").unwrap()).join("fixtures.rs"); + + let mut buffer = String::new(); + let formatter = &mut CodeFormatter::new(&mut buffer, " "); + + write_mod(&fixtures_path, formatter, None)?; + + fs::write(dest_path, buffer).unwrap(); + println!("cargo:rerun-if-changed=fixtures"); + + Ok(()) +} diff --git a/src/grpc/tests/proto_no_pkg.graphql b/tailcall-fixtures/fixtures/configs/proto_no_pkg.graphql similarity index 100% rename from src/grpc/tests/proto_no_pkg.graphql rename to tailcall-fixtures/fixtures/configs/proto_no_pkg.graphql diff --git a/tailcall-query-plan/tests/config/user-posts-query.graphql b/tailcall-fixtures/fixtures/configs/user-posts-query.graphql similarity index 100% rename from tailcall-query-plan/tests/config/user-posts-query.graphql rename to tailcall-fixtures/fixtures/configs/user-posts-query.graphql diff --git a/tailcall-fixtures/fixtures/configs/user-posts.graphql b/tailcall-fixtures/fixtures/configs/user-posts.graphql new file mode 100644 index 0000000000..079c492893 --- /dev/null +++ b/tailcall-fixtures/fixtures/configs/user-posts.graphql @@ -0,0 +1,29 @@ +schema + @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { + query: Query +} + +type Query { + posts: [Post] @http(path: "/posts") + users: [User] @http(path: "/users") + user(id: Int!): User @http(path: "/users/{{.args.id}}") + post(id: Int!): Post @http(path: "/posts/{{.args.id}}") +} + +type User { + id: Int! + name: String! + username: String! + email: String! + phone: String + website: String @expr(body: "/users/website/{{.value.username}}") +} + +type Post { + id: Int! + userId: Int! + title: String! + body: String! + user: User @http(path: "/users/{{.value.userId}}") +} diff --git a/src/generator/proto/greetings.proto b/tailcall-fixtures/fixtures/generator/proto/greetings.proto similarity index 100% rename from src/generator/proto/greetings.proto rename to tailcall-fixtures/fixtures/generator/proto/greetings.proto diff --git a/src/generator/proto/greetings_a.proto b/tailcall-fixtures/fixtures/generator/proto/greetings_a.proto similarity index 100% rename from src/generator/proto/greetings_a.proto rename to tailcall-fixtures/fixtures/generator/proto/greetings_a.proto diff --git a/src/generator/proto/greetings_b.proto b/tailcall-fixtures/fixtures/generator/proto/greetings_b.proto similarity index 100% rename from src/generator/proto/greetings_b.proto rename to tailcall-fixtures/fixtures/generator/proto/greetings_b.proto diff --git a/src/generator/proto/greetings_message.proto b/tailcall-fixtures/fixtures/generator/proto/greetings_message.proto similarity index 100% rename from src/generator/proto/greetings_message.proto rename to tailcall-fixtures/fixtures/generator/proto/greetings_message.proto diff --git a/src/generator/proto/news.proto b/tailcall-fixtures/fixtures/generator/proto/news.proto similarity index 100% rename from src/generator/proto/news.proto rename to tailcall-fixtures/fixtures/generator/proto/news.proto diff --git a/src/generator/proto/news_no_service.proto b/tailcall-fixtures/fixtures/generator/proto/news_no_service.proto similarity index 100% rename from src/generator/proto/news_no_service.proto rename to tailcall-fixtures/fixtures/generator/proto/news_no_service.proto diff --git a/src/generator/proto/no_pkg.proto b/tailcall-fixtures/fixtures/generator/proto/no_pkg.proto similarity index 100% rename from src/generator/proto/no_pkg.proto rename to tailcall-fixtures/fixtures/generator/proto/no_pkg.proto diff --git a/src/generator/proto/person.proto b/tailcall-fixtures/fixtures/generator/proto/person.proto similarity index 100% rename from src/generator/proto/person.proto rename to tailcall-fixtures/fixtures/generator/proto/person.proto diff --git a/tailcall-fixtures/fixtures/grpc/reflection/news-list-services.bin b/tailcall-fixtures/fixtures/grpc/reflection/news-list-services.bin new file mode 100644 index 0000000000..b284fe8164 Binary files /dev/null and b/tailcall-fixtures/fixtures/grpc/reflection/news-list-services.bin differ diff --git a/tailcall-fixtures/fixtures/grpc/reflection/news-service-descriptor.bin b/tailcall-fixtures/fixtures/grpc/reflection/news-service-descriptor.bin new file mode 100644 index 0000000000..b1e2f25974 Binary files /dev/null and b/tailcall-fixtures/fixtures/grpc/reflection/news-service-descriptor.bin differ diff --git a/tailcall-fixtures/fixtures/protobuf/cycle.proto b/tailcall-fixtures/fixtures/protobuf/cycle.proto new file mode 100644 index 0000000000..3b948bf77c --- /dev/null +++ b/tailcall-fixtures/fixtures/protobuf/cycle.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; + +package cycle; + +import "nested0.proto"; +import "duplicate.proto"; diff --git a/tailcall-fixtures/fixtures/protobuf/duplicate.proto b/tailcall-fixtures/fixtures/protobuf/duplicate.proto new file mode 100644 index 0000000000..54c9461118 --- /dev/null +++ b/tailcall-fixtures/fixtures/protobuf/duplicate.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; + +package duplicate; + +import "greetings.proto"; +import "news.proto"; diff --git a/src/grpc/tests/proto/errors.proto b/tailcall-fixtures/fixtures/protobuf/errors.proto similarity index 100% rename from src/grpc/tests/proto/errors.proto rename to tailcall-fixtures/fixtures/protobuf/errors.proto diff --git a/src/grpc/tests/proto/greetings.proto b/tailcall-fixtures/fixtures/protobuf/greetings.proto similarity index 100% rename from src/grpc/tests/proto/greetings.proto rename to tailcall-fixtures/fixtures/protobuf/greetings.proto diff --git a/tailcall-fixtures/fixtures/protobuf/nested0.proto b/tailcall-fixtures/fixtures/protobuf/nested0.proto new file mode 100644 index 0000000000..bf6fd25a0e --- /dev/null +++ b/tailcall-fixtures/fixtures/protobuf/nested0.proto @@ -0,0 +1,7 @@ +syntax = "proto3"; + +package nested0; + +import "greetings.proto"; +import "nested1.proto"; +import "news_no_pkg.proto"; \ No newline at end of file diff --git a/tailcall-fixtures/fixtures/protobuf/nested1.proto b/tailcall-fixtures/fixtures/protobuf/nested1.proto new file mode 100644 index 0000000000..b4bf1a0560 --- /dev/null +++ b/tailcall-fixtures/fixtures/protobuf/nested1.proto @@ -0,0 +1,6 @@ +syntax = "proto3"; + +package nested1; + +import "news.proto"; +import "cycle.proto"; diff --git a/tailcall-fixtures/fixtures/protobuf/news.proto b/tailcall-fixtures/fixtures/protobuf/news.proto new file mode 100644 index 0000000000..7864a0a53c --- /dev/null +++ b/tailcall-fixtures/fixtures/protobuf/news.proto @@ -0,0 +1,34 @@ +syntax = "proto3"; + +import "google/protobuf/empty.proto"; + +package news; + +enum Status { + PUBLISHED = 0; + DRAFT = 1; + DELETED = 2; +} + +message News { + int32 id = 1; + string title = 2; + string body = 3; + string postImage = 4; + Status status = 5; +} + +service NewsService { + rpc GetAllNews(google.protobuf.Empty) returns (NewsList) {} + rpc GetNews(NewsId) returns (News) {} + rpc GetMultipleNews(MultipleNewsId) returns (NewsList) {} + rpc DeleteNews(NewsId) returns (google.protobuf.Empty) {} + rpc EditNews(News) returns (News) {} + rpc AddNews(News) returns (News) {} +} + +message NewsId { int32 id = 1; } + +message MultipleNewsId { repeated NewsId ids = 1; } + +message NewsList { repeated News news = 1; } \ No newline at end of file diff --git a/src/grpc/tests/proto/news_no_pkg.proto b/tailcall-fixtures/fixtures/protobuf/news_no_pkg.proto similarity index 100% rename from src/grpc/tests/proto/news_no_pkg.proto rename to tailcall-fixtures/fixtures/protobuf/news_no_pkg.proto diff --git a/tailcall-fixtures/src/lib.rs b/tailcall-fixtures/src/lib.rs new file mode 100644 index 0000000000..6d8d1aad20 --- /dev/null +++ b/tailcall-fixtures/src/lib.rs @@ -0,0 +1,2 @@ +// include source file that was generated by build script +include!(concat!(env!("OUT_DIR"), "/fixtures.rs")); diff --git a/tailcall-query-plan/Cargo.toml b/tailcall-query-plan/Cargo.toml index 5d2c51726f..ece9e5a9c5 100644 --- a/tailcall-query-plan/Cargo.toml +++ b/tailcall-query-plan/Cargo.toml @@ -10,10 +10,11 @@ futures-util = { workspace = true } indexmap = { workspace = true } tokio = { workspace = true } -async-recursion = "1.1.0" +async-recursion = "1.1.1" indenter = "0.3.3" dashmap = "5.5.3" tailcall = { path = ".." } [dev-dependencies] insta = { workspace = true } +tailcall-fixtures = { path = "../tailcall-fixtures"} diff --git a/tailcall-query-plan/tests/config/user-posts.graphql b/tailcall-query-plan/tests/config/user-posts.graphql deleted file mode 100644 index a4fa2ba3d3..0000000000 --- a/tailcall-query-plan/tests/config/user-posts.graphql +++ /dev/null @@ -1,29 +0,0 @@ -schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { - query: Query -} - -type Query { - posts: [Post] @http(path: "/posts") - users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") - post(id: Int!): Post @http(path: "/posts/{{args.id}}") -} - -type User { - id: Int! - name: String! - username: String! - email: String! - phone: String - website: String @expr(body: "/users/website/{{value.username}}") -} - -type Post { - id: Int! - userId: Int! - title: String! - body: String! - user: User @http(path: "/users/{{value.userId}}") -} diff --git a/tailcall-query-plan/tests/execution.rs b/tailcall-query-plan/tests/execution.rs index 0586d7b028..698d389bd3 100644 --- a/tailcall-query-plan/tests/execution.rs +++ b/tailcall-query-plan/tests/execution.rs @@ -12,7 +12,7 @@ use tailcall_query_plan::plan::{GeneralPlan, OperationPlan}; #[tokio::test] async fn test_simple() { - let root_dir = Path::new(env!("CARGO_MANIFEST_DIR")).join("tests/config"); + let root_dir = Path::new(tailcall_fixtures::configs::SELF); let config = fs::read_to_string(root_dir.join("user-posts.graphql")).unwrap(); let config = Config::from_sdl(&config).to_result().unwrap(); let config = ConfigModule::from(config); diff --git a/tailcall-upstream-grpc/Cargo.toml b/tailcall-upstream-grpc/Cargo.toml new file mode 100644 index 0000000000..f1d1e377ce --- /dev/null +++ b/tailcall-upstream-grpc/Cargo.toml @@ -0,0 +1,38 @@ +[package] +name = "tailcall-upstream-grpc" +version = "0.1.0" +edition = "2021" +publish = false + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[dependencies] +hyper = { version = "0.14.28", features = ["full"] } +tokio = { version = "1.37.0", features = ["full"] } +tonic = "0.11.0" +tonic-reflection = "0.11.0" +prost = "0.12.4" +prost-types = "0.12.4" +tower = "0.4.13" +hyper-util = { version = "0.1.3", features = ["tokio"] } +http-body-util = "0.1.1" +anyhow = "1.0.82" +once_cell = "1.19.0" +tonic-tracing-opentelemetry = "0.18.2" +opentelemetry = { version = "0.22.0", features = ["trace"] } +opentelemetry_sdk = { version = "0.22.1", features = ["trace", "rt-tokio"] } +opentelemetry-semantic-conventions = "0.14.0" +opentelemetry-http = "0.11.1" +opentelemetry-otlp = { version = "0.15.0", features = [ + "trace", + # required to make grpc requests + "tls-roots", +] } +tracing = "0.1.40" +tracing-opentelemetry = "0.23.0" +tracing-subscriber = "0.3.18" + +[build-dependencies] +protoc-bin-vendored = "3.0.0" +tonic-build = "0.11.0" +tailcall-fixtures = { path = "../tailcall-fixtures" } diff --git a/tailcall-upstream-grpc/README.md b/tailcall-upstream-grpc/README.md new file mode 100644 index 0000000000..fd437671f0 --- /dev/null +++ b/tailcall-upstream-grpc/README.md @@ -0,0 +1,27 @@ +# Sample gRPC Rust News Server + +## Overview + +This folder contains a gRPC-based Rust server implementing CRUD operations for a news list. It features a batched `GetNews` API, allowing efficient retrieval of multiple news items. + +### Features + +- **CRUD Operations**: Create, Read, Update, and Delete news items. +- **Batched News Retrieval**: Fetch multiple news items in a single request. +- **gRPC Interface**: Efficient and modern protocol for inter-service communication. + +## Running the Server + +Start the server with: + +```bash +cargo run +``` + +## Reflection api + +The server supports reflection api by default + +### example + +`grpcurl -plaintext localhost:50051 list` diff --git a/tailcall-upstream-grpc/build.rs b/tailcall-upstream-grpc/build.rs new file mode 100644 index 0000000000..4c6ac324d3 --- /dev/null +++ b/tailcall-upstream-grpc/build.rs @@ -0,0 +1,16 @@ +use std::env::{set_var, var}; +use std::path::{Path, PathBuf}; + +fn main() { + let path = protoc_bin_vendored::protoc_bin_path().expect("Failed to find protoc binary"); + set_var("PROTOC", format!("{}", path.display())); + + let news = Path::new(tailcall_fixtures::protobuf::NEWS); + + let out_dir = PathBuf::from(var("OUT_DIR").unwrap()); + + tonic_build::configure() + .file_descriptor_set_path(out_dir.join("news_descriptor.bin")) + .compile(&[&news], &[news.parent().unwrap()]) + .unwrap(); +} diff --git a/tailcall-upstream-grpc/src/main.rs b/tailcall-upstream-grpc/src/main.rs new file mode 100644 index 0000000000..707aa3f437 --- /dev/null +++ b/tailcall-upstream-grpc/src/main.rs @@ -0,0 +1,243 @@ +use std::sync::{Arc, Mutex}; + +use anyhow::{anyhow, Result}; +use hyper::header::{HeaderName, HeaderValue}; +use hyper::HeaderMap; +use news::news_service_server::{NewsService, NewsServiceServer}; +use news::{MultipleNewsId, News, NewsId, NewsList}; +use once_cell::sync::Lazy; +use opentelemetry::trace::{TraceError, TracerProvider}; +use opentelemetry::{global, KeyValue}; +use opentelemetry_otlp::WithExportConfig; +use opentelemetry_sdk::propagation::TraceContextPropagator; +use opentelemetry_sdk::{runtime, Resource}; +use tonic::metadata::MetadataMap; +use tonic::transport::Server as TonicServer; +use tonic::{Response, Status}; +use tonic_tracing_opentelemetry::middleware::server; +use tower::make::Shared; +use tracing_subscriber::layer::SubscriberExt; + +pub mod news { + tonic::include_proto!("news"); // The package name specified in your .proto + pub(crate) const FILE_DESCRIPTOR_SET: &[u8] = + tonic::include_file_descriptor_set!("news_descriptor"); +} + +#[derive(Debug, Default)] +pub struct MyNewsService { + news: Arc>>, // Using a simple vector to store news items in memory +} + +impl MyNewsService { + fn new() -> MyNewsService { + let news = vec![ + News { + id: 1, + title: "Note 1".into(), + body: "Content 1".into(), + post_image: "Post image 1".into(), + status: 0, + }, + News { + id: 2, + title: "Note 2".into(), + body: "Content 2".into(), + post_image: "Post image 2".into(), + status: 1, + }, + News { + id: 3, + title: "Note 3".into(), + body: "Content 3".into(), + post_image: "Post image 3".into(), + status: 1, + }, + News { + id: 4, + title: "Note 4".into(), + body: "Content 4".into(), + post_image: "Post image 4".into(), + status: 1, + }, + News { + id: 5, + title: "Note 5".into(), + body: "Content 5".into(), + post_image: "Post image 5".into(), + status: 1, + }, + ]; + MyNewsService { news: Arc::new(Mutex::new(news)) } + } +} + +#[tonic::async_trait] +impl NewsService for MyNewsService { + async fn get_all_news( + &self, + _request: tonic::Request<()>, + ) -> std::result::Result, Status> { + let lock = self.news.lock().unwrap(); + let reply = NewsList { news: lock.clone() }; + Ok(Response::new(reply)) + } + + async fn get_news( + &self, + request: tonic::Request, + ) -> std::result::Result, Status> { + let id = request.into_inner().id; + let lock = self.news.lock().unwrap(); + let item = lock.iter().find(|&n| n.id == id).cloned(); + match item { + Some(news) => Ok(Response::new(news)), + None => Err(Status::not_found("News not found")), + } + } + + async fn get_multiple_news( + &self, + request: tonic::Request, + ) -> std::result::Result, Status> { + let ids = request + .into_inner() + .ids + .into_iter() + .map(|id| id.id) + .collect::>(); + let lock = self.news.lock().unwrap(); + let news_items: Vec = lock + .iter() + .filter(|n| ids.contains(&n.id)) + .cloned() + .collect(); + Ok(Response::new(NewsList { news: news_items })) + } + + async fn delete_news( + &self, + request: tonic::Request, + ) -> std::result::Result, Status> { + let id = request.into_inner().id; + let mut lock = self.news.lock().unwrap(); + let len_before = lock.len(); + lock.retain(|news| news.id != id); + let len_after = lock.len(); + + if len_before == len_after { + Err(Status::not_found("News not found")) + } else { + let x = Response::new(()); + Ok(x) + } + } + + async fn edit_news( + &self, + request: tonic::Request, + ) -> std::result::Result, Status> { + let new_news = request.into_inner(); + let mut lock = self.news.lock().unwrap(); + if let Some(news) = lock.iter_mut().find(|n| n.id == new_news.id) { + news.title = new_news.title.clone(); + news.body = new_news.body.clone(); + news.post_image = new_news.post_image.clone(); + return Ok(Response::new(new_news)); + } + Err(Status::not_found("News not found")) + } + + async fn add_news( + &self, + request: tonic::Request, + ) -> std::result::Result, Status> { + let mut news = request.into_inner(); + let mut lock = self.news.lock().unwrap(); + let new_id = lock.iter().map(|n| n.id).max().unwrap_or(0) + 1; // Simple ID generation + news.id = new_id; + lock.push(news.clone()); + Ok(Response::new(news)) + } +} + +static RESOURCE: Lazy = Lazy::new(|| { + Resource::default().merge(&Resource::new(vec![ + KeyValue::new( + opentelemetry_semantic_conventions::resource::SERVICE_NAME, + "rust-grpc", + ), + KeyValue::new( + opentelemetry_semantic_conventions::resource::SERVICE_VERSION, + "test", + ), + ])) +}); + +fn init_tracer() -> Result<()> { + global::set_text_map_propagator(TraceContextPropagator::new()); + + static TELEMETRY_URL: &str = "https://api.honeycomb.io:443"; + let headers = HeaderMap::from_iter([( + HeaderName::from_static("x-honeycomb-team"), + HeaderValue::from_str(&std::env::var("HONEYCOMB_API_KEY")?)?, + )]); + + let otlp_exporter = opentelemetry_otlp::new_exporter() + .tonic() + .with_endpoint(TELEMETRY_URL) + .with_metadata(MetadataMap::from_headers(headers)); + + let provider = opentelemetry_otlp::new_pipeline() + .tracing() + .with_exporter(otlp_exporter) + .with_trace_config(opentelemetry_sdk::trace::config().with_resource(RESOURCE.clone())) + .install_batch(runtime::Tokio)? + .provider() + .ok_or(TraceError::Other( + anyhow!("Failed to instantiate OTLP provider").into(), + ))?; + + let tracer = provider.tracer("tracing"); + let trace_layer = tracing_opentelemetry::layer() + .with_location(false) + .with_threads(false) + .with_tracer(tracer); + + let subscriber = tracing_subscriber::registry().with(trace_layer); + + tracing::subscriber::set_global_default(subscriber)?; + + global::set_tracer_provider(provider); + + Ok(()) +} + +#[tokio::main] +async fn main() -> Result<()> { + if std::env::var("HONEYCOMB_API_KEY").is_ok() { + init_tracer()?; + } + + let addr = ([127, 0, 0, 1], 50051).into(); + + let news_service = MyNewsService::new(); + let service = tonic_reflection::server::Builder::configure() + .register_encoded_file_descriptor_set(news::FILE_DESCRIPTOR_SET) + .build() + .unwrap(); + + println!("NewsService server listening on {}", addr); + + let tonic_service = TonicServer::builder() + .layer(server::OtelGrpcLayer::default()) + .add_service(NewsServiceServer::new(news_service)) + .add_service(service) + .into_service(); + let make_svc = Shared::new(tonic_service); + println!("Server listening on grpc://{}", addr); + let server = hyper::Server::bind(&addr).serve(make_svc); + server.await?; + + Ok(()) +} diff --git a/tests/core/env.rs b/tests/core/env.rs new file mode 100644 index 0000000000..51f099372b --- /dev/null +++ b/tests/core/env.rs @@ -0,0 +1,23 @@ +extern crate core; + +use std::borrow::Cow; +use std::collections::HashMap; + +use tailcall::EnvIO; + +#[derive(Clone)] +pub struct Env { + vars: HashMap, +} + +impl EnvIO for Env { + fn get(&self, key: &str) -> Option> { + self.vars.get(key).map(Cow::from) + } +} + +impl Env { + pub fn init(vars: Option>) -> Self { + Self { vars: vars.unwrap_or_default() } + } +} diff --git a/tests/core/file.rs b/tests/core/file.rs new file mode 100644 index 0000000000..e784ed306c --- /dev/null +++ b/tests/core/file.rs @@ -0,0 +1,67 @@ +extern crate core; + +use std::path::PathBuf; + +use anyhow::{anyhow, Context}; +use tailcall::FileIO; +use tokio::io::{AsyncReadExt, AsyncWriteExt}; + +use super::runtime::ExecutionSpec; +pub struct File { + spec: ExecutionSpec, +} + +impl File { + pub fn new(spec: ExecutionSpec) -> File { + File { spec } + } +} + +#[async_trait::async_trait] +impl FileIO for File { + async fn write<'a>(&'a self, _path: &'a str, _content: &'a [u8]) -> anyhow::Result<()> { + Err(anyhow!("Cannot write to a file in an execution spec")) + } + + async fn read<'a>(&'a self, path: &'a str) -> anyhow::Result { + let base = PathBuf::from(path); + let path = base + .file_name() + .context("Invalid file path")? + .to_str() + .context("Invalid OsString")?; + match self.spec.files.get(path) { + Some(x) => Ok(x.to_owned()), + None => Err(anyhow!("No such file or directory (os error 2)")), + } + } +} + +#[derive(Clone)] +pub struct TestFileIO {} + +impl TestFileIO { + pub fn init() -> Self { + TestFileIO {} + } +} + +#[async_trait::async_trait] +impl FileIO for TestFileIO { + async fn write<'a>(&'a self, path: &'a str, content: &'a [u8]) -> anyhow::Result<()> { + let mut file = tokio::fs::File::create(path).await?; + file.write_all(content) + .await + .map_err(|e| anyhow!("{}", e))?; + Ok(()) + } + + async fn read<'a>(&'a self, path: &'a str) -> anyhow::Result { + let mut file = tokio::fs::File::open(path).await?; + let mut buffer = Vec::new(); + file.read_to_end(&mut buffer) + .await + .map_err(|e| anyhow!("{}", e))?; + Ok(String::from_utf8(buffer)?) + } +} diff --git a/tests/core/http.rs b/tests/core/http.rs new file mode 100644 index 0000000000..21d615e64a --- /dev/null +++ b/tests/core/http.rs @@ -0,0 +1,132 @@ +extern crate core; + +use std::path::Path; +use std::str::FromStr; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::Arc; + +use anyhow::anyhow; +use hyper::body::Bytes; +use reqwest::header::{HeaderName, HeaderValue}; +use tailcall::http::Response; +use tailcall::HttpIO; + +use super::runtime::{ExecutionMock, ExecutionSpec}; + +#[derive(Clone, Debug)] +pub struct Http { + mocks: Vec, + spec_path: String, +} + +impl Http { + pub fn new(spec: &ExecutionSpec) -> Self { + let mocks = spec + .mock + .as_ref() + .map(|mocks| { + mocks + .iter() + .map(|mock| ExecutionMock { + mock: mock.clone(), + actual_hits: Arc::new(AtomicUsize::default()), + }) + .collect() + }) + .unwrap_or_default(); + + let spec_path = spec + .path + .strip_prefix(std::env::current_dir().unwrap()) + .unwrap_or(&spec.path) + .to_string_lossy() + .into_owned(); + + Http { mocks, spec_path } + } + + pub fn test_hits(&self, path: impl AsRef) { + for mock in &self.mocks { + mock.test_hits(path.as_ref()); + } + } +} + +#[async_trait::async_trait] +impl HttpIO for Http { + async fn execute(&self, req: reqwest::Request) -> anyhow::Result> { + // Try to find a matching mock for the incoming request. + let execution_mock = self + .mocks + .iter() + .find(|mock| { + let mock_req = &mock.mock.request; + let method_match = req.method() == mock_req.0.method.clone().to_hyper(); + let url_match = req.url().as_str() == mock_req.0.url.clone().as_str(); + let body_match = mock_req + .0 + .body + .as_ref() + .map(|body| { + let mock_body = body.to_bytes(); + + req.body() + .and_then(|body| body.as_bytes().map(|req_body| req_body == mock_body)) + .unwrap_or(false) + }) + .unwrap_or(true); + + let headers_match = req + .headers() + .iter() + .filter(|(key, _)| *key != "content-type") + .all(|(key, value)| { + let header_name = key.to_string(); + + let header_value = value.to_str().unwrap(); + let mock_header_value = "".to_string(); + let mock_header_value = mock_req + .0 + .headers + .get(&header_name) + .unwrap_or(&mock_header_value); + header_value == mock_header_value + }); + method_match && url_match && headers_match && body_match + }) + .ok_or(anyhow!( + "No mock found for request: {:?} {} in {}", + req.method(), + req.url(), + self.spec_path + ))?; + + execution_mock.actual_hits.fetch_add(1, Ordering::Relaxed); + + // Clone the response from the mock to avoid borrowing issues. + let mock_response = execution_mock.mock.response.clone(); + + // Build the response with the status code from the mock. + let status_code = reqwest::StatusCode::from_u16(mock_response.0.status)?; + + if status_code.is_client_error() || status_code.is_server_error() { + return Err(anyhow::format_err!("Status code error")); + } + + let mut response = Response { status: status_code, ..Default::default() }; + + // Insert headers from the mock into the response. + for (key, value) in mock_response.0.headers { + let header_name = HeaderName::from_str(&key)?; + let header_value = HeaderValue::from_str(&value)?; + response.headers.insert(header_name, header_value); + } + + // Special Handling for GRPC + if let Some(body) = mock_response.0.body { + response.body = Bytes::from(body.to_bytes()); + } + + Ok(response) + } +} diff --git a/tests/core/mod.rs b/tests/core/mod.rs new file mode 100644 index 0000000000..87866778a3 --- /dev/null +++ b/tests/core/mod.rs @@ -0,0 +1,7 @@ +mod env; +mod file; +pub mod http; +mod model; +mod parse; +mod runtime; +pub mod spec; diff --git a/tests/core/model.rs b/tests/core/model.rs new file mode 100644 index 0000000000..0660493267 --- /dev/null +++ b/tests/core/model.rs @@ -0,0 +1,135 @@ +use std::collections::BTreeMap; +use std::panic; +use std::path::Path; + +use serde::{Deserialize, Serialize}; +use serde_json::Value; +use tailcall::http::Method; +use url::Url; + +#[derive(Serialize, Deserialize, Clone, Debug)] +#[serde(rename_all = "camelCase")] +pub enum Annotation { + Skip, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub struct UpstreamRequest(pub APIRequest); + +#[derive(Serialize, Deserialize, Clone, Debug)] +pub struct UpstreamResponse(pub APIResponse); + +mod default { + pub fn status() -> u16 { + 200 + } + + pub fn expected_hits() -> usize { + 1 + } + + pub fn assert_hits() -> bool { + true + } +} + +#[derive(Serialize, Deserialize, Clone, Debug)] +#[serde(rename_all = "camelCase")] +pub struct Mock { + pub request: UpstreamRequest, + pub response: UpstreamResponse, + #[serde(default = "default::assert_hits")] + pub assert_hits: bool, + #[serde(default = "default::expected_hits")] + pub expected_hits: usize, +} + +#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] +pub struct APIRequest { + #[serde(default)] + pub method: Method, + pub url: Url, + #[serde(default)] + pub headers: BTreeMap, + #[serde(flatten, default)] + pub body: Option, + #[serde(default)] + pub test_traces: bool, + #[serde(default)] + pub test_metrics: bool, +} + +#[derive(Serialize, Deserialize, Clone, Debug)] +#[serde(rename_all = "camelCase")] +pub struct APIResponse { + #[serde(default = "default::status")] + pub status: u16, + #[serde(default)] + pub headers: BTreeMap, + #[serde(flatten, default)] + pub body: Option, +} + +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)] +pub enum APIBody { + #[serde(rename = "textBody")] + Text(String), + #[serde(rename = "fileBody")] + File(String), + #[serde(rename = "body")] + Value(Value), +} + +impl APIBody { + pub fn to_bytes(&self) -> Vec { + match self { + APIBody::Value(value) => serde_json::to_vec(value) + .unwrap_or_else(|_| core::panic!("Failed to convert value: {value:?}")), + APIBody::Text(text) => string_to_bytes(text), + APIBody::File(file) => { + let path: Vec<&str> = file.rsplitn(2, '/').collect(); + match &path[..] { + &[file, prefix] => match prefix { + "grpc/reflection" => { + let path = + Path::new(tailcall_fixtures::grpc::reflection::SELF).join(file); + std::fs::read(&path).unwrap_or_else(|_| { + core::panic!("Failed to read file by path: {}", path.display()) + }) + } + _ => core::panic!("Invalid file path: {} {}", prefix, file), + }, + _ => core::panic!("Invalid file path: {}", file), + } + } + } + } +} + +fn string_to_bytes(input: &str) -> Vec { + let mut bytes = Vec::new(); + let mut chars = input.chars().peekable(); + + while let Some(c) = chars.next() { + match c { + '\\' => match chars.next() { + Some('0') => bytes.push(0), + Some('n') => bytes.push(b'\n'), + Some('t') => bytes.push(b'\t'), + Some('r') => bytes.push(b'\r'), + Some('\\') => bytes.push(b'\\'), + Some('\"') => bytes.push(b'\"'), + Some('x') => { + let mut hex = chars.next().unwrap().to_string(); + hex.push(chars.next().unwrap()); + let byte = u8::from_str_radix(&hex, 16).unwrap(); + bytes.push(byte); + } + _ => panic!("Unsupported escape sequence"), + }, + _ => bytes.push(c as u8), + } + } + + bytes +} diff --git a/tests/core/parse.rs b/tests/core/parse.rs new file mode 100644 index 0000000000..303744f300 --- /dev/null +++ b/tests/core/parse.rs @@ -0,0 +1,305 @@ +extern crate core; + +use std::borrow::Cow; +use std::collections::{BTreeMap, HashMap}; +use std::panic; +use std::path::Path; +use std::str::FromStr; +use std::sync::Arc; + +use anyhow::anyhow; +use markdown::mdast::Node; +use markdown::ParseOptions; +use tailcall::blueprint::Blueprint; +use tailcall::cache::InMemoryCache; +use tailcall::cli::javascript; +use tailcall::config::{ConfigModule, Source}; +use tailcall::http::AppContext; +use tailcall::runtime::TargetRuntime; +use tailcall::EnvIO; + +use super::file::File; +use super::http::Http; +use super::model::*; +use super::runtime::ExecutionSpec; + +struct Env { + env: HashMap, +} + +impl EnvIO for Env { + fn get(&self, key: &str) -> Option> { + self.env.get(key).map(Cow::from) + } +} + +impl Env { + pub fn init(map: HashMap) -> Self { + Self { env: map } + } +} + +impl ExecutionSpec { + pub async fn from_source(path: &Path, contents: String) -> anyhow::Result { + let ast = markdown::to_mdast(&contents, &ParseOptions::default()).unwrap(); + let mut children = ast + .children() + .unwrap_or_else(|| panic!("Failed to parse {:?}: empty file unexpected", path)) + .iter() + .peekable(); + + let mut name: Option = None; + let mut server: Vec<(Source, String)> = Vec::with_capacity(2); + let mut mock: Option> = None; + let mut env: Option> = None; + let mut files: BTreeMap = BTreeMap::new(); + let mut test: Option> = None; + let mut runner: Option = None; + let mut check_identity = false; + let mut sdl_error = false; + + while let Some(node) = children.next() { + match node { + Node::Heading(heading) => { + if heading.depth == 1 { + // Parse test name + if name.is_none() { + if let Some(Node::Text(text)) = heading.children.first() { + name = Some(text.value.clone()); + } else { + return Err(anyhow!( + "Unexpected content of level 1 heading in {:?}: {:#?}", + path, + heading + )); + } + } else { + return Err(anyhow!( + "Unexpected double-declaration of test name in {:?}", + path + )); + } + + // Consume optional test description + if let Some(Node::Paragraph(_)) = children.peek() { + let _ = children.next(); + } + } else if heading.depth == 2 { + if let Some(Node::Text(expect)) = heading.children.first() { + let split = expect.value.splitn(2, ':').collect::>(); + match split[..] { + [a, b] => { + check_identity = + a.contains("check_identity") && b.ends_with("true"); + sdl_error = a.contains("expect_validation_error") + && b.ends_with("true"); + } + _ => { + return Err(anyhow!( + "Unexpected header annotation {:?} in {:?}", + expect.value, + path, + )) + } + } + } + } else if heading.depth == 5 { + // Parse annotation + if runner.is_none() { + if let Some(Node::Text(text)) = heading.children.first() { + runner = Some(match text.value.as_str() { + "skip" => Annotation::Skip, + _ => { + return Err(anyhow!( + "Unexpected runner annotation {:?} in {:?}", + text.value, + path, + )); + } + }); + } else { + return Err(anyhow!( + "Unexpected content of level 5 heading in {:?}: {:#?}", + path, + heading + )); + } + } else { + return Err(anyhow!( + "Unexpected double-declaration of runner annotation in {:?}", + path + )); + } + } else if heading.depth == 4 { + } else { + return Err(anyhow!( + "Unexpected level {} heading in {:?}: {:#?}", + heading.depth, + path, + heading + )); + } + } + Node::Code(code) => { + // Parse following code block + let (content, lang, meta) = { + ( + code.value.to_owned(), + code.lang.to_owned(), + code.meta.to_owned(), + ) + }; + if let Some(meta_str) = meta.as_ref().filter(|s| s.contains('@')) { + let temp_cleaned_meta = meta_str.replace('@', ""); + let name: &str = &temp_cleaned_meta; + if let Some(name) = name.strip_prefix("file:") { + if files.insert(name.to_string(), content).is_some() { + return Err(anyhow!( + "Double declaration of file {:?} in {:#?}", + name, + path + )); + } + } else { + let lang = match lang { + Some(x) => Ok(x), + None => Err(anyhow!( + "Unexpected code block with no specific language in {:?}", + path + )), + }?; + + let source = Source::from_str(&lang)?; + + match name { + "server" => { + // Server configs are only parsed if the test isn't skipped. + server.push((source, content)); + } + "mock" => { + if mock.is_none() { + mock = match source { + Source::Json => Ok(serde_json::from_str(&content)?), + Source::Yml => Ok(serde_yaml::from_str(&content)?), + _ => Err(anyhow!("Unexpected language in mock block in {:?} (only JSON and YAML are supported)", path)), + }?; + } else { + return Err(anyhow!("Unexpected number of mock blocks in {:?} (only one is allowed)", path)); + } + } + "env" => { + if env.is_none() { + env = match source { + Source::Json => Ok(serde_json::from_str(&content)?), + Source::Yml => Ok(serde_yaml::from_str(&content)?), + _ => Err(anyhow!("Unexpected language in env block in {:?} (only JSON and YAML are supported)", path)), + }?; + } else { + return Err(anyhow!("Unexpected number of env blocks in {:?} (only one is allowed)", path)); + } + } + "test" => { + if test.is_none() { + test = match source { + Source::Json => Ok(serde_json::from_str(&content)?), + Source::Yml => Ok(serde_yaml::from_str(&content)?), + _ => Err(anyhow!("Unexpected language in test block in {:?} (only JSON and YAML are supported)", path)), + }?; + } else { + return Err(anyhow!("Unexpected number of test blocks in {:?} (only one is allowed)", path)); + } + } + _ => { + return Err(anyhow!( + "Unexpected component {:?} in {:?}: {:#?}", + name, + path, + meta + )); + } + } + } + } else { + return Err(anyhow!( + "Unexpected content of code in {:?}: {:#?}", + path, + meta + )); + } + } + Node::Definition(d) => { + if let Some(title) = &d.title { + tracing::info!("Comment found in: {:?} with title: {}", path, title); + } + } + Node::ThematicBreak(_) => { + // skip this for and put execute logic in heading.depth + // above to escape ThematicBreaks like + // `---`, `***` or `___` + } + _ => return Err(anyhow!("Unexpected node in {:?}: {:#?}", path, node)), + } + } + + if server.is_empty() { + return Err(anyhow!( + "Unexpected blocks in {:?}: You must define a GraphQL Config in an execution test.", + path, + )); + } + + let spec = ExecutionSpec { + path: path.to_owned(), + name: name.unwrap_or_else(|| path.file_name().unwrap().to_str().unwrap().to_string()), + safe_name: path.file_name().unwrap().to_str().unwrap().to_string(), + + server, + mock, + env, + test, + files, + + runner, + + check_identity, + sdl_error, + }; + + anyhow::Ok(spec) + } + + pub async fn app_context( + &self, + config: &ConfigModule, + env: HashMap, + http_client: Arc, + ) -> Arc { + let blueprint = Blueprint::try_from(config).unwrap(); + let http = if let Some(script) = blueprint.server.script.clone() { + javascript::init_http(http_client, script) + } else { + http_client + }; + + let http2_only = http.clone(); + + let runtime = TargetRuntime { + http, + http2_only, + file: Arc::new(File::new(self.clone())), + env: Arc::new(Env::init(env)), + cache: Arc::new(InMemoryCache::new()), + extensions: Arc::new(vec![]), + }; + + let endpoints = config + .extensions + .endpoint_set + .clone() + .into_checked(&blueprint, runtime.clone()) + .await + .unwrap(); + + Arc::new(AppContext::new(blueprint, runtime, endpoints)) + } +} diff --git a/tests/core/runtime.rs b/tests/core/runtime.rs new file mode 100644 index 0000000000..0b198a4796 --- /dev/null +++ b/tests/core/runtime.rs @@ -0,0 +1,91 @@ +extern crate core; + +use std::collections::{BTreeMap, HashMap}; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::Arc; + +use derive_setters::Setters; +use tailcall::blueprint; +use tailcall::cache::InMemoryCache; +use tailcall::cli::javascript; +use tailcall::config::Source; +use tailcall::runtime::TargetRuntime; + +use super::env::Env; +use super::file::TestFileIO; +use super::http::Http; +use super::model::*; + +#[derive(Clone, Setters)] +pub struct ExecutionSpec { + pub path: PathBuf, + pub name: String, + pub safe_name: String, + + pub server: Vec<(Source, String)>, + pub mock: Option>, + pub env: Option>, + pub test: Option>, + pub files: BTreeMap, + + // Annotations for the runner + pub runner: Option, + + pub check_identity: bool, + pub sdl_error: bool, +} + +#[derive(Clone, Debug)] +pub struct ExecutionMock { + pub mock: Mock, + pub actual_hits: Arc, +} + +impl ExecutionMock { + pub fn test_hits(&self, path: impl AsRef) { + let url = &self.mock.request.0.url; + if !self.mock.assert_hits { + return; + } + let expected_hits = self.mock.expected_hits; + let actual_hits = self.actual_hits.load(Ordering::Relaxed); + + assert_eq!( + expected_hits, + actual_hits, + "expected mock for {} to be hit exactly {} times, but it was hit {} times for file: {:?}", url, expected_hits, actual_hits, + path.as_ref() + ); + } +} + +pub fn create_runtime( + http_client: Arc, + env: Option>, + script: Option, +) -> TargetRuntime { + let http = if let Some(script) = script.clone() { + javascript::init_http(http_client.clone(), script) + } else { + http_client.clone() + }; + + let http2 = if let Some(script) = script { + javascript::init_http(http_client.clone(), script) + } else { + http_client.clone() + }; + + let file = TestFileIO::init(); + let env = Env::init(env); + + TargetRuntime { + http, + http2_only: http2, + env: Arc::new(env), + file: Arc::new(file), + cache: Arc::new(InMemoryCache::new()), + extensions: Arc::new(vec![]), + } +} diff --git a/tests/core/snapshots/add-field-index-list.md_0.snap b/tests/core/snapshots/add-field-index-list.md_0.snap new file mode 100644 index 0000000000..a5b7c188b6 --- /dev/null +++ b/tests/core/snapshots/add-field-index-list.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "username": "Leanne Graham" + } + } +} diff --git a/tests/core/snapshots/add-field-index-list.md_client.snap b/tests/core/snapshots/add-field-index-list.md_client.snap new file mode 100644 index 0000000000..d5d22b778c --- /dev/null +++ b/tests/core/snapshots/add-field-index-list.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + username: String + users: [User] +} + +scalar Url + +type User { + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/add-field-index-list.md_merged.snap b/tests/core/snapshots/add-field-index-list.md_merged.snap new file mode 100644 index 0000000000..592c6f8c8f --- /dev/null +++ b/tests/core/snapshots/add-field-index-list.md_merged.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query @addField(name: "username", path: ["users", "0", "name"]) { + users: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") +} + +type User { + name: String +} diff --git a/tests/core/snapshots/add-field-many-list.md_client.snap b/tests/core/snapshots/add-field-many-list.md_client.snap new file mode 100644 index 0000000000..f9e78bca84 --- /dev/null +++ b/tests/core/snapshots/add-field-many-list.md_client.snap @@ -0,0 +1,37 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type A { + b: [String] + c: String + d: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + u: U +} + +type U { + a: A + b: [String] + c: String + d: String + e: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/add-field-many-list.md_merged.snap b/tests/core/snapshots/add-field-many-list.md_merged.snap new file mode 100644 index 0000000000..e5802ae7b9 --- /dev/null +++ b/tests/core/snapshots/add-field-many-list.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type A { + b: [String] + c: String + d: String +} + +type Query { + u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") +} + +type U @addField(name: "b", path: ["a", "b"]) @addField(name: "c", path: ["a", "c"]) @addField(name: "d", path: ["a", "d"]) { + a: A + e: String +} diff --git a/tests/core/snapshots/add-field-many.md_client.snap b/tests/core/snapshots/add-field-many.md_client.snap new file mode 100644 index 0000000000..df7485155d --- /dev/null +++ b/tests/core/snapshots/add-field-many.md_client.snap @@ -0,0 +1,37 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +type Foo { + a: String + b: String + c: String + name: String + x: X +} + +scalar JSON + +scalar PhoneNumber + +type Query { + user: Foo +} + +scalar Url + +type X { + a: String + b: String + c: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/add-field-many.md_merged.snap b/tests/core/snapshots/add-field-many.md_merged.snap new file mode 100644 index 0000000000..647189833f --- /dev/null +++ b/tests/core/snapshots/add-field-many.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Foo @addField(name: "a", path: ["x", "a"]) @addField(name: "b", path: ["x", "b"]) @addField(name: "c", path: ["x", "c"]) { + name: String + x: X +} + +type Query { + user: Foo @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type X { + a: String + b: String + c: String +} diff --git a/tests/core/snapshots/add-field-modify.md_0.snap b/tests/core/snapshots/add-field-modify.md_0.snap new file mode 100644 index 0000000000..0e5c653400 --- /dev/null +++ b/tests/core/snapshots/add-field-modify.md_0.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": "foo", + "street": "Kulas Light", + "city": "Gwenborough", + "zipcode": "92998-3874" + } + } + } +} diff --git a/tests/core/snapshots/add-field-modify.md_client.snap b/tests/core/snapshots/add-field-modify.md_client.snap new file mode 100644 index 0000000000..fc6f9a2307 --- /dev/null +++ b/tests/core/snapshots/add-field-modify.md_client.snap @@ -0,0 +1,37 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Address { + city: String + street: String + zipcode: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + address: Address + city: String + name: String + street: String + zipcode: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/add-field-modify.md_merged.snap b/tests/core/snapshots/add-field-modify.md_merged.snap new file mode 100644 index 0000000000..9c5aa370a1 --- /dev/null +++ b/tests/core/snapshots/add-field-modify.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + city: String + street: String + zipcode: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User @addField(name: "street", path: ["address", "street"]) @addField(name: "city", path: ["address", "city"]) @addField(name: "zipcode", path: ["address", "zipcode"]) { + address: Address + name: String +} diff --git a/tests/core/snapshots/add-field-with-composition.md_0.snap b/tests/core/snapshots/add-field-with-composition.md_0.snap new file mode 100644 index 0000000000..68e1ab14ee --- /dev/null +++ b/tests/core/snapshots/add-field-with-composition.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "lat": "-37.3159" + } + } +} diff --git a/tests/core/snapshots/add-field-with-composition.md_1.snap b/tests/core/snapshots/add-field-with-composition.md_1.snap new file mode 100644 index 0000000000..cbe3b96cf9 --- /dev/null +++ b/tests/core/snapshots/add-field-with-composition.md_1.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "lng": "81.1496" + } + } +} diff --git a/tests/core/snapshots/add-field-with-composition.md_client.snap b/tests/core/snapshots/add-field-with-composition.md_client.snap new file mode 100644 index 0000000000..4523b470a5 --- /dev/null +++ b/tests/core/snapshots/add-field-with-composition.md_client.snap @@ -0,0 +1,39 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Address { + geo: Geo + street: String +} + +scalar Date + +scalar Email + +scalar Empty + +type Geo { + lat: String + lng: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + lat: String + lng: String + user: User +} + +scalar Url + +type User { + address: Address +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/add-field-with-composition.md_merged.snap b/tests/core/snapshots/add-field-with-composition.md_merged.snap new file mode 100644 index 0000000000..973665cb76 --- /dev/null +++ b/tests/core/snapshots/add-field-with-composition.md_merged.snap @@ -0,0 +1,25 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + geo: Geo + street: String +} + +type Geo { + lat: String + lng: String +} + +type Query @addField(name: "lat", path: ["user", "address", "geo", "lat"]) @addField(name: "lng", path: ["user", "address", "geo", "lng"]) { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + address: Address +} diff --git a/tests/core/snapshots/add-field-with-modify.md_0.snap b/tests/core/snapshots/add-field-with-modify.md_0.snap new file mode 100644 index 0000000000..f6d155936f --- /dev/null +++ b/tests/core/snapshots/add-field-with-modify.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user1": "Leanne Graham" + } + } +} diff --git a/tests/core/snapshots/add-field-with-modify.md_1.snap b/tests/core/snapshots/add-field-with-modify.md_1.snap new file mode 100644 index 0000000000..7dbe361ffc --- /dev/null +++ b/tests/core/snapshots/add-field-with-modify.md_1.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user2": "Ervin Howell" + } + } +} diff --git a/tests/core/snapshots/add-field-with-modify.md_client.snap b/tests/core/snapshots/add-field-with-modify.md_client.snap new file mode 100644 index 0000000000..742a75a643 --- /dev/null +++ b/tests/core/snapshots/add-field-with-modify.md_client.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + person1: User + person2: User + user1: String + user2: String +} + +scalar Url + +type User { + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/add-field-with-modify.md_merged.snap b/tests/core/snapshots/add-field-with-modify.md_merged.snap new file mode 100644 index 0000000000..cad2840a4c --- /dev/null +++ b/tests/core/snapshots/add-field-with-modify.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query @addField(name: "user1", path: ["person1", "name"]) @addField(name: "user2", path: ["person2", "name"]) { + person1: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + person2: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/2") +} + +type User { + name: String +} diff --git a/tests/core/snapshots/add-field.md_0.snap b/tests/core/snapshots/add-field.md_0.snap new file mode 100644 index 0000000000..46dcd8c3b2 --- /dev/null +++ b/tests/core/snapshots/add-field.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "lat": "-37.3159" + } + } + } +} diff --git a/tests/core/snapshots/add-field.md_client.snap b/tests/core/snapshots/add-field.md_client.snap new file mode 100644 index 0000000000..2f1822decb --- /dev/null +++ b/tests/core/snapshots/add-field.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Address { + geo: Geo +} + +scalar Date + +scalar Email + +scalar Empty + +type Geo { + lat: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + address: Address + lat: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/add-field.md_merged.snap b/tests/core/snapshots/add-field.md_merged.snap new file mode 100644 index 0000000000..82d16a885b --- /dev/null +++ b/tests/core/snapshots/add-field.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + geo: Geo +} + +type Geo { + lat: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User @addField(name: "lat", path: ["address", "geo", "lat"]) { + address: Address +} diff --git a/tests/core/snapshots/apollo-tracing.md_0.snap b/tests/core/snapshots/apollo-tracing.md_0.snap new file mode 100644 index 0000000000..d1aa07b391 --- /dev/null +++ b/tests/core/snapshots/apollo-tracing.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "hello": "hello" + } + } +} diff --git a/tests/core/snapshots/apollo-tracing.md_client.snap b/tests/core/snapshots/apollo-tracing.md_client.snap new file mode 100644 index 0000000000..bc438e3a5d --- /dev/null +++ b/tests/core/snapshots/apollo-tracing.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + hello: String! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/apollo-tracing.md_merged.snap b/tests/core/snapshots/apollo-tracing.md_merged.snap new file mode 100644 index 0000000000..c65bafe30d --- /dev/null +++ b/tests/core/snapshots/apollo-tracing.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream { + query: Query +} + +type Query { + hello: String! @http(baseURL: "http://api.com", path: "/") +} diff --git a/tests/core/snapshots/auth-basic.md_0.snap b/tests/core/snapshots/auth-basic.md_0.snap new file mode 100644 index 0000000000..19966dbd12 --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_0.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "scalar": "data from public scalar", + "nested": { + "name": "nested name" + } + } + } +} diff --git a/tests/core/snapshots/auth-basic.md_1.snap b/tests/core/snapshots/auth-basic.md_1.snap new file mode 100644 index 0000000000..5fd8164e7c --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_1.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Authentication Failure: Missing Authorization Header", + "locations": [ + { + "line": 2, + "column": 3 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/auth-basic.md_2.snap b/tests/core/snapshots/auth-basic.md_2.snap new file mode 100644 index 0000000000..1147bdbb16 --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_2.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Authentication Failure: Invalid Authorization Header", + "locations": [ + { + "line": 2, + "column": 3 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/auth-basic.md_3.snap b/tests/core/snapshots/auth-basic.md_3.snap new file mode 100644 index 0000000000..5a8bbd2fd3 --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_3.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "protectedScalar": "data from protected scalar", + "nested": { + "name": "nested name", + "protected": "protected nested" + }, + "protectedType": { + "name": "protected type name", + "nested": "protected type nested" + } + } + } +} diff --git a/tests/core/snapshots/auth-basic.md_4.snap b/tests/core/snapshots/auth-basic.md_4.snap new file mode 100644 index 0000000000..5fd8164e7c --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_4.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Authentication Failure: Missing Authorization Header", + "locations": [ + { + "line": 2, + "column": 3 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/auth-basic.md_5.snap b/tests/core/snapshots/auth-basic.md_5.snap new file mode 100644 index 0000000000..1afd85d51b --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_5.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "protectedType": { + "name": "mutation name", + "nested": "mutation nested" + } + } + } +} diff --git a/tests/core/snapshots/auth-basic.md_6.snap b/tests/core/snapshots/auth-basic.md_6.snap new file mode 100644 index 0000000000..1147bdbb16 --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_6.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Authentication Failure: Invalid Authorization Header", + "locations": [ + { + "line": 2, + "column": 3 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/auth-basic.md_client.snap b/tests/core/snapshots/auth-basic.md_client.snap new file mode 100644 index 0000000000..6e5e77070f --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_client.snap @@ -0,0 +1,41 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type Mutation { + protectedType: ProtectedType +} + +type Nested { + name: String! + protected: String! +} + +scalar PhoneNumber + +type ProtectedType { + name: String! + nested: String! +} + +type Query { + nested: Nested! + protectedScalar: String! + protectedType: ProtectedType + scalar: String! +} + +scalar Url + +schema { + query: Query + mutation: Mutation +} diff --git a/tests/core/snapshots/auth-basic.md_merged.snap b/tests/core/snapshots/auth-basic.md_merged.snap new file mode 100644 index 0000000000..4e174cdbc4 --- /dev/null +++ b/tests/core/snapshots/auth-basic.md_merged.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream @link(id: "htpasswd", src: ".htpasswd", type: Htpasswd) { + query: Query + mutation: Mutation +} + +type Mutation { + protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") +} + +type Nested { + name: String! + protected: String! @protected +} + +type ProtectedType @protected { + name: String! + nested: String! +} + +type Query { + nested: Nested! @expr(body: {name: "nested name", protected: "protected nested"}) + protectedScalar: String! @expr(body: "data from protected scalar") @protected + protectedType: ProtectedType @expr(body: {name: "protected type name", nested: "protected type nested"}) + scalar: String! @expr(body: "data from public scalar") +} diff --git a/tests/core/snapshots/auth-jwt.md_0.snap b/tests/core/snapshots/auth-jwt.md_0.snap new file mode 100644 index 0000000000..19966dbd12 --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_0.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "scalar": "data from public scalar", + "nested": { + "name": "nested name" + } + } + } +} diff --git a/tests/core/snapshots/auth-jwt.md_1.snap b/tests/core/snapshots/auth-jwt.md_1.snap new file mode 100644 index 0000000000..5fd8164e7c --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_1.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Authentication Failure: Missing Authorization Header", + "locations": [ + { + "line": 2, + "column": 3 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/auth-jwt.md_2.snap b/tests/core/snapshots/auth-jwt.md_2.snap new file mode 100644 index 0000000000..5a8bbd2fd3 --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_2.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "protectedScalar": "data from protected scalar", + "nested": { + "name": "nested name", + "protected": "protected nested" + }, + "protectedType": { + "name": "protected type name", + "nested": "protected type nested" + } + } + } +} diff --git a/tests/core/snapshots/auth-jwt.md_3.snap b/tests/core/snapshots/auth-jwt.md_3.snap new file mode 100644 index 0000000000..5fd8164e7c --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_3.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Authentication Failure: Missing Authorization Header", + "locations": [ + { + "line": 2, + "column": 3 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/auth-jwt.md_4.snap b/tests/core/snapshots/auth-jwt.md_4.snap new file mode 100644 index 0000000000..1afd85d51b --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_4.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "protectedType": { + "name": "mutation name", + "nested": "mutation nested" + } + } + } +} diff --git a/tests/core/snapshots/auth-jwt.md_5.snap b/tests/core/snapshots/auth-jwt.md_5.snap new file mode 100644 index 0000000000..1147bdbb16 --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_5.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Authentication Failure: Invalid Authorization Header", + "locations": [ + { + "line": 2, + "column": 3 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/auth-jwt.md_client.snap b/tests/core/snapshots/auth-jwt.md_client.snap new file mode 100644 index 0000000000..6e5e77070f --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_client.snap @@ -0,0 +1,41 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type Mutation { + protectedType: ProtectedType +} + +type Nested { + name: String! + protected: String! +} + +scalar PhoneNumber + +type ProtectedType { + name: String! + nested: String! +} + +type Query { + nested: Nested! + protectedScalar: String! + protectedType: ProtectedType + scalar: String! +} + +scalar Url + +schema { + query: Query + mutation: Mutation +} diff --git a/tests/core/snapshots/auth-jwt.md_merged.snap b/tests/core/snapshots/auth-jwt.md_merged.snap new file mode 100644 index 0000000000..9ea0b077da --- /dev/null +++ b/tests/core/snapshots/auth-jwt.md_merged.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream @link(id: "jwks", src: "jwks.json", type: Jwks) { + query: Query + mutation: Mutation +} + +type Mutation { + protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") +} + +type Nested { + name: String! + protected: String! @protected +} + +type ProtectedType @protected { + name: String! + nested: String! +} + +type Query { + nested: Nested! @expr(body: {name: "nested name", protected: "protected nested"}) + protectedScalar: String! @expr(body: "data from protected scalar") @protected + protectedType: ProtectedType @expr(body: {name: "protected type name", nested: "protected type nested"}) + scalar: String! @expr(body: "data from public scalar") +} diff --git a/tests/core/snapshots/auth.md_client.snap b/tests/core/snapshots/auth.md_client.snap new file mode 100644 index 0000000000..225f264c60 --- /dev/null +++ b/tests/core/snapshots/auth.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + data: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/auth.md_merged.snap b/tests/core/snapshots/auth.md_merged.snap new file mode 100644 index 0000000000..f89a8e3187 --- /dev/null +++ b/tests/core/snapshots/auth.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream @link(id: "htpasswd", src: ".htpasswd", type: Htpasswd) @link(id: "jwks", src: "jwks.json", type: Jwks) { + query: Query +} + +type Query { + data: String @expr(body: "data") @protected +} diff --git a/tests/core/snapshots/batching-default.md_0.snap b/tests/core/snapshots/batching-default.md_0.snap new file mode 100644 index 0000000000..f83fd2bba9 --- /dev/null +++ b/tests/core/snapshots/batching-default.md_0.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "user": { + "id": 1 + }, + "userId": 1 + }, + { + "user": { + "id": 2 + }, + "userId": 2 + } + ] + } + } +} diff --git a/tests/core/snapshots/batching-default.md_client.snap b/tests/core/snapshots/batching-default.md_client.snap new file mode 100644 index 0000000000..7ae47b261d --- /dev/null +++ b/tests/core/snapshots/batching-default.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + user: User + userId: Int! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/batching-default.md_merged.snap b/tests/core/snapshots/batching-default.md_merged.snap new file mode 100644 index 0000000000..0ef8726355 --- /dev/null +++ b/tests/core/snapshots/batching-default.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 10, headers: []}, httpCache: true) { + query: Query +} + +type Post { + body: String + id: Int + title: String + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}]) + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/batching-disabled.md_0.snap b/tests/core/snapshots/batching-disabled.md_0.snap new file mode 100644 index 0000000000..e8bca1fdcc --- /dev/null +++ b/tests/core/snapshots/batching-disabled.md_0.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "u1": { + "id": 1 + }, + "u2": { + "id": 2 + } + } + } +} diff --git a/tests/core/snapshots/batching-disabled.md_client.snap b/tests/core/snapshots/batching-disabled.md_client.snap new file mode 100644 index 0000000000..29257d2d5f --- /dev/null +++ b/tests/core/snapshots/batching-disabled.md_client.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + id: Int + name: String + username: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/batching-disabled.md_merged.snap b/tests/core/snapshots/batching-disabled.md_merged.snap new file mode 100644 index 0000000000..30586519f5 --- /dev/null +++ b/tests/core/snapshots/batching-disabled.md_merged.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 0, headers: [], maxSize: 100}, httpCache: true) { + query: Query +} + +type Query { + user(id: Int!): User @http(path: "/users/{{.args.id}}") +} + +type User { + id: Int + name: String + username: String +} diff --git a/tests/core/snapshots/batching-group-by-default.md_0.snap b/tests/core/snapshots/batching-group-by-default.md_0.snap new file mode 100644 index 0000000000..f83fd2bba9 --- /dev/null +++ b/tests/core/snapshots/batching-group-by-default.md_0.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "user": { + "id": 1 + }, + "userId": 1 + }, + { + "user": { + "id": 2 + }, + "userId": 2 + } + ] + } + } +} diff --git a/tests/core/snapshots/batching-group-by-default.md_client.snap b/tests/core/snapshots/batching-group-by-default.md_client.snap new file mode 100644 index 0000000000..7ae47b261d --- /dev/null +++ b/tests/core/snapshots/batching-group-by-default.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + user: User + userId: Int! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/batching-group-by-default.md_merged.snap b/tests/core/snapshots/batching-group-by-default.md_merged.snap new file mode 100644 index 0000000000..7dc15f9633 --- /dev/null +++ b/tests/core/snapshots/batching-group-by-default.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: true) { + query: Query +} + +type Post { + body: String + id: Int + title: String + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}]) + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/batching-group-by.md_0.snap b/tests/core/snapshots/batching-group-by.md_0.snap new file mode 100644 index 0000000000..f83fd2bba9 --- /dev/null +++ b/tests/core/snapshots/batching-group-by.md_0.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "user": { + "id": 1 + }, + "userId": 1 + }, + { + "user": { + "id": 2 + }, + "userId": 2 + } + ] + } + } +} diff --git a/tests/core/snapshots/batching-group-by.md_client.snap b/tests/core/snapshots/batching-group-by.md_client.snap new file mode 100644 index 0000000000..7ae47b261d --- /dev/null +++ b/tests/core/snapshots/batching-group-by.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + user: User + userId: Int! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/batching-group-by.md_merged.snap b/tests/core/snapshots/batching-group-by.md_merged.snap new file mode 100644 index 0000000000..2b75106aca --- /dev/null +++ b/tests/core/snapshots/batching-group-by.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: true) { + query: Query +} + +type Post { + body: String + id: Int + title: String + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}]) + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/batching-post.md_0.snap b/tests/core/snapshots/batching-post.md_0.snap new file mode 100644 index 0000000000..43853b4346 --- /dev/null +++ b/tests/core/snapshots/batching-post.md_0.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "user": { + "name": "Leanne Graham" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/batching-post.md_client.snap b/tests/core/snapshots/batching-post.md_client.snap new file mode 100644 index 0000000000..7ae47b261d --- /dev/null +++ b/tests/core/snapshots/batching-post.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + user: User + userId: Int! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/batching-post.md_merged.snap b/tests/core/snapshots/batching-post.md_merged.snap new file mode 100644 index 0000000000..34b9791fe7 --- /dev/null +++ b/tests/core/snapshots/batching-post.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: true) { + query: Query +} + +type Post { + body: String + id: Int + title: String + user: User @http(path: "/users/{{.value.userId}}") + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts?id=1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/batching.md_0.snap b/tests/core/snapshots/batching.md_0.snap new file mode 100644 index 0000000000..b1a1411d19 --- /dev/null +++ b/tests/core/snapshots/batching.md_0.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": [ + { + "data": { + "user": { + "id": 1 + } + } + }, + { + "data": { + "user": { + "name": "foo" + } + } + } + ] +} diff --git a/tests/core/snapshots/batching.md_1.snap b/tests/core/snapshots/batching.md_1.snap new file mode 100644 index 0000000000..4a83588a1a --- /dev/null +++ b/tests/core/snapshots/batching.md_1.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "id": 1 + } + } + } +} diff --git a/tests/core/snapshots/batching.md_2.snap b/tests/core/snapshots/batching.md_2.snap new file mode 100644 index 0000000000..2d278c54f5 --- /dev/null +++ b/tests/core/snapshots/batching.md_2.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": " --> 1:1\n |\n1 | FOO\n | ^---\n |\n = expected executable_definition", + "locations": [ + { + "line": 1, + "column": 1 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/batching.md_client.snap b/tests/core/snapshots/batching.md_client.snap new file mode 100644 index 0000000000..f8c9c2fa86 --- /dev/null +++ b/tests/core/snapshots/batching.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/batching.md_merged.snap b/tests/core/snapshots/batching.md_merged.snap new file mode 100644 index 0000000000..71f73427cb --- /dev/null +++ b/tests/core/snapshots/batching.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(batchRequests: true) @upstream { + query: Query +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/cache-control.md_0.snap b/tests/core/snapshots/cache-control.md_0.snap new file mode 100644 index 0000000000..c3c2762363 --- /dev/null +++ b/tests/core/snapshots/cache-control.md_0.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "cache-control": "max-age=3600", + "content-type": "application/json" + }, + "body": { + "data": { + "u1": { + "id": 1 + }, + "u2": { + "id": 2 + } + } + } +} diff --git a/tests/core/snapshots/cache-control.md_1.snap b/tests/core/snapshots/cache-control.md_1.snap new file mode 100644 index 0000000000..c84152761a --- /dev/null +++ b/tests/core/snapshots/cache-control.md_1.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "cache-control": "max-age=3600, private", + "content-type": "application/json" + }, + "body": { + "data": { + "u1": { + "id": 1 + }, + "u3": { + "id": 3 + } + } + } +} diff --git a/tests/core/snapshots/cache-control.md_2.snap b/tests/core/snapshots/cache-control.md_2.snap new file mode 100644 index 0000000000..5ca46d4fd2 --- /dev/null +++ b/tests/core/snapshots/cache-control.md_2.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "cache-control": "no-cache", + "content-type": "application/json" + }, + "body": { + "data": { + "u1": { + "id": 1 + }, + "u4": { + "id": 4 + } + } + } +} diff --git a/tests/core/snapshots/cache-control.md_3.snap b/tests/core/snapshots/cache-control.md_3.snap new file mode 100644 index 0000000000..33705363d3 --- /dev/null +++ b/tests/core/snapshots/cache-control.md_3.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "cache-control": "no-cache, private", + "content-type": "application/json" + }, + "body": { + "data": { + "u3": { + "id": 3 + }, + "u4": { + "id": 4 + } + } + } +} diff --git a/tests/core/snapshots/cache-control.md_client.snap b/tests/core/snapshots/cache-control.md_client.snap new file mode 100644 index 0000000000..7c0bdf72e9 --- /dev/null +++ b/tests/core/snapshots/cache-control.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int): User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/cache-control.md_merged.snap b/tests/core/snapshots/cache-control.md_merged.snap new file mode 100644 index 0000000000..ce75b519b4 --- /dev/null +++ b/tests/core/snapshots/cache-control.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {cacheControl: true}) @upstream { + query: Query +} + +type Query { + user(id: Int): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/caching-collision.md_0.snap b/tests/core/snapshots/caching-collision.md_0.snap new file mode 100644 index 0000000000..78dc9d88b8 --- /dev/null +++ b/tests/core/snapshots/caching-collision.md_0.snap @@ -0,0 +1,616 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "bars": [ + { + "foo": { + "id": 0 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBZh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 1 + }, + "id": "ByVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 2 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SE3mXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 3 + }, + "id": "BEVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 4 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DFPDXIwHe" + }, + { + "foo": { + "id": 5 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSoYIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 6 + }, + "id": "BVVLvrvaKTxZigeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 7 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEomXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 8 + }, + "id": "BVVLvrvaKFxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 9 + }, + "id": "BVVLvrvaKTxZdgeFvePbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 10 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jsz1qh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 11 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ5f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 12 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYftglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 13 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQ7YUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 14 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqp8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 15 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 16 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtHlFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 17 + }, + "id": "BVVLvrvaKTxZdgeFvbPbczXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 18 + }, + "id": "BVVLvrvaKTxZdgeF6bPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 19 + }, + "id": "BVVLvrvaKTxZdgeFGbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 20 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSxrIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 21 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSo9IxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 22 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjrXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 23 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FtO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 24 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3n2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 25 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FoO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 26 + }, + "id": "BVVLvVvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 27 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3VpzFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 28 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoumL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 29 + }, + "id": "BVVLvrvaKTYZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 30 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtgRFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 31 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sfZV2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 32 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwKe" + }, + { + "foo": { + "id": 33 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jjzyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 34 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmcWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 35 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFw4i4DNPDXIwHe" + }, + { + "foo": { + "id": 36 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL3345FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 37 + }, + "id": "BVVLvrvaKTxZdgaFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 38 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImR33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 39 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXRorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 40 + }, + "id": "BVVLvrvfKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 41 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQIf7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 42 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnOImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 43 + }, + "id": "BVVLvrvaKTxZdgeFvbPmckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 44 + }, + "id": "BVVLvrvaKTxZdgeFvbPbc9XSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 45 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3q7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 46 + }, + "id": "BVVLvrvaKTxZdgeFkbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 47 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoTmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 48 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIFmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 49 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33d5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 50 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSosIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 51 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SVjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 52 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4JszyJh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 53 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFhoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 54 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSSrIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 55 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Za6x1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 56 + }, + "id": "BVVLvrvaKTxZdgeFwbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 57 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SIjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 58 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImt33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 59 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoIwL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 60 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdw4DNPDXIwHe" + }, + { + "foo": { + "id": 61 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4J6zyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 62 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jskyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 63 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2NFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 64 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorFxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 65 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25yXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 66 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4lszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 67 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFmdi4DNPDXIwHe" + }, + { + "foo": { + "id": 68 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jsjyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 69 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sfXV2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 70 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYe25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 71 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSogIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 72 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33n5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 73 + }, + "id": "BVVLvrvaKTxZqgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 74 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwJi4DNPDXIwHe" + }, + { + "foo": { + "id": 75 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoKmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 76 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FY625TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 77 + }, + "id": "BVVLvrvaKTzZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 78 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoIFL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 79 + }, + "id": "BVVLvrvNKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 80 + }, + "id": "BVVLvrvaKTMZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 81 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFyoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 82 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3VqzFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 83 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4oszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 84 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDHIwHe" + }, + { + "foo": { + "id": 85 + }, + "id": "BVVLvrvaKvxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 86 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1yf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 87 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f8Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 88 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25rXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 89 + }, + "id": "BVVLvrvaKTxZdgPFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 90 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi45NPDXIwHe" + }, + { + "foo": { + "id": 91 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQHf7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 92 + }, + "id": "BVVLvrvaKTxZdgeFvbPb9kXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 93 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnonmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 94 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUhkJszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 95 + }, + "id": "BVVLvrvFKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 96 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5SYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 97 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Pszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 98 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtgHFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + }, + { + "foo": { + "id": 99 + }, + "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmIUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" + } + ] + } + } +} diff --git a/tests/core/snapshots/caching-collision.md_client.snap b/tests/core/snapshots/caching-collision.md_client.snap new file mode 100644 index 0000000000..97f888869d --- /dev/null +++ b/tests/core/snapshots/caching-collision.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Bar { + foo: Foo + id: String! +} + +scalar Date + +scalar Email + +scalar Empty + +type Foo { + id: Int! +} + +scalar JSON + +scalar PhoneNumber + +type Query { + bars: [Bar] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/caching-collision.md_merged.snap b/tests/core/snapshots/caching-collision.md_merged.snap new file mode 100644 index 0000000000..39aa88d47e --- /dev/null +++ b/tests/core/snapshots/caching-collision.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Bar { + foo: Foo @http(path: "/foo?id={{.value.id}}") @cache(maxAge: 300) + id: String! +} + +type Foo { + id: Int! +} + +type Query @cache(maxAge: 100) { + bars: [Bar] @http(path: "/bars") +} diff --git a/tests/core/snapshots/caching.md_0.snap b/tests/core/snapshots/caching.md_0.snap new file mode 100644 index 0000000000..2121b43f17 --- /dev/null +++ b/tests/core/snapshots/caching.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "fieldCache": { + "id": 1 + } + } + } +} diff --git a/tests/core/snapshots/caching.md_1.snap b/tests/core/snapshots/caching.md_1.snap new file mode 100644 index 0000000000..40625200f5 --- /dev/null +++ b/tests/core/snapshots/caching.md_1.snap @@ -0,0 +1,47 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "fieldCache": { + "id": 1 + }, + "fieldCacheList": [ + { + "id": 1 + }, + { + "id": 2 + }, + { + "id": 3 + } + ], + "typeCache": { + "a": { + "id": 11 + }, + "b": { + "id": 21 + }, + "list": [ + { + "id": 31 + }, + { + "id": 32 + }, + { + "id": 33 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/caching.md_2.snap b/tests/core/snapshots/caching.md_2.snap new file mode 100644 index 0000000000..40625200f5 --- /dev/null +++ b/tests/core/snapshots/caching.md_2.snap @@ -0,0 +1,47 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "fieldCache": { + "id": 1 + }, + "fieldCacheList": [ + { + "id": 1 + }, + { + "id": 2 + }, + { + "id": 3 + } + ], + "typeCache": { + "a": { + "id": 11 + }, + "b": { + "id": 21 + }, + "list": [ + { + "id": 31 + }, + { + "id": 32 + }, + { + "id": 33 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/caching.md_client.snap b/tests/core/snapshots/caching.md_client.snap new file mode 100644 index 0000000000..4b27eea358 --- /dev/null +++ b/tests/core/snapshots/caching.md_client.snap @@ -0,0 +1,35 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + fieldCache: Type + fieldCacheList: [Type] + typeCache: TypeCache +} + +type Type { + id: Int +} + +type TypeCache { + a: Type + b: Type + list: [Type] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/caching.md_merged.snap b/tests/core/snapshots/caching.md_merged.snap new file mode 100644 index 0000000000..c1bff907a4 --- /dev/null +++ b/tests/core/snapshots/caching.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Query { + fieldCache: Type @http(path: "/field-cache") @cache(maxAge: 30000) + fieldCacheList: [Type] @http(path: "/field-cache-list") @cache(maxAge: 30000) + typeCache: TypeCache +} + +type Type { + id: Int +} + +type TypeCache @cache(maxAge: 1000) { + a: Type @http(path: "/type-cache-a") + b: Type @http(path: "/type-cache-b") + list: [Type] @http(path: "/type-cache-list") +} diff --git a/tests/core/snapshots/call-graphql-datasource.md_0.snap b/tests/core/snapshots/call-graphql-datasource.md_0.snap new file mode 100644 index 0000000000..b4420e10c7 --- /dev/null +++ b/tests/core/snapshots/call-graphql-datasource.md_0.snap @@ -0,0 +1,40 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "title": "a", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "b", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "c", + "user": { + "name": "Ervin Howell" + } + }, + { + "title": "d", + "user": { + "name": "Ervin Howell" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-graphql-datasource.md_client.snap b/tests/core/snapshots/call-graphql-datasource.md_client.snap new file mode 100644 index 0000000000..95d3e97b5f --- /dev/null +++ b/tests/core/snapshots/call-graphql-datasource.md_client.snap @@ -0,0 +1,41 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String! + id: Int! + title: String! + user(id: Int): User + userId: Int! +} + +type Query { + posts: [Post] + user(id: Int!): User +} + +scalar Url + +type User { + email: String! + id: Int! + name: String! + phone: String + username: String! + website: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/call-graphql-datasource.md_merged.snap b/tests/core/snapshots/call-graphql-datasource.md_merged.snap new file mode 100644 index 0000000000..ec344567c4 --- /dev/null +++ b/tests/core/snapshots/call-graphql-datasource.md_merged.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { + query: Query +} + +type Post { + body: String! + id: Int! + title: String! + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts") + user(id: Int!): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") +} + +type User { + email: String! + id: Int! + name: String! + phone: String + username: String! + website: String +} diff --git a/tests/core/snapshots/call-multiple-steps-piping.md_0.snap b/tests/core/snapshots/call-multiple-steps-piping.md_0.snap new file mode 100644 index 0000000000..dc07f0ac53 --- /dev/null +++ b/tests/core/snapshots/call-multiple-steps-piping.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "abc_input": 3 + } + } +} diff --git a/tests/core/snapshots/call-multiple-steps-piping.md_1.snap b/tests/core/snapshots/call-multiple-steps-piping.md_1.snap new file mode 100644 index 0000000000..dcd399b30f --- /dev/null +++ b/tests/core/snapshots/call-multiple-steps-piping.md_1.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "abc": 3 + } + } +} diff --git a/tests/core/snapshots/call-multiple-steps-piping.md_client.snap b/tests/core/snapshots/call-multiple-steps-piping.md_client.snap new file mode 100644 index 0000000000..deea0f695a --- /dev/null +++ b/tests/core/snapshots/call-multiple-steps-piping.md_client.snap @@ -0,0 +1,31 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + a(input: JSON): JSON + a_input(input: JSON): JSON + abc(input: JSON): JSON + abc_input(input: JSON): JSON + b(input: JSON): JSON + b_input(input: JSON): JSON + c(input: JSON): JSON + wrap_args: JSON + wrap_input(input: JSON): JSON +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/call-multiple-steps-piping.md_merged.snap b/tests/core/snapshots/call-multiple-steps-piping.md_merged.snap new file mode 100644 index 0000000000..d9d2d3a8ef --- /dev/null +++ b/tests/core/snapshots/call-multiple-steps-piping.md_merged.snap @@ -0,0 +1,19 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + a(input: JSON): JSON @expr(body: "{{.args.input.a}}") + a_input(input: JSON): JSON @expr(body: {input: "{{.args.input.a}}"}) + abc(input: JSON): JSON @call(steps: [{query: "a", args: {input: "{{.args.input}}"}}, {query: "wrap_args"}, {query: "b"}, {query: "wrap_args"}, {query: "c"}]) + abc_input(input: JSON): JSON @call(steps: [{query: "wrap_input", args: {input: "{{.args.input}}"}}, {query: "a_input"}, {query: "wrap_input"}, {query: "b_input"}, {query: "wrap_input"}, {query: "c"}]) + b(input: JSON): JSON @expr(body: "{{.args.input.b}}") + b_input(input: JSON): JSON @expr(body: {input: "{{.args.input.b}}"}) + c(input: JSON): JSON @expr(body: "{{.args.input.c}}") + wrap_args: JSON @expr(body: {input: "{{.args}}"}) + wrap_input(input: JSON): JSON @expr(body: {input: "{{.args.input}}"}) +} diff --git a/tests/core/snapshots/call-mutation.md_0.snap b/tests/core/snapshots/call-mutation.md_0.snap new file mode 100644 index 0000000000..a0b72d835b --- /dev/null +++ b/tests/core/snapshots/call-mutation.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "insertPost": { + "body": "post-body" + } + } + } +} diff --git a/tests/core/snapshots/call-mutation.md_1.snap b/tests/core/snapshots/call-mutation.md_1.snap new file mode 100644 index 0000000000..ac831dbf76 --- /dev/null +++ b/tests/core/snapshots/call-mutation.md_1.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "firstUser": { + "posts": [ + { + "title": "post1-title" + }, + { + "title": "post2-title" + }, + { + "title": "post3-title" + } + ] + } + } + } +} diff --git a/tests/core/snapshots/call-mutation.md_2.snap b/tests/core/snapshots/call-mutation.md_2.snap new file mode 100644 index 0000000000..e2c0d0eb8a --- /dev/null +++ b/tests/core/snapshots/call-mutation.md_2.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "attachPostToFirstUser": { + "name": "foo" + } + } + } +} diff --git a/tests/core/snapshots/call-mutation.md_3.snap b/tests/core/snapshots/call-mutation.md_3.snap new file mode 100644 index 0000000000..2e8dd036cd --- /dev/null +++ b/tests/core/snapshots/call-mutation.md_3.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "insertPostToFirstUser": { + "body": "post-body" + } + } + } +} diff --git a/tests/core/snapshots/call-mutation.md_4.snap b/tests/core/snapshots/call-mutation.md_4.snap new file mode 100644 index 0000000000..e082082e7d --- /dev/null +++ b/tests/core/snapshots/call-mutation.md_4.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "insertMockedPost": { + "body": "post-body" + } + } + } +} diff --git a/tests/core/snapshots/call-mutation.md_client.snap b/tests/core/snapshots/call-mutation.md_client.snap new file mode 100644 index 0000000000..bea3b07d85 --- /dev/null +++ b/tests/core/snapshots/call-mutation.md_client.snap @@ -0,0 +1,59 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type Mutation { + attachPostToFirstUser(postId: Int, userId: Int): User + attachPostToUser(postId: Int!, userId: Int!): User + insertMockedPost(input: PostInput): Post + insertPost(input: PostInput): Post + insertPostToFirstUser(input: PostInputWithoutUserId, userId: Int): Post + insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post +} + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + userId: Int +} + +input PostInput { + body: String + title: String + userId: Int +} + +input PostInputWithoutUserId { + body: String + title: String + userId: Int +} + +type Query { + firstUser: User + postFromUser(userId: Int!): Post +} + +scalar Url + +type User { + id: Int + name: String + posts(userId: Int): [Post] +} + +schema { + query: Query + mutation: Mutation +} diff --git a/tests/core/snapshots/call-mutation.md_merged.snap b/tests/core/snapshots/call-mutation.md_merged.snap new file mode 100644 index 0000000000..4684f682f2 --- /dev/null +++ b/tests/core/snapshots/call-mutation.md_merged.snap @@ -0,0 +1,47 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query + mutation: Mutation +} + +input PostInput { + body: String + title: String + userId: Int +} + +input PostInputWithoutUserId { + body: String + title: String + userId: Int +} + +type Mutation { + attachPostToFirstUser(postId: Int!): User @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{.args.postId}}", userId: 1}}]) + attachPostToUser(postId: Int!, userId: Int!): User @http(body: "{\"postId\":{{.args.postId}}}", method: "PATCH", path: "/users/{{.args.userId}}") + insertMockedPost: Post @call(steps: [{mutation: "insertPost", args: {input: {body: "post-body", title: "post-title", userId: 1}}}]) + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") + insertPostToFirstUser(input: PostInputWithoutUserId): Post @call(steps: [{mutation: "insertPostToUser", args: {input: "{{.args.input}}", userId: 1}}]) + insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post @http(body: "{{.args.input}}", method: "POST", path: "/users/{{.args.userId}}/posts") +} + +type Post { + body: String + id: Int + title: String + userId: Int +} + +type Query { + firstUser: User @http(path: "/users/1") + postFromUser(userId: Int!): Post @http(path: "/posts?userId={{.args.userId}}") +} + +type User { + id: Int + name: String + posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{.value.id}}"}}]) +} diff --git a/tests/core/snapshots/call-operator.md_0.snap b/tests/core/snapshots/call-operator.md_0.snap new file mode 100644 index 0000000000..70bb1cdebb --- /dev/null +++ b/tests/core/snapshots/call-operator.md_0.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "user": { + "name": "foo" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_1.snap b/tests/core/snapshots/call-operator.md_1.snap new file mode 100644 index 0000000000..8b3a950db1 --- /dev/null +++ b/tests/core/snapshots/call-operator.md_1.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "user1": { + "name": "foo" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_10.snap b/tests/core/snapshots/call-operator.md_10.snap new file mode 100644 index 0000000000..87b277bf3c --- /dev/null +++ b/tests/core/snapshots/call-operator.md_10.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "news": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_11.snap b/tests/core/snapshots/call-operator.md_11.snap new file mode 100644 index 0000000000..e90dc644de --- /dev/null +++ b/tests/core/snapshots/call-operator.md_11.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "newsWithPortArg": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_12.snap b/tests/core/snapshots/call-operator.md_12.snap new file mode 100644 index 0000000000..c37773a9b8 --- /dev/null +++ b/tests/core/snapshots/call-operator.md_12.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "newsWithPortArg": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/call-operator.md_2.snap b/tests/core/snapshots/call-operator.md_2.snap new file mode 100644 index 0000000000..cd98048d91 --- /dev/null +++ b/tests/core/snapshots/call-operator.md_2.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "userFromValue": { + "name": "foo" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_3.snap b/tests/core/snapshots/call-operator.md_3.snap new file mode 100644 index 0000000000..00eff50b9a --- /dev/null +++ b/tests/core/snapshots/call-operator.md_3.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "userGraphQLHeaders": { + "name": "Leanne Graham" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_4.snap b/tests/core/snapshots/call-operator.md_4.snap new file mode 100644 index 0000000000..00eff50b9a --- /dev/null +++ b/tests/core/snapshots/call-operator.md_4.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "userGraphQLHeaders": { + "name": "Leanne Graham" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_5.snap b/tests/core/snapshots/call-operator.md_5.snap new file mode 100644 index 0000000000..806ab8a84d --- /dev/null +++ b/tests/core/snapshots/call-operator.md_5.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "userHttpHeaders": { + "name": "Leanne Graham http headers" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_6.snap b/tests/core/snapshots/call-operator.md_6.snap new file mode 100644 index 0000000000..660a3716c6 --- /dev/null +++ b/tests/core/snapshots/call-operator.md_6.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "userHttpQuery": { + "name": "Leanne Graham http query" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_7.snap b/tests/core/snapshots/call-operator.md_7.snap new file mode 100644 index 0000000000..226a9c3e3a --- /dev/null +++ b/tests/core/snapshots/call-operator.md_7.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "userPosts": [ + { + "title": "bar" + }, + { + "title": "qux" + } + ] + } + } +} diff --git a/tests/core/snapshots/call-operator.md_8.snap b/tests/core/snapshots/call-operator.md_8.snap new file mode 100644 index 0000000000..555ce24bfc --- /dev/null +++ b/tests/core/snapshots/call-operator.md_8.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "userWithPosts": { + "posts": [ + { + "title": "bar" + }, + { + "title": "qux" + } + ] + } + } + } +} diff --git a/tests/core/snapshots/call-operator.md_9.snap b/tests/core/snapshots/call-operator.md_9.snap new file mode 100644 index 0000000000..f4f2990d59 --- /dev/null +++ b/tests/core/snapshots/call-operator.md_9.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "news": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/call-operator.md_client.snap b/tests/core/snapshots/call-operator.md_client.snap new file mode 100644 index 0000000000..03ace5505d --- /dev/null +++ b/tests/core/snapshots/call-operator.md_client.snap @@ -0,0 +1,77 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +scalar PhoneNumber + +type Post { + body: String + id: Int + news: NewsData! + newsWithPortArg: NewsData! + title: String + user(id: Int): User + user1: User + userFromValue: User + userGraphQL(id: Int): User + userGraphQLHeaders(id: Int): User + userHttpHeaders(id: ID): User + userHttpQuery(id: ID): User + userId: Int! +} + +type Query { + news: NewsData! + newsWithPortArg(port: Int!): NewsData! + posts: [Post] + user(id: Int!): User + user1: User + userFromValue: User + userGraphQL(id: Int): User + userGraphQLHeaders(id: Int!): User + userHttpHeaders(id: ID!): User + userHttpQuery(id: ID!): User + userId: Int! + userPosts(id: ID!): [Post] + userWithPosts: UserWithPosts +} + +scalar Url + +type User { + email: String! + id: Int! + name: String! + phone: String + username: String! + website: String +} + +type UserWithPosts { + id: Int! + name: String! + posts(id: ID): [Post] +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/call-operator.md_merged.snap b/tests/core/snapshots/call-operator.md_merged.snap new file mode 100644 index 0000000000..ad316db56f --- /dev/null +++ b/tests/core/snapshots/call-operator.md_merged.snap @@ -0,0 +1,65 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { + query: Query +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Post { + body: String + id: Int + news: NewsData! @call(steps: [{query: "news"}]) + newsWithPortArg: NewsData! @call(steps: [{query: "news", args: {port: 50051}}]) + title: String + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) + user1: User @call(steps: [{query: "user1"}]) + userFromValue: User @call(steps: [{query: "userFromValue"}]) + userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{.value.userId}}"}}]) + userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{.value.userId}}"}}]) + userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{.value.userId}}"}}]) + userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{.value.userId}}"}}]) + userId: Int! +} + +type Query { + news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsWithPortArg(port: Int!): NewsData! @grpc(baseURL: "http://localhost:{{.args.port}}", method: "news.NewsService.GetAllNews") + posts: [Post] @http(path: "/posts") + user(id: Int!): User @http(path: "/users/{{.args.id}}") + user1: User @http(path: "/users/1") + userFromValue: User @http(path: "/users/{{.value.userId}}") + userGraphQL(id: Int): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") + userGraphQLHeaders(id: Int!): User @graphQL(baseURL: "http://upstream/graphql", headers: [{key: "id", value: "{{.args.id}}"}], name: "user") + userHttpHeaders(id: ID!): User @http(headers: [{key: "id", value: "{{.args.id}}"}], path: "/users") + userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) + userId: Int! @expr(body: 2) + userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{.args.id}}"}]) + userWithPosts: UserWithPosts @http(path: "/users/1") +} + +type User { + email: String! + id: Int! + name: String! + phone: String + username: String! + website: String +} + +type UserWithPosts { + id: Int! + name: String! + posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{.value.id}}"}}]) +} diff --git a/tests/core/snapshots/cors-allow-cred-false.md_0.snap b/tests/core/snapshots/cors-allow-cred-false.md_0.snap new file mode 100644 index 0000000000..396411301d --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-false.md_0.snap @@ -0,0 +1,14 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "access-control-allow-headers": "Authorization", + "access-control-allow-methods": "POST, OPTIONS", + "access-control-max-age": "23", + "vary": "origin, access-control-request-method, access-control-request-headers" + }, + "body": null +} diff --git a/tests/core/snapshots/cors-allow-cred-false.md_client.snap b/tests/core/snapshots/cors-allow-cred-false.md_client.snap new file mode 100644 index 0000000000..de202e546c --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-false.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + val: Int +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/cors-allow-cred-false.md_merged.snap b/tests/core/snapshots/cors-allow-cred-false.md_merged.snap new file mode 100644 index 0000000000..3d1469055a --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-false.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {cors: {allowHeaders: ["Authorization"], allowMethods: ["POST", "OPTIONS"], allowOrigins: ["abc.com", "xyz.com"], allowPrivateNetwork: true, maxAge: 23, vary: ["origin", "access-control-request-method", "access-control-request-headers"]}}) @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Query { + val: Int @expr(body: 1) +} diff --git a/tests/core/snapshots/cors-allow-cred-true.md_0.snap b/tests/core/snapshots/cors-allow-cred-true.md_0.snap new file mode 100644 index 0000000000..0d277c5d44 --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-true.md_0.snap @@ -0,0 +1,14 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "access-control-allow-credentials": "true", + "access-control-allow-methods": "OPTIONS, POST, GET", + "access-control-max-age": "23", + "vary": "origin, access-control-request-method, access-control-request-headers" + }, + "body": null +} diff --git a/tests/core/snapshots/cors-allow-cred-true.md_client.snap b/tests/core/snapshots/cors-allow-cred-true.md_client.snap new file mode 100644 index 0000000000..de202e546c --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-true.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + val: Int +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/cors-allow-cred-true.md_merged.snap b/tests/core/snapshots/cors-allow-cred-true.md_merged.snap new file mode 100644 index 0000000000..93e6b8bb82 --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-true.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {cors: {allowCredentials: true, allowMethods: ["OPTIONS", "POST", "GET"], allowOrigins: ["abc.com", "xyz.com"], exposeHeaders: [""], maxAge: 23, vary: ["origin", "access-control-request-method", "access-control-request-headers"]}}) @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Query { + val: Int @expr(body: 1) +} diff --git a/tests/core/snapshots/cors-allow-cred-vary.md_0.snap b/tests/core/snapshots/cors-allow-cred-vary.md_0.snap new file mode 100644 index 0000000000..027484ed4f --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-vary.md_0.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "access-control-allow-credentials": "true", + "access-control-expose-headers": "", + "content-type": "application/json", + "vary": "origin, access-control-request-method, access-control-request-headers" + }, + "body": { + "data": { + "val": 1 + } + } +} diff --git a/tests/core/snapshots/cors-allow-cred-vary.md_client.snap b/tests/core/snapshots/cors-allow-cred-vary.md_client.snap new file mode 100644 index 0000000000..de202e546c --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-vary.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + val: Int +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/cors-allow-cred-vary.md_merged.snap b/tests/core/snapshots/cors-allow-cred-vary.md_merged.snap new file mode 100644 index 0000000000..93e6b8bb82 --- /dev/null +++ b/tests/core/snapshots/cors-allow-cred-vary.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {cors: {allowCredentials: true, allowMethods: ["OPTIONS", "POST", "GET"], allowOrigins: ["abc.com", "xyz.com"], exposeHeaders: [""], maxAge: 23, vary: ["origin", "access-control-request-method", "access-control-request-headers"]}}) @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Query { + val: Int @expr(body: 1) +} diff --git a/tests/core/snapshots/custom-headers.md_0.snap b/tests/core/snapshots/custom-headers.md_0.snap new file mode 100644 index 0000000000..4dc49a862b --- /dev/null +++ b/tests/core/snapshots/custom-headers.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json", + "x-id": "1", + "x-name": "John Doe" + }, + "body": { + "data": { + "greet": "Hello World!" + } + } +} diff --git a/tests/core/snapshots/custom-headers.md_client.snap b/tests/core/snapshots/custom-headers.md_client.snap new file mode 100644 index 0000000000..ac555c1a8a --- /dev/null +++ b/tests/core/snapshots/custom-headers.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + greet: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/custom-headers.md_merged.snap b/tests/core/snapshots/custom-headers.md_merged.snap new file mode 100644 index 0000000000..9ef0fa4ce6 --- /dev/null +++ b/tests/core/snapshots/custom-headers.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {custom: [{key: "x-id", value: "1"}, {key: "x-name", value: "John Doe"}]}) @upstream { + query: Query +} + +type Query { + greet: String @expr(body: "Hello World!") +} diff --git a/tests/core/snapshots/env-value.md_0.snap b/tests/core/snapshots/env-value.md_0.snap new file mode 100644 index 0000000000..2c2d8a3107 --- /dev/null +++ b/tests/core/snapshots/env-value.md_0.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "post1": { + "id": 1, + "title": "Post 1", + "body": "Post 1 body", + "userId": 1 + }, + "post2": { + "id": 2, + "title": "Post 2", + "body": "Post 2 body", + "userId": 2 + }, + "post3": { + "id": 3, + "title": "Post 3", + "body": "Post 3 body", + "userId": 3 + } + } + } +} diff --git a/tests/core/snapshots/env-value.md_client.snap b/tests/core/snapshots/env-value.md_client.snap new file mode 100644 index 0000000000..17da57e235 --- /dev/null +++ b/tests/core/snapshots/env-value.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + userId: Int! +} + +type Query { + post1: Post + post2: Post + post3: Post +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/env-value.md_merged.snap b/tests/core/snapshots/env-value.md_merged.snap new file mode 100644 index 0000000000..bd648ec48a --- /dev/null +++ b/tests/core/snapshots/env-value.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Post { + body: String + id: Int + title: String + userId: Int! +} + +type Query { + post1: Post @http(path: "/posts/{{.env.ID}}") + post2: Post @http(path: "/posts/{{.env.POST_ID}}") + post3: Post @http(path: "/posts/{{.env.NESTED_POST_ID}}") +} diff --git a/tests/snapshots/execution_spec__auth-protected-without-auth.md_errors.snap b/tests/core/snapshots/execution_spec__auth-protected-without-auth.md_errors.snap similarity index 87% rename from tests/snapshots/execution_spec__auth-protected-without-auth.md_errors.snap rename to tests/core/snapshots/execution_spec__auth-protected-without-auth.md_errors.snap index d0e4e6a07e..7330dede2f 100644 --- a/tests/snapshots/execution_spec__auth-protected-without-auth.md_errors.snap +++ b/tests/core/snapshots/execution_spec__auth-protected-without-auth.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__cors-invalid-expose-headers.md_errors.snap b/tests/core/snapshots/execution_spec__cors-invalid-expose-headers.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__cors-invalid-expose-headers.md_errors.snap rename to tests/core/snapshots/execution_spec__cors-invalid-expose-headers.md_errors.snap index de6cc86eaf..746e69d015 100644 --- a/tests/snapshots/execution_spec__cors-invalid-expose-headers.md_errors.snap +++ b/tests/core/snapshots/execution_spec__cors-invalid-expose-headers.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__cors-invalid-headers.md_errors.snap b/tests/core/snapshots/execution_spec__cors-invalid-headers.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__cors-invalid-headers.md_errors.snap rename to tests/core/snapshots/execution_spec__cors-invalid-headers.md_errors.snap index 8e53f12774..581594e0b9 100644 --- a/tests/snapshots/execution_spec__cors-invalid-headers.md_errors.snap +++ b/tests/core/snapshots/execution_spec__cors-invalid-headers.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__cors-invalid-methods.md_errors.snap b/tests/core/snapshots/execution_spec__cors-invalid-methods.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__cors-invalid-methods.md_errors.snap rename to tests/core/snapshots/execution_spec__cors-invalid-methods.md_errors.snap index 67f1a0067c..f4c9b4b2f7 100644 --- a/tests/snapshots/execution_spec__cors-invalid-methods.md_errors.snap +++ b/tests/core/snapshots/execution_spec__cors-invalid-methods.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__cors-invalid-origins.md_errors.snap b/tests/core/snapshots/execution_spec__cors-invalid-origins.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__cors-invalid-origins.md_errors.snap rename to tests/core/snapshots/execution_spec__cors-invalid-origins.md_errors.snap index 6f2ad8bacb..d8799954bb 100644 --- a/tests/snapshots/execution_spec__cors-invalid-origins.md_errors.snap +++ b/tests/core/snapshots/execution_spec__cors-invalid-origins.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__experimental-headers-error.md_errors.snap b/tests/core/snapshots/execution_spec__experimental-headers-error.md_errors.snap similarity index 96% rename from tests/snapshots/execution_spec__experimental-headers-error.md_errors.snap rename to tests/core/snapshots/execution_spec__experimental-headers-error.md_errors.snap index 4fedc6112a..ec99849386 100644 --- a/tests/snapshots/execution_spec__experimental-headers-error.md_errors.snap +++ b/tests/core/snapshots/execution_spec__experimental-headers-error.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__input-type-protected-error.md_errors.snap b/tests/core/snapshots/execution_spec__input-type-protected-error.md_errors.snap similarity index 91% rename from tests/snapshots/execution_spec__input-type-protected-error.md_errors.snap rename to tests/core/snapshots/execution_spec__input-type-protected-error.md_errors.snap index eebe6efca2..e09e747a24 100644 --- a/tests/snapshots/execution_spec__input-type-protected-error.md_errors.snap +++ b/tests/core/snapshots/execution_spec__input-type-protected-error.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-add-field-error.md_errors.snap b/tests/core/snapshots/execution_spec__test-add-field-error.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-add-field-error.md_errors.snap rename to tests/core/snapshots/execution_spec__test-add-field-error.md_errors.snap index e45af7b013..7a9527f963 100644 --- a/tests/snapshots/execution_spec__test-add-field-error.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-add-field-error.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-all-blueprint-errors.md_errors.snap b/tests/core/snapshots/execution_spec__test-all-blueprint-errors.md_errors.snap similarity index 94% rename from tests/snapshots/execution_spec__test-all-blueprint-errors.md_errors.snap rename to tests/core/snapshots/execution_spec__test-all-blueprint-errors.md_errors.snap index f2633f4d1b..3c93b4b9e6 100644 --- a/tests/snapshots/execution_spec__test-all-blueprint-errors.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-all-blueprint-errors.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-batch-operator-post.md_errors.snap b/tests/core/snapshots/execution_spec__test-batch-operator-post.md_errors.snap similarity index 85% rename from tests/snapshots/execution_spec__test-batch-operator-post.md_errors.snap rename to tests/core/snapshots/execution_spec__test-batch-operator-post.md_errors.snap index f2dc1a4b64..3ac6e3e721 100644 --- a/tests/snapshots/execution_spec__test-batch-operator-post.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-batch-operator-post.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-call-operator-errors.md_errors.snap b/tests/core/snapshots/execution_spec__test-call-operator-errors.md_errors.snap similarity index 97% rename from tests/snapshots/execution_spec__test-call-operator-errors.md_errors.snap rename to tests/core/snapshots/execution_spec__test-call-operator-errors.md_errors.snap index f15ff3cc55..98a5f21455 100644 --- a/tests/snapshots/execution_spec__test-call-operator-errors.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-call-operator-errors.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-dbl-usage-many.md_errors.snap b/tests/core/snapshots/execution_spec__test-dbl-usage-many.md_errors.snap similarity index 89% rename from tests/snapshots/execution_spec__test-dbl-usage-many.md_errors.snap rename to tests/core/snapshots/execution_spec__test-dbl-usage-many.md_errors.snap index 47857501de..80e4e564e2 100644 --- a/tests/snapshots/execution_spec__test-dbl-usage-many.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-dbl-usage-many.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-dbl-usage.md_errors.snap b/tests/core/snapshots/execution_spec__test-dbl-usage.md_errors.snap similarity index 82% rename from tests/snapshots/execution_spec__test-dbl-usage.md_errors.snap rename to tests/core/snapshots/execution_spec__test-dbl-usage.md_errors.snap index 6d918ea3e7..421e08ba6a 100644 --- a/tests/snapshots/execution_spec__test-dbl-usage.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-dbl-usage.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-directives-undef-null-fields.md_errors.snap b/tests/core/snapshots/execution_spec__test-directives-undef-null-fields.md_errors.snap similarity index 98% rename from tests/snapshots/execution_spec__test-directives-undef-null-fields.md_errors.snap rename to tests/core/snapshots/execution_spec__test-directives-undef-null-fields.md_errors.snap index bcae45f721..adb506ebde 100644 --- a/tests/snapshots/execution_spec__test-directives-undef-null-fields.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-directives-undef-null-fields.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-duplicated-link.md_errors.snap b/tests/core/snapshots/execution_spec__test-duplicated-link.md_errors.snap similarity index 94% rename from tests/snapshots/execution_spec__test-duplicated-link.md_errors.snap rename to tests/core/snapshots/execution_spec__test-duplicated-link.md_errors.snap index f8b2bc554d..3f990dc863 100644 --- a/tests/snapshots/execution_spec__test-duplicated-link.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-duplicated-link.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-empty-link.md_errors.snap b/tests/core/snapshots/execution_spec__test-empty-link.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__test-empty-link.md_errors.snap rename to tests/core/snapshots/execution_spec__test-empty-link.md_errors.snap index b993f4b651..6ee4deb1d6 100644 --- a/tests/snapshots/execution_spec__test-empty-link.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-empty-link.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-expr-error.md_errors.snap b/tests/core/snapshots/execution_spec__test-expr-error.md_errors.snap similarity index 85% rename from tests/snapshots/execution_spec__test-expr-error.md_errors.snap rename to tests/core/snapshots/execution_spec__test-expr-error.md_errors.snap index cabe555d2b..cb7db5f40f 100644 --- a/tests/snapshots/execution_spec__test-expr-error.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-expr-error.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-expr-with-add-field.md_errors.snap b/tests/core/snapshots/execution_spec__test-expr-with-add-field.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-expr-with-add-field.md_errors.snap rename to tests/core/snapshots/execution_spec__test-expr-with-add-field.md_errors.snap index fc73329a0b..0d8830eac9 100644 --- a/tests/snapshots/execution_spec__test-expr-with-add-field.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-expr-with-add-field.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-expr-with-inline.md_errors.snap b/tests/core/snapshots/execution_spec__test-expr-with-inline.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-expr-with-inline.md_errors.snap rename to tests/core/snapshots/execution_spec__test-expr-with-inline.md_errors.snap index fc73329a0b..0d8830eac9 100644 --- a/tests/snapshots/execution_spec__test-expr-with-inline.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-expr-with-inline.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-field-already-implemented-from-Interface.md_errors.snap b/tests/core/snapshots/execution_spec__test-field-already-implemented-from-Interface.md_errors.snap similarity index 94% rename from tests/snapshots/execution_spec__test-field-already-implemented-from-Interface.md_errors.snap rename to tests/core/snapshots/execution_spec__test-field-already-implemented-from-Interface.md_errors.snap index c4b553e388..e0af5a9a50 100644 --- a/tests/snapshots/execution_spec__test-field-already-implemented-from-Interface.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-field-already-implemented-from-Interface.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-graphqlsource-no-base-url.md_errors.snap b/tests/core/snapshots/execution_spec__test-graphqlsource-no-base-url.md_errors.snap similarity index 84% rename from tests/snapshots/execution_spec__test-graphqlsource-no-base-url.md_errors.snap rename to tests/core/snapshots/execution_spec__test-graphqlsource-no-base-url.md_errors.snap index bc36b86753..852880f9b7 100644 --- a/tests/snapshots/execution_spec__test-graphqlsource-no-base-url.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-graphqlsource-no-base-url.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-groupby-without-batching.md_errors.snap b/tests/core/snapshots/execution_spec__test-groupby-without-batching.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-groupby-without-batching.md_errors.snap rename to tests/core/snapshots/execution_spec__test-groupby-without-batching.md_errors.snap index c9ef38fe04..4a3c7ded8c 100644 --- a/tests/snapshots/execution_spec__test-groupby-without-batching.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-groupby-without-batching.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-grpc-group-by.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-group-by.md_errors.snap similarity index 84% rename from tests/snapshots/execution_spec__test-grpc-group-by.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-group-by.md_errors.snap index e3e33bf635..a4356bd249 100644 --- a/tests/snapshots/execution_spec__test-grpc-group-by.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-group-by.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-grpc-invalid-method-format.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-invalid-method-format.md_errors.snap similarity index 87% rename from tests/snapshots/execution_spec__test-grpc-invalid-method-format.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-invalid-method-format.md_errors.snap index 7b685f0d1f..c2ca8b345f 100644 --- a/tests/snapshots/execution_spec__test-grpc-invalid-method-format.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-invalid-method-format.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/core/snapshots/execution_spec__test-grpc-invalid-proto-id.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-invalid-proto-id.md_errors.snap new file mode 100644 index 0000000000..36ee7add79 --- /dev/null +++ b/tests/core/snapshots/execution_spec__test-grpc-invalid-proto-id.md_errors.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: errors +--- +[ + { + "message": "Protobuf files were not specified in the config", + "trace": [ + "Query", + "news", + "@grpc" + ], + "description": null + } +] diff --git a/tests/snapshots/execution_spec__test-grpc-missing-fields.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-missing-fields.md_errors.snap similarity index 85% rename from tests/snapshots/execution_spec__test-grpc-missing-fields.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-missing-fields.md_errors.snap index dc4ebb9de1..cdde712544 100644 --- a/tests/snapshots/execution_spec__test-grpc-missing-fields.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-missing-fields.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-grpc-nested-data.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-nested-data.md_errors.snap similarity index 85% rename from tests/snapshots/execution_spec__test-grpc-nested-data.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-nested-data.md_errors.snap index bd11735e2e..b9d433c606 100644 --- a/tests/snapshots/execution_spec__test-grpc-nested-data.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-nested-data.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-grpc-nested-optional.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-nested-optional.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-grpc-nested-optional.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-nested-optional.md_errors.snap index fe84415c1b..ab65e0dab1 100644 --- a/tests/snapshots/execution_spec__test-grpc-nested-optional.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-nested-optional.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-grpc-optional.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-optional.md_errors.snap similarity index 85% rename from tests/snapshots/execution_spec__test-grpc-optional.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-optional.md_errors.snap index 3cdfc67390..6b515cedaf 100644 --- a/tests/snapshots/execution_spec__test-grpc-optional.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-optional.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-grpc-proto-path.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-proto-path.md_errors.snap similarity index 81% rename from tests/snapshots/execution_spec__test-grpc-proto-path.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-proto-path.md_errors.snap index 17bddadb47..34febb43e4 100644 --- a/tests/snapshots/execution_spec__test-grpc-proto-path.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-proto-path.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-grpc-service-method.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-service-method.md_errors.snap similarity index 84% rename from tests/snapshots/execution_spec__test-grpc-service-method.md_errors.snap rename to tests/core/snapshots/execution_spec__test-grpc-service-method.md_errors.snap index 04fdd54c29..95599fc658 100644 --- a/tests/snapshots/execution_spec__test-grpc-service-method.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-grpc-service-method.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/core/snapshots/execution_spec__test-grpc-service.md_errors.snap b/tests/core/snapshots/execution_spec__test-grpc-service.md_errors.snap new file mode 100644 index 0000000000..269001ba60 --- /dev/null +++ b/tests/core/snapshots/execution_spec__test-grpc-service.md_errors.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: errors +--- +[ + { + "message": "Couldn't find definitions for service news.YourServiceName", + "trace": [ + "Query", + "news", + "@grpc" + ], + "description": null + } +] diff --git a/tests/snapshots/execution_spec__test-hostname-faliure.md_errors.snap b/tests/core/snapshots/execution_spec__test-hostname-faliure.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-hostname-faliure.md_errors.snap rename to tests/core/snapshots/execution_spec__test-hostname-faliure.md_errors.snap index 8b0b7b6c27..2c6ac4d613 100644 --- a/tests/snapshots/execution_spec__test-hostname-faliure.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-hostname-faliure.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-http-with-add-field.md_errors.snap b/tests/core/snapshots/execution_spec__test-http-with-add-field.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-http-with-add-field.md_errors.snap rename to tests/core/snapshots/execution_spec__test-http-with-add-field.md_errors.snap index 017b01bafc..f1751bc827 100644 --- a/tests/snapshots/execution_spec__test-http-with-add-field.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-http-with-add-field.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-http-with-inline.md_errors.snap b/tests/core/snapshots/execution_spec__test-http-with-inline.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-http-with-inline.md_errors.snap rename to tests/core/snapshots/execution_spec__test-http-with-inline.md_errors.snap index 017b01bafc..f1751bc827 100644 --- a/tests/snapshots/execution_spec__test-http-with-inline.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-http-with-inline.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-inline-error.md_errors.snap b/tests/core/snapshots/execution_spec__test-inline-error.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-inline-error.md_errors.snap rename to tests/core/snapshots/execution_spec__test-inline-error.md_errors.snap index e45af7b013..7a9527f963 100644 --- a/tests/snapshots/execution_spec__test-inline-error.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-inline-error.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-invalid-query-in-http.md_errors.snap b/tests/core/snapshots/execution_spec__test-invalid-query-in-http.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-invalid-query-in-http.md_errors.snap rename to tests/core/snapshots/execution_spec__test-invalid-query-in-http.md_errors.snap index fa5aebd26e..0f574af714 100644 --- a/tests/snapshots/execution_spec__test-invalid-query-in-http.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-invalid-query-in-http.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-invalid-server.md_errors.snap b/tests/core/snapshots/execution_spec__test-invalid-server.md_errors.snap similarity index 86% rename from tests/snapshots/execution_spec__test-invalid-server.md_errors.snap rename to tests/core/snapshots/execution_spec__test-invalid-server.md_errors.snap index 57ecd5ae61..07613bc3f8 100644 --- a/tests/snapshots/execution_spec__test-invalid-server.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-invalid-server.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-js-multiple-scripts.md_errors.snap b/tests/core/snapshots/execution_spec__test-js-multiple-scripts.md_errors.snap similarity index 83% rename from tests/snapshots/execution_spec__test-js-multiple-scripts.md_errors.snap rename to tests/core/snapshots/execution_spec__test-js-multiple-scripts.md_errors.snap index 206a18f222..8dd40ad345 100644 --- a/tests/snapshots/execution_spec__test-js-multiple-scripts.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-js-multiple-scripts.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-lack-resolver.md_errors.snap b/tests/core/snapshots/execution_spec__test-lack-resolver.md_errors.snap similarity index 84% rename from tests/snapshots/execution_spec__test-lack-resolver.md_errors.snap rename to tests/core/snapshots/execution_spec__test-lack-resolver.md_errors.snap index 871cee918c..e3e60e1cbf 100644 --- a/tests/snapshots/execution_spec__test-lack-resolver.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-lack-resolver.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-missing-argument-on-all-resolvers.md_errors.snap b/tests/core/snapshots/execution_spec__test-missing-argument-on-all-resolvers.md_errors.snap similarity index 96% rename from tests/snapshots/execution_spec__test-missing-argument-on-all-resolvers.md_errors.snap rename to tests/core/snapshots/execution_spec__test-missing-argument-on-all-resolvers.md_errors.snap index a6a5f3d206..bd0885307f 100644 --- a/tests/snapshots/execution_spec__test-missing-argument-on-all-resolvers.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-missing-argument-on-all-resolvers.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-missing-mutation-resolver.md_errors.snap b/tests/core/snapshots/execution_spec__test-missing-mutation-resolver.md_errors.snap similarity index 84% rename from tests/snapshots/execution_spec__test-missing-mutation-resolver.md_errors.snap rename to tests/core/snapshots/execution_spec__test-missing-mutation-resolver.md_errors.snap index 3966a45d53..dd5c76b19e 100644 --- a/tests/snapshots/execution_spec__test-missing-mutation-resolver.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-missing-mutation-resolver.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-missing-query-resolver.md_errors.snap b/tests/core/snapshots/execution_spec__test-missing-query-resolver.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__test-missing-query-resolver.md_errors.snap rename to tests/core/snapshots/execution_spec__test-missing-query-resolver.md_errors.snap index 6187eac79e..f1ee6ca5be 100644 --- a/tests/snapshots/execution_spec__test-missing-query-resolver.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-missing-query-resolver.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-missing-root-types.md_errors.snap b/tests/core/snapshots/execution_spec__test-missing-root-types.md_errors.snap similarity index 89% rename from tests/snapshots/execution_spec__test-missing-root-types.md_errors.snap rename to tests/core/snapshots/execution_spec__test-missing-root-types.md_errors.snap index c869459b6a..60b7f03d34 100644 --- a/tests/snapshots/execution_spec__test-missing-root-types.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-missing-root-types.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-missing-schema-query.md_errors.snap b/tests/core/snapshots/execution_spec__test-missing-schema-query.md_errors.snap similarity index 81% rename from tests/snapshots/execution_spec__test-missing-schema-query.md_errors.snap rename to tests/core/snapshots/execution_spec__test-missing-schema-query.md_errors.snap index f416522410..1ef6c7ae5c 100644 --- a/tests/snapshots/execution_spec__test-missing-schema-query.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-missing-schema-query.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-multiple-resolvable-directives-on-field.md_errors.snap b/tests/core/snapshots/execution_spec__test-multiple-resolvable-directives-on-field.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__test-multiple-resolvable-directives-on-field.md_errors.snap rename to tests/core/snapshots/execution_spec__test-multiple-resolvable-directives-on-field.md_errors.snap index fb1240fd5f..7e7969e515 100644 --- a/tests/snapshots/execution_spec__test-multiple-resolvable-directives-on-field.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-multiple-resolvable-directives-on-field.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-no-base-url.md_errors.snap b/tests/core/snapshots/execution_spec__test-no-base-url.md_errors.snap similarity index 83% rename from tests/snapshots/execution_spec__test-no-base-url.md_errors.snap rename to tests/core/snapshots/execution_spec__test-no-base-url.md_errors.snap index 06ed886ca0..0414d880a4 100644 --- a/tests/snapshots/execution_spec__test-no-base-url.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-no-base-url.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-response-header-value.md_errors.snap b/tests/core/snapshots/execution_spec__test-response-header-value.md_errors.snap similarity index 87% rename from tests/snapshots/execution_spec__test-response-header-value.md_errors.snap rename to tests/core/snapshots/execution_spec__test-response-header-value.md_errors.snap index e525f70886..d319669132 100644 --- a/tests/snapshots/execution_spec__test-response-header-value.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-response-header-value.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-response-headers-multi.md_errors.snap b/tests/core/snapshots/execution_spec__test-response-headers-multi.md_errors.snap similarity index 96% rename from tests/snapshots/execution_spec__test-response-headers-multi.md_errors.snap rename to tests/core/snapshots/execution_spec__test-response-headers-multi.md_errors.snap index d12fe47ea0..e7de957c9f 100644 --- a/tests/snapshots/execution_spec__test-response-headers-multi.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-response-headers-multi.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-response-headers-name.md_errors.snap b/tests/core/snapshots/execution_spec__test-response-headers-name.md_errors.snap similarity index 87% rename from tests/snapshots/execution_spec__test-response-headers-name.md_errors.snap rename to tests/core/snapshots/execution_spec__test-response-headers-name.md_errors.snap index 29374aeb1d..a611958fd3 100644 --- a/tests/snapshots/execution_spec__test-response-headers-name.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-response-headers-name.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__test-undefined-query.md_errors.snap b/tests/core/snapshots/execution_spec__test-undefined-query.md_errors.snap similarity index 95% rename from tests/snapshots/execution_spec__test-undefined-query.md_errors.snap rename to tests/core/snapshots/execution_spec__test-undefined-query.md_errors.snap index 8460380609..bb7fe8faa3 100644 --- a/tests/snapshots/execution_spec__test-undefined-query.md_errors.snap +++ b/tests/core/snapshots/execution_spec__test-undefined-query.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__undeclared-type-no-base-url.md_errors.snap b/tests/core/snapshots/execution_spec__undeclared-type-no-base-url.md_errors.snap similarity index 90% rename from tests/snapshots/execution_spec__undeclared-type-no-base-url.md_errors.snap rename to tests/core/snapshots/execution_spec__undeclared-type-no-base-url.md_errors.snap index cc4954cc2b..ac8d461198 100644 --- a/tests/snapshots/execution_spec__undeclared-type-no-base-url.md_errors.snap +++ b/tests/core/snapshots/execution_spec__undeclared-type-no-base-url.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/snapshots/execution_spec__undeclared-type.md_errors.snap b/tests/core/snapshots/execution_spec__undeclared-type.md_errors.snap similarity index 83% rename from tests/snapshots/execution_spec__undeclared-type.md_errors.snap rename to tests/core/snapshots/execution_spec__undeclared-type.md_errors.snap index e345dd5eb6..fe591d2f33 100644 --- a/tests/snapshots/execution_spec__undeclared-type.md_errors.snap +++ b/tests/core/snapshots/execution_spec__undeclared-type.md_errors.snap @@ -1,5 +1,5 @@ --- -source: tests/execution_spec.rs +source: tests/core/spec.rs expression: errors --- [ diff --git a/tests/core/snapshots/experimental-headers.md_0.snap b/tests/core/snapshots/experimental-headers.md_0.snap new file mode 100644 index 0000000000..559c15b572 --- /dev/null +++ b/tests/core/snapshots/experimental-headers.md_0.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json", + "x-experimental": "experimental-header", + "x-tailcall": "tailcall-header" + }, + "body": { + "data": { + "users": [ + { + "id": 1, + "name": "Leanne Graham" + } + ] + } + } +} diff --git a/tests/core/snapshots/experimental-headers.md_client.snap b/tests/core/snapshots/experimental-headers.md_client.snap new file mode 100644 index 0000000000..9561d92458 --- /dev/null +++ b/tests/core/snapshots/experimental-headers.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + users: [User] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/experimental-headers.md_merged.snap b/tests/core/snapshots/experimental-headers.md_merged.snap new file mode 100644 index 0000000000..9fdcd5e3d0 --- /dev/null +++ b/tests/core/snapshots/experimental-headers.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {experimental: ["X-experimental", "x-tailcall"]}) @upstream { + query: Query +} + +type Query { + users: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/graphql-dataloader-batch-request.md_0.snap b/tests/core/snapshots/graphql-dataloader-batch-request.md_0.snap new file mode 100644 index 0000000000..b4420e10c7 --- /dev/null +++ b/tests/core/snapshots/graphql-dataloader-batch-request.md_0.snap @@ -0,0 +1,40 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "title": "a", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "b", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "c", + "user": { + "name": "Ervin Howell" + } + }, + { + "title": "d", + "user": { + "name": "Ervin Howell" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/graphql-dataloader-batch-request.md_client.snap b/tests/core/snapshots/graphql-dataloader-batch-request.md_client.snap new file mode 100644 index 0000000000..1b6afcdb98 --- /dev/null +++ b/tests/core/snapshots/graphql-dataloader-batch-request.md_client.snap @@ -0,0 +1,35 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int + title: String + user: User + userId: Int +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/graphql-dataloader-batch-request.md_merged.snap b/tests/core/snapshots/graphql-dataloader-batch-request.md_merged.snap new file mode 100644 index 0000000000..2f76478dfa --- /dev/null +++ b/tests/core/snapshots/graphql-dataloader-batch-request.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(batch: {delay: 1, headers: []}) { + query: Query +} + +type Post { + id: Int + title: String + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], baseURL: "http://upstream/graphql", batch: true, name: "user") + userId: Int +} + +type Query { + posts: [Post] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/graphql-dataloader-no-batch-request.md_0.snap b/tests/core/snapshots/graphql-dataloader-no-batch-request.md_0.snap new file mode 100644 index 0000000000..b4420e10c7 --- /dev/null +++ b/tests/core/snapshots/graphql-dataloader-no-batch-request.md_0.snap @@ -0,0 +1,40 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "title": "a", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "b", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "c", + "user": { + "name": "Ervin Howell" + } + }, + { + "title": "d", + "user": { + "name": "Ervin Howell" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/graphql-dataloader-no-batch-request.md_client.snap b/tests/core/snapshots/graphql-dataloader-no-batch-request.md_client.snap new file mode 100644 index 0000000000..1b6afcdb98 --- /dev/null +++ b/tests/core/snapshots/graphql-dataloader-no-batch-request.md_client.snap @@ -0,0 +1,35 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int + title: String + user: User + userId: Int +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/graphql-dataloader-no-batch-request.md_merged.snap b/tests/core/snapshots/graphql-dataloader-no-batch-request.md_merged.snap new file mode 100644 index 0000000000..16af3a561a --- /dev/null +++ b/tests/core/snapshots/graphql-dataloader-no-batch-request.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(batch: {delay: 1, headers: []}) { + query: Query +} + +type Post { + id: Int + title: String + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], baseURL: "http://upstream/graphql", name: "user") + userId: Int +} + +type Query { + posts: [Post] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/graphql-datasource-errors.md_0.snap b/tests/core/snapshots/graphql-datasource-errors.md_0.snap new file mode 100644 index 0000000000..a14dce54cb --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-errors.md_0.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": null + }, + "errors": [ + { + "message": "Failed to resolve user", + "locations": [ + { + "line": 1, + "column": 9 + } + ], + "path": [ + "user" + ] + } + ] + } +} diff --git a/tests/core/snapshots/graphql-datasource-errors.md_1.snap b/tests/core/snapshots/graphql-datasource-errors.md_1.snap new file mode 100644 index 0000000000..02f11ae658 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-errors.md_1.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": null, + "id": 2 + } + }, + "errors": [ + { + "message": "Failed to resolve name", + "locations": [ + { + "line": 1, + "column": 35 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/graphql-datasource-errors.md_client.snap b/tests/core/snapshots/graphql-datasource-errors.md_client.snap new file mode 100644 index 0000000000..7c0bdf72e9 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-errors.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int): User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/graphql-datasource-errors.md_merged.snap b/tests/core/snapshots/graphql-datasource-errors.md_merged.snap new file mode 100644 index 0000000000..8dfbfa8b10 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-errors.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + user(id: Int): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/graphql-datasource-mutation.md_0.snap b/tests/core/snapshots/graphql-datasource-mutation.md_0.snap new file mode 100644 index 0000000000..4a1861c0e1 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-mutation.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "createUser": { + "name": "Test Name" + } + } + } +} diff --git a/tests/core/snapshots/graphql-datasource-mutation.md_client.snap b/tests/core/snapshots/graphql-datasource-mutation.md_client.snap new file mode 100644 index 0000000000..8e51a31357 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-mutation.md_client.snap @@ -0,0 +1,39 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type Mutation { + createUser(user: UserInput!): User +} + +scalar PhoneNumber + +type Query { + users: [User] +} + +scalar Url + +type User { + id: Int + name: String +} + +input UserInput { + email: String! + name: String! + phone: String +} + +schema { + query: Query + mutation: Mutation +} diff --git a/tests/core/snapshots/graphql-datasource-mutation.md_merged.snap b/tests/core/snapshots/graphql-datasource-mutation.md_merged.snap new file mode 100644 index 0000000000..3cd8c33c5b --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-mutation.md_merged.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query + mutation: Mutation +} + +input UserInput { + email: String! + name: String! + phone: String +} + +type Mutation { + createUser(user: UserInput!): User @graphQL(args: [{key: "user", value: "{{.args.user}}"}], baseURL: "http://upstream/graphql", name: "createUser") +} + +type Query { + users: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/graphql-datasource-no-args.md_0.snap b/tests/core/snapshots/graphql-datasource-no-args.md_0.snap new file mode 100644 index 0000000000..d4d493733f --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-no-args.md_0.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "users_list": [ + { + "name": "Leanne Graham" + }, + { + "name": "Ervin Howell" + } + ] + } + } +} diff --git a/tests/core/snapshots/graphql-datasource-no-args.md_client.snap b/tests/core/snapshots/graphql-datasource-no-args.md_client.snap new file mode 100644 index 0000000000..a9b226f953 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-no-args.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + users_list: [User] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/graphql-datasource-no-args.md_merged.snap b/tests/core/snapshots/graphql-datasource-no-args.md_merged.snap new file mode 100644 index 0000000000..c43eb701d7 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-no-args.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + users_list: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/graphql-datasource-with-args.md_0.snap b/tests/core/snapshots/graphql-datasource-with-args.md_0.snap new file mode 100644 index 0000000000..27bf57106e --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-with-args.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": "Leanne Graham" + } + } + } +} diff --git a/tests/core/snapshots/graphql-datasource-with-args.md_1.snap b/tests/core/snapshots/graphql-datasource-with-args.md_1.snap new file mode 100644 index 0000000000..ccb0082d47 --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-with-args.md_1.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "post": { + "id": 1, + "user": { + "name": "Leanne Graham" + } + } + } + } +} diff --git a/tests/core/snapshots/graphql-datasource-with-args.md_client.snap b/tests/core/snapshots/graphql-datasource-with-args.md_client.snap new file mode 100644 index 0000000000..692a59db2d --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-with-args.md_client.snap @@ -0,0 +1,34 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int + user: User +} + +type Query { + post(id: Int): Post + user(id: Int): User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/graphql-datasource-with-args.md_merged.snap b/tests/core/snapshots/graphql-datasource-with-args.md_merged.snap new file mode 100644 index 0000000000..e84cc42c8a --- /dev/null +++ b/tests/core/snapshots/graphql-datasource-with-args.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Post { + id: Int + user: User +} + +type Query { + post(id: Int): Post @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "post") + user(id: Int): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/grpc-batch.md_0.snap b/tests/core/snapshots/grpc-batch.md_0.snap new file mode 100644 index 0000000000..7239944846 --- /dev/null +++ b/tests/core/snapshots/grpc-batch.md_0.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "newsById2": { + "title": "Note 2" + }, + "newsById3": { + "title": "Note 3" + } + } + } +} diff --git a/tests/core/snapshots/grpc-batch.md_client.snap b/tests/core/snapshots/grpc-batch.md_client.snap new file mode 100644 index 0000000000..da34171517 --- /dev/null +++ b/tests/core/snapshots/grpc-batch.md_client.snap @@ -0,0 +1,42 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +scalar PhoneNumber + +type Query { + news: NewsData! + newsById(news: NewsInput!): News! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/grpc-batch.md_merged.snap b/tests/core/snapshots/grpc-batch.md_merged.snap new file mode 100644 index 0000000000..14626ab137 --- /dev/null +++ b/tests/core/snapshots/grpc-batch.md_merged.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { + query: Query +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Query { + news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") +} diff --git a/tests/core/snapshots/grpc-error.md_0.snap b/tests/core/snapshots/grpc-error.md_0.snap new file mode 100644 index 0000000000..e69720283c --- /dev/null +++ b/tests/core/snapshots/grpc-error.md_0.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "gRPC Error: status: 3, description: `Client specified an invalid argument`, message: `grpc message`", + "locations": [ + { + "line": 1, + "column": 9 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/grpc-error.md_client.snap b/tests/core/snapshots/grpc-error.md_client.snap new file mode 100644 index 0000000000..da34171517 --- /dev/null +++ b/tests/core/snapshots/grpc-error.md_client.snap @@ -0,0 +1,42 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +scalar PhoneNumber + +type Query { + news: NewsData! + newsById(news: NewsInput!): News! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/grpc-error.md_merged.snap b/tests/core/snapshots/grpc-error.md_merged.snap new file mode 100644 index 0000000000..54e5f0b144 --- /dev/null +++ b/tests/core/snapshots/grpc-error.md_merged.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { + query: Query +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Query { + news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") +} diff --git a/tests/core/snapshots/grpc-override-url-from-upstream.md_0.snap b/tests/core/snapshots/grpc-override-url-from-upstream.md_0.snap new file mode 100644 index 0000000000..f4f2990d59 --- /dev/null +++ b/tests/core/snapshots/grpc-override-url-from-upstream.md_0.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "news": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/grpc-override-url-from-upstream.md_client.snap b/tests/core/snapshots/grpc-override-url-from-upstream.md_client.snap new file mode 100644 index 0000000000..da34171517 --- /dev/null +++ b/tests/core/snapshots/grpc-override-url-from-upstream.md_client.snap @@ -0,0 +1,42 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +scalar PhoneNumber + +type Query { + news: NewsData! + newsById(news: NewsInput!): News! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/grpc-override-url-from-upstream.md_merged.snap b/tests/core/snapshots/grpc-override-url-from-upstream.md_merged.snap new file mode 100644 index 0000000000..a42f6b7991 --- /dev/null +++ b/tests/core/snapshots/grpc-override-url-from-upstream.md_merged.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://not-a-valid-grpc-url.com", batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { + query: Query +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Query { + news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") +} diff --git a/tests/core/snapshots/grpc-proto-with-same-package.md_0.snap b/tests/core/snapshots/grpc-proto-with-same-package.md_0.snap new file mode 100644 index 0000000000..faaf53b6bd --- /dev/null +++ b/tests/core/snapshots/grpc-proto-with-same-package.md_0.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "foo": { + "foo": "test-foo" + }, + "bar": { + "bar": "test-bar" + } + } + } +} diff --git a/tests/core/snapshots/grpc-proto-with-same-package.md_client.snap b/tests/core/snapshots/grpc-proto-with-same-package.md_client.snap new file mode 100644 index 0000000000..4629912e16 --- /dev/null +++ b/tests/core/snapshots/grpc-proto-with-same-package.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Bar { + bar: String +} + +scalar Date + +scalar Email + +scalar Empty + +type Foo { + foo: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + bar: Bar! + foo: Foo! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/grpc-proto-with-same-package.md_merged.snap b/tests/core/snapshots/grpc-proto-with-same-package.md_merged.snap new file mode 100644 index 0000000000..885b23f062 --- /dev/null +++ b/tests/core/snapshots/grpc-proto-with-same-package.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://localhost:50051") @link(src: "foo.proto", type: Protobuf) @link(src: "bar.proto", type: Protobuf) { + query: Query +} + +type Bar { + bar: String +} + +type Foo { + foo: String +} + +type Query { + bar: Bar! @grpc(method: "test.BarService.GetBar") + foo: Foo! @grpc(method: "test.FooService.GetFoo") +} diff --git a/tests/core/snapshots/grpc-reflection.md_0.snap b/tests/core/snapshots/grpc-reflection.md_0.snap new file mode 100644 index 0000000000..f4f2990d59 --- /dev/null +++ b/tests/core/snapshots/grpc-reflection.md_0.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "news": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/grpc-reflection.md_client.snap b/tests/core/snapshots/grpc-reflection.md_client.snap new file mode 100644 index 0000000000..66514b8486 --- /dev/null +++ b/tests/core/snapshots/grpc-reflection.md_client.snap @@ -0,0 +1,34 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +scalar PhoneNumber + +type Query { + news: NewsData! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/grpc-reflection.md_merged.snap b/tests/core/snapshots/grpc-reflection.md_merged.snap new file mode 100644 index 0000000000..ef18012e5e --- /dev/null +++ b/tests/core/snapshots/grpc-reflection.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://localhost:50051", httpCache: true) @link(src: "http://localhost:50051", type: Grpc) { + query: Query +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Query { + news: NewsData! @grpc(method: "news.NewsService.GetAllNews") +} diff --git a/tests/core/snapshots/grpc-simple.md_0.snap b/tests/core/snapshots/grpc-simple.md_0.snap new file mode 100644 index 0000000000..f4f2990d59 --- /dev/null +++ b/tests/core/snapshots/grpc-simple.md_0.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "news": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/grpc-simple.md_client.snap b/tests/core/snapshots/grpc-simple.md_client.snap new file mode 100644 index 0000000000..da34171517 --- /dev/null +++ b/tests/core/snapshots/grpc-simple.md_client.snap @@ -0,0 +1,42 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +scalar PhoneNumber + +type Query { + news: NewsData! + newsById(news: NewsInput!): News! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/grpc-simple.md_merged.snap b/tests/core/snapshots/grpc-simple.md_merged.snap new file mode 100644 index 0000000000..54e5f0b144 --- /dev/null +++ b/tests/core/snapshots/grpc-simple.md_merged.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { + query: Query +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Query { + news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") +} diff --git a/tests/core/snapshots/grpc-url-from-upstream.md_0.snap b/tests/core/snapshots/grpc-url-from-upstream.md_0.snap new file mode 100644 index 0000000000..f4f2990d59 --- /dev/null +++ b/tests/core/snapshots/grpc-url-from-upstream.md_0.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "news": { + "news": [ + { + "id": 1 + }, + { + "id": 2 + } + ] + } + } + } +} diff --git a/tests/core/snapshots/grpc-url-from-upstream.md_client.snap b/tests/core/snapshots/grpc-url-from-upstream.md_client.snap new file mode 100644 index 0000000000..da34171517 --- /dev/null +++ b/tests/core/snapshots/grpc-url-from-upstream.md_client.snap @@ -0,0 +1,42 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +scalar PhoneNumber + +type Query { + news: NewsData! + newsById(news: NewsInput!): News! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/grpc-url-from-upstream.md_merged.snap b/tests/core/snapshots/grpc-url-from-upstream.md_merged.snap new file mode 100644 index 0000000000..0ad2090a9f --- /dev/null +++ b/tests/core/snapshots/grpc-url-from-upstream.md_merged.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { + query: Query +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Query { + news: NewsData! @grpc(method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") +} diff --git a/tests/core/snapshots/https.md_0.snap b/tests/core/snapshots/https.md_0.snap new file mode 100644 index 0000000000..a085a7c561 --- /dev/null +++ b/tests/core/snapshots/https.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "firstUser": { + "name": "Leanne Graham" + } + } + } +} diff --git a/tests/core/snapshots/https.md_client.snap b/tests/core/snapshots/https.md_client.snap new file mode 100644 index 0000000000..fd73bea4ae --- /dev/null +++ b/tests/core/snapshots/https.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + firstUser: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/https.md_merged.snap b/tests/core/snapshots/https.md_merged.snap new file mode 100644 index 0000000000..68c4914d04 --- /dev/null +++ b/tests/core/snapshots/https.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + firstUser: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/inline-field.md_0.snap b/tests/core/snapshots/inline-field.md_0.snap new file mode 100644 index 0000000000..9b27f8fefd --- /dev/null +++ b/tests/core/snapshots/inline-field.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "address": "-37.3159" + } + } + } +} diff --git a/tests/core/snapshots/inline-field.md_client.snap b/tests/core/snapshots/inline-field.md_client.snap new file mode 100644 index 0000000000..db581c1494 --- /dev/null +++ b/tests/core/snapshots/inline-field.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + address: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/inline-field.md_merged.snap b/tests/core/snapshots/inline-field.md_merged.snap new file mode 100644 index 0000000000..7251879bf9 --- /dev/null +++ b/tests/core/snapshots/inline-field.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + geo: Geo +} + +type Geo { + lat: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User @addField(name: "address", path: ["address", "geo", "lat"]) { + address: Address @modify(omit: true) +} diff --git a/tests/core/snapshots/inline-index-list.md_0.snap b/tests/core/snapshots/inline-index-list.md_0.snap new file mode 100644 index 0000000000..a5b7c188b6 --- /dev/null +++ b/tests/core/snapshots/inline-index-list.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "username": "Leanne Graham" + } + } +} diff --git a/tests/core/snapshots/inline-index-list.md_client.snap b/tests/core/snapshots/inline-index-list.md_client.snap new file mode 100644 index 0000000000..6e9d6172f2 --- /dev/null +++ b/tests/core/snapshots/inline-index-list.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + username: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/inline-index-list.md_merged.snap b/tests/core/snapshots/inline-index-list.md_merged.snap new file mode 100644 index 0000000000..75482b2360 --- /dev/null +++ b/tests/core/snapshots/inline-index-list.md_merged.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query @addField(name: "username", path: ["username", "0", "name"]) { + username: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") @modify(omit: true) +} + +type User { + name: String +} diff --git a/tests/core/snapshots/inline-many-list.md_client.snap b/tests/core/snapshots/inline-many-list.md_client.snap new file mode 100644 index 0000000000..019b06f8e1 --- /dev/null +++ b/tests/core/snapshots/inline-many-list.md_client.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + u: U +} + +type U { + b: [String] + c: String + d: String + e: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/inline-many-list.md_merged.snap b/tests/core/snapshots/inline-many-list.md_merged.snap new file mode 100644 index 0000000000..948144023f --- /dev/null +++ b/tests/core/snapshots/inline-many-list.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type A { + b: [String] + c: String + d: String +} + +type Query { + u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") +} + +type U @addField(name: "b", path: ["a", "b"]) @addField(name: "c", path: ["a", "c"]) @addField(name: "d", path: ["a", "d"]) { + a: A @modify(omit: true) + e: String +} diff --git a/tests/core/snapshots/inline-many.md_client.snap b/tests/core/snapshots/inline-many.md_client.snap new file mode 100644 index 0000000000..a063ed8484 --- /dev/null +++ b/tests/core/snapshots/inline-many.md_client.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + city: String + name: String + street: String + zipcode: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/inline-many.md_merged.snap b/tests/core/snapshots/inline-many.md_merged.snap new file mode 100644 index 0000000000..480ebd722d --- /dev/null +++ b/tests/core/snapshots/inline-many.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + city: String + street: String + zipcode: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User @addField(name: "city", path: ["address", "city"]) @addField(name: "street", path: ["address", "street"]) @addField(name: "zipcode", path: ["address", "zipcode"]) { + address: Address @modify(omit: true) + name: String +} diff --git a/tests/core/snapshots/io-cache.md_0.snap b/tests/core/snapshots/io-cache.md_0.snap new file mode 100644 index 0000000000..78ec8aca42 --- /dev/null +++ b/tests/core/snapshots/io-cache.md_0.snap @@ -0,0 +1,52 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "title": "a", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "b", + "user": { + "name": "Leanne Graham" + } + }, + { + "title": "c", + "user": { + "name": "Ervin Howell" + } + }, + { + "title": "d", + "user": { + "name": "Ervin Howell" + } + }, + { + "title": "e", + "user": { + "name": "Ervin Howell" + } + }, + { + "title": "f", + "user": { + "name": "Ervin Howell" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/io-cache.md_client.snap b/tests/core/snapshots/io-cache.md_client.snap new file mode 100644 index 0000000000..322138d3b6 --- /dev/null +++ b/tests/core/snapshots/io-cache.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String! + id: Int! + title: String! + user: User + userId: Int! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/io-cache.md_merged.snap b/tests/core/snapshots/io-cache.md_merged.snap new file mode 100644 index 0000000000..7669ff0baa --- /dev/null +++ b/tests/core/snapshots/io-cache.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { + query: Query +} + +type Post { + body: String! + id: Int! + title: String! + user: User @http(path: "/users/{{.value.userId}}") + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts") +} + +type User { + id: Int! + name: String! +} diff --git a/tests/core/snapshots/jsonplaceholder-call-post.md_0.snap b/tests/core/snapshots/jsonplaceholder-call-post.md_0.snap new file mode 100644 index 0000000000..64e4c375c5 --- /dev/null +++ b/tests/core/snapshots/jsonplaceholder-call-post.md_0.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "title": "title1", + "user": { + "name": "Leanne Graham" + } + } + ] + } + } +} diff --git a/tests/core/snapshots/jsonplaceholder-call-post.md_client.snap b/tests/core/snapshots/jsonplaceholder-call-post.md_client.snap new file mode 100644 index 0000000000..d7e7d165cd --- /dev/null +++ b/tests/core/snapshots/jsonplaceholder-call-post.md_client.snap @@ -0,0 +1,37 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int! + title: String! + user(id: Int): User + userId: Int! +} + +type Query { + posts: [Post] + user(id: Int!): User + users: [User] +} + +scalar Url + +type User { + id: Int! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap b/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap new file mode 100644 index 0000000000..a5a42cbbac --- /dev/null +++ b/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap @@ -0,0 +1,25 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: true) { + query: Query +} + +type Post { + id: Int! + title: String! + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts") + user(id: Int!): User @http(path: "/users/{{.args.id}}") + users: [User] @http(path: "/users") +} + +type User { + id: Int! + name: String! +} diff --git a/tests/core/snapshots/modified-field.md_0.snap b/tests/core/snapshots/modified-field.md_0.snap new file mode 100644 index 0000000000..f932b05da0 --- /dev/null +++ b/tests/core/snapshots/modified-field.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "fullname": "Leanne Graham" + } + } + } +} diff --git a/tests/core/snapshots/modified-field.md_client.snap b/tests/core/snapshots/modified-field.md_client.snap new file mode 100644 index 0000000000..bd0fb67424 --- /dev/null +++ b/tests/core/snapshots/modified-field.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + fullname: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/modified-field.md_merged.snap b/tests/core/snapshots/modified-field.md_merged.snap new file mode 100644 index 0000000000..8983ed6a45 --- /dev/null +++ b/tests/core/snapshots/modified-field.md_merged.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + name: String @modify(name: "fullname") +} diff --git a/tests/core/snapshots/mutation-put.md_0.snap b/tests/core/snapshots/mutation-put.md_0.snap new file mode 100644 index 0000000000..df1c1b3a6d --- /dev/null +++ b/tests/core/snapshots/mutation-put.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "insertPost": { + "body": "abc" + } + } + } +} diff --git a/tests/core/snapshots/mutation-put.md_client.snap b/tests/core/snapshots/mutation-put.md_client.snap new file mode 100644 index 0000000000..5e1c62be04 --- /dev/null +++ b/tests/core/snapshots/mutation-put.md_client.snap @@ -0,0 +1,47 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type Mutation { + insertPost(input: PostInput!): Post +} + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + userId: Int +} + +input PostInput { + body: String + id: Int + title: String + userId: Int +} + +type Query { + firstUser: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query + mutation: Mutation +} diff --git a/tests/core/snapshots/mutation-put.md_merged.snap b/tests/core/snapshots/mutation-put.md_merged.snap new file mode 100644 index 0000000000..065cde9ea8 --- /dev/null +++ b/tests/core/snapshots/mutation-put.md_merged.snap @@ -0,0 +1,35 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query + mutation: Mutation +} + +input PostInput { + body: String + id: Int + title: String + userId: Int +} + +type Mutation { + insertPost(input: PostInput!): Post @http(body: "{{.args.input}}", method: "PUT", path: "/posts/{{.args.input.id}}") +} + +type Post { + body: String + id: Int + title: String + userId: Int +} + +type Query { + firstUser: User @http(path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/mutation.md_0.snap b/tests/core/snapshots/mutation.md_0.snap new file mode 100644 index 0000000000..a0b72d835b --- /dev/null +++ b/tests/core/snapshots/mutation.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "insertPost": { + "body": "post-body" + } + } + } +} diff --git a/tests/core/snapshots/mutation.md_client.snap b/tests/core/snapshots/mutation.md_client.snap new file mode 100644 index 0000000000..9ee31d491b --- /dev/null +++ b/tests/core/snapshots/mutation.md_client.snap @@ -0,0 +1,46 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type Mutation { + insertPost(input: PostInput): Post +} + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + userId: Int +} + +input PostInput { + body: String + title: String + userId: Int +} + +type Query { + firstUser: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query + mutation: Mutation +} diff --git a/tests/core/snapshots/mutation.md_merged.snap b/tests/core/snapshots/mutation.md_merged.snap new file mode 100644 index 0000000000..3e58b3f436 --- /dev/null +++ b/tests/core/snapshots/mutation.md_merged.snap @@ -0,0 +1,34 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query + mutation: Mutation +} + +input PostInput { + body: String + title: String + userId: Int +} + +type Mutation { + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") +} + +type Post { + body: String + id: Int + title: String + userId: Int +} + +type Query { + firstUser: User @http(path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/n-plus-one-list.md_0.snap b/tests/core/snapshots/n-plus-one-list.md_0.snap new file mode 100644 index 0000000000..f25f1dd6ba --- /dev/null +++ b/tests/core/snapshots/n-plus-one-list.md_0.snap @@ -0,0 +1,52 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "bars": [ + { + "foo": [ + { + "id": 1 + } + ], + "fooId": 1, + "id": 1 + }, + { + "foo": [ + { + "id": 1 + } + ], + "fooId": 1, + "id": 2 + }, + { + "foo": [ + { + "id": 2 + } + ], + "fooId": 2, + "id": 3 + }, + { + "foo": [ + { + "id": 2 + } + ], + "fooId": 2, + "id": 4 + } + ] + } + } +} diff --git a/tests/core/snapshots/n-plus-one-list.md_client.snap b/tests/core/snapshots/n-plus-one-list.md_client.snap new file mode 100644 index 0000000000..908564ca06 --- /dev/null +++ b/tests/core/snapshots/n-plus-one-list.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Bar { + foo: [Foo] + fooId: Int! + id: Int! +} + +scalar Date + +scalar Email + +scalar Empty + +type Foo { + bar: Bar + id: Int! + name: String! +} + +scalar JSON + +scalar PhoneNumber + +type Query { + bars: [Bar] + foos: [Foo] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/n-plus-one-list.md_merged.snap b/tests/core/snapshots/n-plus-one-list.md_merged.snap new file mode 100644 index 0000000000..53889d91c3 --- /dev/null +++ b/tests/core/snapshots/n-plus-one-list.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Bar { + foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}]) + fooId: Int! + id: Int! +} + +type Foo { + bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}]) + id: Int! + name: String! +} + +type Query { + bars: [Bar] @http(path: "/bars") + foos: [Foo] @http(path: "/foos") +} diff --git a/tests/core/snapshots/n-plus-one.md_0.snap b/tests/core/snapshots/n-plus-one.md_0.snap new file mode 100644 index 0000000000..4293f81a84 --- /dev/null +++ b/tests/core/snapshots/n-plus-one.md_0.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "foos": [ + { + "bar": { + "fooId": "1", + "id": 1 + }, + "id": 1, + "name": "foo1" + }, + { + "bar": { + "fooId": "2", + "id": 2 + }, + "id": 2, + "name": "foo2" + } + ] + } + } +} diff --git a/tests/core/snapshots/n-plus-one.md_client.snap b/tests/core/snapshots/n-plus-one.md_client.snap new file mode 100644 index 0000000000..908564ca06 --- /dev/null +++ b/tests/core/snapshots/n-plus-one.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Bar { + foo: [Foo] + fooId: Int! + id: Int! +} + +scalar Date + +scalar Email + +scalar Empty + +type Foo { + bar: Bar + id: Int! + name: String! +} + +scalar JSON + +scalar PhoneNumber + +type Query { + bars: [Bar] + foos: [Foo] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/n-plus-one.md_merged.snap b/tests/core/snapshots/n-plus-one.md_merged.snap new file mode 100644 index 0000000000..53889d91c3 --- /dev/null +++ b/tests/core/snapshots/n-plus-one.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Bar { + foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}]) + fooId: Int! + id: Int! +} + +type Foo { + bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}]) + id: Int! + name: String! +} + +type Query { + bars: [Bar] @http(path: "/bars") + foos: [Foo] @http(path: "/foos") +} diff --git a/tests/core/snapshots/nested-objects.md_0.snap b/tests/core/snapshots/nested-objects.md_0.snap new file mode 100644 index 0000000000..81e0aa2d2f --- /dev/null +++ b/tests/core/snapshots/nested-objects.md_0.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "address": { + "geo": { + "lat": "-37.3159" + } + } + } + } + } +} diff --git a/tests/core/snapshots/nested-objects.md_client.snap b/tests/core/snapshots/nested-objects.md_client.snap new file mode 100644 index 0000000000..51c3f1f41b --- /dev/null +++ b/tests/core/snapshots/nested-objects.md_client.snap @@ -0,0 +1,37 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Address { + geo: Geo + street: String +} + +scalar Date + +scalar Email + +scalar Empty + +type Geo { + lat: String + lng: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + address: Address +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/nested-objects.md_merged.snap b/tests/core/snapshots/nested-objects.md_merged.snap new file mode 100644 index 0000000000..f2617d9e54 --- /dev/null +++ b/tests/core/snapshots/nested-objects.md_merged.snap @@ -0,0 +1,25 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + geo: Geo + street: String +} + +type Geo { + lat: String + lng: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + address: Address +} diff --git a/tests/core/snapshots/nesting-level3.md_0.snap b/tests/core/snapshots/nesting-level3.md_0.snap new file mode 100644 index 0000000000..bf53033aef --- /dev/null +++ b/tests/core/snapshots/nesting-level3.md_0.snap @@ -0,0 +1,38 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "post": { + "user": { + "todos": [ + { + "completed": false + }, + { + "completed": false + }, + { + "completed": false + }, + { + "completed": true + }, + { + "completed": false + }, + { + "completed": false + } + ] + } + } + } + } +} diff --git a/tests/core/snapshots/nesting-level3.md_client.snap b/tests/core/snapshots/nesting-level3.md_client.snap new file mode 100644 index 0000000000..d628fab7b1 --- /dev/null +++ b/tests/core/snapshots/nesting-level3.md_client.snap @@ -0,0 +1,45 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + user: User + userId: Int! +} + +type Query { + post: Post +} + +type Todo { + completed: Boolean +} + +scalar Url + +type User { + email: String! + id: Int! + name: String! + phone: String + todos: [Todo] + username: String! + website: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/nesting-level3.md_merged.snap b/tests/core/snapshots/nesting-level3.md_merged.snap new file mode 100644 index 0000000000..4dc614c158 --- /dev/null +++ b/tests/core/snapshots/nesting-level3.md_merged.snap @@ -0,0 +1,33 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Post { + body: String + id: Int + title: String + user: User @http(path: "/users/{{.value.userId}}") + userId: Int! +} + +type Query { + post: Post @http(path: "/posts/1") +} + +type Todo { + completed: Boolean +} + +type User { + email: String! + id: Int! + name: String! + phone: String + todos: [Todo] @http(path: "/users/{{.value.id}}/todos") + username: String! + website: String +} diff --git a/tests/core/snapshots/nullable-arg-query.md_0.snap b/tests/core/snapshots/nullable-arg-query.md_0.snap new file mode 100644 index 0000000000..416637ca30 --- /dev/null +++ b/tests/core/snapshots/nullable-arg-query.md_0.snap @@ -0,0 +1,46 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "users": [ + { + "id": 1 + }, + { + "id": 2 + }, + { + "id": 3 + }, + { + "id": 4 + }, + { + "id": 5 + }, + { + "id": 6 + }, + { + "id": 7 + }, + { + "id": 8 + }, + { + "id": 9 + }, + { + "id": 10 + } + ] + } + } +} diff --git a/tests/core/snapshots/nullable-arg-query.md_1.snap b/tests/core/snapshots/nullable-arg-query.md_1.snap new file mode 100644 index 0000000000..fba365192d --- /dev/null +++ b/tests/core/snapshots/nullable-arg-query.md_1.snap @@ -0,0 +1,19 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "users": [ + { + "id": 1 + } + ] + } + } +} diff --git a/tests/core/snapshots/nullable-arg-query.md_client.snap b/tests/core/snapshots/nullable-arg-query.md_client.snap new file mode 100644 index 0000000000..d0ed27e549 --- /dev/null +++ b/tests/core/snapshots/nullable-arg-query.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + users(id: ID): [User] +} + +scalar Url + +type User { + id: ID! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/nullable-arg-query.md_merged.snap b/tests/core/snapshots/nullable-arg-query.md_merged.snap new file mode 100644 index 0000000000..1ca244272c --- /dev/null +++ b/tests/core/snapshots/nullable-arg-query.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + users(id: ID): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) +} + +type User { + id: ID! + name: String! +} diff --git a/tests/core/snapshots/omit-index-list.md_0.snap b/tests/core/snapshots/omit-index-list.md_0.snap new file mode 100644 index 0000000000..a5b7c188b6 --- /dev/null +++ b/tests/core/snapshots/omit-index-list.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "username": "Leanne Graham" + } + } +} diff --git a/tests/core/snapshots/omit-index-list.md_client.snap b/tests/core/snapshots/omit-index-list.md_client.snap new file mode 100644 index 0000000000..6e9d6172f2 --- /dev/null +++ b/tests/core/snapshots/omit-index-list.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + username: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/omit-index-list.md_merged.snap b/tests/core/snapshots/omit-index-list.md_merged.snap new file mode 100644 index 0000000000..75482b2360 --- /dev/null +++ b/tests/core/snapshots/omit-index-list.md_merged.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query @addField(name: "username", path: ["username", "0", "name"]) { + username: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") @modify(omit: true) +} + +type User { + name: String +} diff --git a/tests/core/snapshots/omit-many.md_client.snap b/tests/core/snapshots/omit-many.md_client.snap new file mode 100644 index 0000000000..6517675baa --- /dev/null +++ b/tests/core/snapshots/omit-many.md_client.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + complements: [String] + name: String + zipcode: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/omit-many.md_merged.snap b/tests/core/snapshots/omit-many.md_merged.snap new file mode 100644 index 0000000000..8a9c853868 --- /dev/null +++ b/tests/core/snapshots/omit-many.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + city: String + complements: [String] + street: String + zipcode: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User @addField(name: "zipcode", path: ["address", "zipcode"]) @addField(name: "complements", path: ["address", "complements"]) { + address: Address @omit + name: String +} diff --git a/tests/core/snapshots/omit-resolved-by-parent.md_0.snap b/tests/core/snapshots/omit-resolved-by-parent.md_0.snap new file mode 100644 index 0000000000..33ee8d1664 --- /dev/null +++ b/tests/core/snapshots/omit-resolved-by-parent.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "address": "Kulas Light" + } + } + } +} diff --git a/tests/core/snapshots/omit-resolved-by-parent.md_client.snap b/tests/core/snapshots/omit-resolved-by-parent.md_client.snap new file mode 100644 index 0000000000..db581c1494 --- /dev/null +++ b/tests/core/snapshots/omit-resolved-by-parent.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + address: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/omit-resolved-by-parent.md_merged.snap b/tests/core/snapshots/omit-resolved-by-parent.md_merged.snap new file mode 100644 index 0000000000..54c1285f98 --- /dev/null +++ b/tests/core/snapshots/omit-resolved-by-parent.md_merged.snap @@ -0,0 +1,19 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + street: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User @addField(name: "address", path: ["address", "street"]) { + address: Address @modify(omit: true) +} diff --git a/tests/core/snapshots/recursive-type-json.md_0.snap b/tests/core/snapshots/recursive-type-json.md_0.snap new file mode 100644 index 0000000000..5d3fb5e67d --- /dev/null +++ b/tests/core/snapshots/recursive-type-json.md_0.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": "User1", + "id": 1, + "friend": { + "name": "User2", + "id": 2, + "friend": { + "name": "User2", + "id": 2 + } + } + } + } + } +} diff --git a/tests/core/snapshots/recursive-type-json.md_client.snap b/tests/core/snapshots/recursive-type-json.md_client.snap new file mode 100644 index 0000000000..0ba4af7c68 --- /dev/null +++ b/tests/core/snapshots/recursive-type-json.md_client.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + friend: User + id: Int! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/recursive-type-json.md_merged.snap b/tests/core/snapshots/recursive-type-json.md_merged.snap new file mode 100644 index 0000000000..1920b7efbb --- /dev/null +++ b/tests/core/snapshots/recursive-type-json.md_merged.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com", httpCache: true) { + query: Query +} + +type Query { + user(id: Int!): User @http(path: "/users/1") +} + +type User { + friend: User @http(path: "/friends/1") + id: Int! + name: String! +} diff --git a/tests/core/snapshots/recursive-types.md_0.snap b/tests/core/snapshots/recursive-types.md_0.snap new file mode 100644 index 0000000000..5d3fb5e67d --- /dev/null +++ b/tests/core/snapshots/recursive-types.md_0.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": "User1", + "id": 1, + "friend": { + "name": "User2", + "id": 2, + "friend": { + "name": "User2", + "id": 2 + } + } + } + } + } +} diff --git a/tests/core/snapshots/recursive-types.md_client.snap b/tests/core/snapshots/recursive-types.md_client.snap new file mode 100644 index 0000000000..c68cd69419 --- /dev/null +++ b/tests/core/snapshots/recursive-types.md_client.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + friend: User + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/recursive-types.md_merged.snap b/tests/core/snapshots/recursive-types.md_merged.snap new file mode 100644 index 0000000000..87b42e1376 --- /dev/null +++ b/tests/core/snapshots/recursive-types.md_merged.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + user: User @http(path: "/users/1") +} + +type User { + friend: User @http(path: "/friends/1") + id: Int + name: String +} diff --git a/tests/core/snapshots/ref-other-nested.md_0.snap b/tests/core/snapshots/ref-other-nested.md_0.snap new file mode 100644 index 0000000000..98cad028b7 --- /dev/null +++ b/tests/core/snapshots/ref-other-nested.md_0.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "firstUser": { + "user1": { + "user2": { + "name": "Leanne Graham" + } + } + } + } + } +} diff --git a/tests/core/snapshots/ref-other-nested.md_client.snap b/tests/core/snapshots/ref-other-nested.md_client.snap new file mode 100644 index 0000000000..0157e58887 --- /dev/null +++ b/tests/core/snapshots/ref-other-nested.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + firstUser: User1 +} + +scalar Url + +type User { + id: Int + name: String +} + +type User1 { + user1: User2 +} + +type User2 { + user2: User +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/ref-other-nested.md_merged.snap b/tests/core/snapshots/ref-other-nested.md_merged.snap new file mode 100644 index 0000000000..173f670347 --- /dev/null +++ b/tests/core/snapshots/ref-other-nested.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + firstUser: User1 @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + id: Int + name: String +} + +type User1 { + user1: User2 +} + +type User2 { + user2: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") +} diff --git a/tests/core/snapshots/ref-other.md_0.snap b/tests/core/snapshots/ref-other.md_0.snap new file mode 100644 index 0000000000..73bdac00d5 --- /dev/null +++ b/tests/core/snapshots/ref-other.md_0.snap @@ -0,0 +1,19 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "firstUser": { + "user1": { + "name": "Leanne Graham" + } + } + } + } +} diff --git a/tests/core/snapshots/ref-other.md_client.snap b/tests/core/snapshots/ref-other.md_client.snap new file mode 100644 index 0000000000..1e285d9604 --- /dev/null +++ b/tests/core/snapshots/ref-other.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + firstUser: User1 +} + +scalar Url + +type User { + id: Int + name: String +} + +type User1 { + user1: User +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/ref-other.md_merged.snap b/tests/core/snapshots/ref-other.md_merged.snap new file mode 100644 index 0000000000..90053056f7 --- /dev/null +++ b/tests/core/snapshots/ref-other.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + firstUser: User1 +} + +type User { + id: Int + name: String +} + +type User1 { + user1: User @http(path: "/users/1") +} diff --git a/tests/core/snapshots/rename-field.md_0.snap b/tests/core/snapshots/rename-field.md_0.snap new file mode 100644 index 0000000000..2db7000d43 --- /dev/null +++ b/tests/core/snapshots/rename-field.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user1": { + "name": "Leanne Graham" + } + } + } +} diff --git a/tests/core/snapshots/rename-field.md_1.snap b/tests/core/snapshots/rename-field.md_1.snap new file mode 100644 index 0000000000..76cb55bf18 --- /dev/null +++ b/tests/core/snapshots/rename-field.md_1.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user2": { + "name": "Ervin Howell" + } + } + } +} diff --git a/tests/core/snapshots/rename-field.md_client.snap b/tests/core/snapshots/rename-field.md_client.snap new file mode 100644 index 0000000000..dc9cb4bcd1 --- /dev/null +++ b/tests/core/snapshots/rename-field.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user1: User + user2: User +} + +scalar Url + +type User { + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/rename-field.md_merged.snap b/tests/core/snapshots/rename-field.md_merged.snap new file mode 100644 index 0000000000..919ae1a4a1 --- /dev/null +++ b/tests/core/snapshots/rename-field.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + person1: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") @modify(name: "user1") + person2: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/2") @modify(name: "user2") +} + +type User { + name: String +} diff --git a/tests/core/snapshots/request-to-upstream-batching.md_0.snap b/tests/core/snapshots/request-to-upstream-batching.md_0.snap new file mode 100644 index 0000000000..910fe79ff4 --- /dev/null +++ b/tests/core/snapshots/request-to-upstream-batching.md_0.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": [ + { + "data": { + "user": { + "id": 1, + "name": "foo" + } + } + }, + { + "data": { + "user": { + "id": 2, + "name": "bar" + } + } + } + ] +} diff --git a/tests/core/snapshots/request-to-upstream-batching.md_client.snap b/tests/core/snapshots/request-to-upstream-batching.md_client.snap new file mode 100644 index 0000000000..a39792ca85 --- /dev/null +++ b/tests/core/snapshots/request-to-upstream-batching.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/request-to-upstream-batching.md_merged.snap b/tests/core/snapshots/request-to-upstream-batching.md_merged.snap new file mode 100644 index 0000000000..b72e0d430f --- /dev/null +++ b/tests/core/snapshots/request-to-upstream-batching.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(batchRequests: true) @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { + query: Query +} + +type Query { + user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/resolve-with-headers.md_0.snap b/tests/core/snapshots/resolve-with-headers.md_0.snap new file mode 100644 index 0000000000..918dbaba7a --- /dev/null +++ b/tests/core/snapshots/resolve-with-headers.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "post1": { + "title": "post title" + } + } + } +} diff --git a/tests/core/snapshots/resolve-with-headers.md_client.snap b/tests/core/snapshots/resolve-with-headers.md_client.snap new file mode 100644 index 0000000000..b80ed2b615 --- /dev/null +++ b/tests/core/snapshots/resolve-with-headers.md_client.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String! + id: ID! + title: String! + userId: ID! +} + +type Query { + post1: Post +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/resolve-with-headers.md_merged.snap b/tests/core/snapshots/resolve-with-headers.md_merged.snap new file mode 100644 index 0000000000..2ef60df846 --- /dev/null +++ b/tests/core/snapshots/resolve-with-headers.md_merged.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(allowedHeaders: ["authorization"]) { + query: Query +} + +type Post { + body: String! + id: ID! + title: String! + userId: ID! +} + +type Query { + post1: Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{.headers.authorization}}") +} diff --git a/tests/core/snapshots/resolve-with-vars.md_0.snap b/tests/core/snapshots/resolve-with-vars.md_0.snap new file mode 100644 index 0000000000..47bfa75fff --- /dev/null +++ b/tests/core/snapshots/resolve-with-vars.md_0.snap @@ -0,0 +1,19 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": [ + { + "name": "Leanne Graham" + } + ] + } + } +} diff --git a/tests/core/snapshots/resolve-with-vars.md_client.snap b/tests/core/snapshots/resolve-with-vars.md_client.snap new file mode 100644 index 0000000000..e7f00943cb --- /dev/null +++ b/tests/core/snapshots/resolve-with-vars.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: [User] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/resolve-with-vars.md_merged.snap b/tests/core/snapshots/resolve-with-vars.md_merged.snap new file mode 100644 index 0000000000..a3cc637dd8 --- /dev/null +++ b/tests/core/snapshots/resolve-with-vars.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(vars: [{key: "id", value: "1"}]) @upstream { + query: Query +} + +type Query { + user: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.vars.id}}"}]) +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/resolved-by-parent.md_0.snap b/tests/core/snapshots/resolved-by-parent.md_0.snap new file mode 100644 index 0000000000..33ee8d1664 --- /dev/null +++ b/tests/core/snapshots/resolved-by-parent.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "address": "Kulas Light" + } + } + } +} diff --git a/tests/core/snapshots/resolved-by-parent.md_client.snap b/tests/core/snapshots/resolved-by-parent.md_client.snap new file mode 100644 index 0000000000..db581c1494 --- /dev/null +++ b/tests/core/snapshots/resolved-by-parent.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + address: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/resolved-by-parent.md_merged.snap b/tests/core/snapshots/resolved-by-parent.md_merged.snap new file mode 100644 index 0000000000..54c1285f98 --- /dev/null +++ b/tests/core/snapshots/resolved-by-parent.md_merged.snap @@ -0,0 +1,19 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Address { + street: String +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User @addField(name: "address", path: ["address", "street"]) { + address: Address @modify(omit: true) +} diff --git a/tests/core/snapshots/rest-api-error.md_0.snap b/tests/core/snapshots/rest-api-error.md_0.snap new file mode 100644 index 0000000000..71f1df3c32 --- /dev/null +++ b/tests/core/snapshots/rest-api-error.md_0.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 500, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "internal: non-null types require a return value", + "locations": [ + { + "line": 3, + "column": 5 + } + ], + "path": [ + "user", + "id" + ] + } + ] + } +} diff --git a/tests/core/snapshots/rest-api-error.md_client.snap b/tests/core/snapshots/rest-api-error.md_client.snap new file mode 100644 index 0000000000..b6fca1b4e8 --- /dev/null +++ b/tests/core/snapshots/rest-api-error.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + id: Int! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/rest-api-error.md_merged.snap b/tests/core/snapshots/rest-api-error.md_merged.snap new file mode 100644 index 0000000000..7ef5777788 --- /dev/null +++ b/tests/core/snapshots/rest-api-error.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(src: "operation-user.graphql", type: Operation) { + query: Query +} + +type Query { + user(id: Int!): User @http(path: "/users/{{.args.id}}") +} + +type User { + id: Int! + name: String! +} diff --git a/tests/core/snapshots/rest-api-post.md_0.snap b/tests/core/snapshots/rest-api-post.md_0.snap new file mode 100644 index 0000000000..cc6597baac --- /dev/null +++ b/tests/core/snapshots/rest-api-post.md_0.snap @@ -0,0 +1,14 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "id": 1, + "name": "foo" + } +} diff --git a/tests/core/snapshots/rest-api-post.md_client.snap b/tests/core/snapshots/rest-api-post.md_client.snap new file mode 100644 index 0000000000..b6fca1b4e8 --- /dev/null +++ b/tests/core/snapshots/rest-api-post.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + id: Int! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/rest-api-post.md_merged.snap b/tests/core/snapshots/rest-api-post.md_merged.snap new file mode 100644 index 0000000000..7ef5777788 --- /dev/null +++ b/tests/core/snapshots/rest-api-post.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(src: "operation-user.graphql", type: Operation) { + query: Query +} + +type Query { + user(id: Int!): User @http(path: "/users/{{.args.id}}") +} + +type User { + id: Int! + name: String! +} diff --git a/tests/core/snapshots/rest-api.md_0.snap b/tests/core/snapshots/rest-api.md_0.snap new file mode 100644 index 0000000000..cc6597baac --- /dev/null +++ b/tests/core/snapshots/rest-api.md_0.snap @@ -0,0 +1,14 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "id": 1, + "name": "foo" + } +} diff --git a/tests/core/snapshots/rest-api.md_client.snap b/tests/core/snapshots/rest-api.md_client.snap new file mode 100644 index 0000000000..b6fca1b4e8 --- /dev/null +++ b/tests/core/snapshots/rest-api.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + id: Int! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/rest-api.md_merged.snap b/tests/core/snapshots/rest-api.md_merged.snap new file mode 100644 index 0000000000..7ef5777788 --- /dev/null +++ b/tests/core/snapshots/rest-api.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(src: "operation-user.graphql", type: Operation) { + query: Query +} + +type Query { + user(id: Int!): User @http(path: "/users/{{.args.id}}") +} + +type User { + id: Int! + name: String! +} diff --git a/tests/core/snapshots/showcase.md_0.snap b/tests/core/snapshots/showcase.md_0.snap new file mode 100644 index 0000000000..13a20b3310 --- /dev/null +++ b/tests/core/snapshots/showcase.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": "foo" + } + } + } +} diff --git a/tests/core/snapshots/showcase.md_1.snap b/tests/core/snapshots/showcase.md_1.snap new file mode 100644 index 0000000000..6dfc7e9df6 --- /dev/null +++ b/tests/core/snapshots/showcase.md_1.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "No Config URL specified" + } + ] + } +} diff --git a/tests/core/snapshots/showcase.md_2.snap b/tests/core/snapshots/showcase.md_2.snap new file mode 100644 index 0000000000..fe3dc5a3b5 --- /dev/null +++ b/tests/core/snapshots/showcase.md_2.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Invalid Config URL specified" + } + ] + } +} diff --git a/tests/core/snapshots/showcase.md_3.snap b/tests/core/snapshots/showcase.md_3.snap new file mode 100644 index 0000000000..b178f82042 --- /dev/null +++ b/tests/core/snapshots/showcase.md_3.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Failed to read config: Validation Error\n• --> 1:1\n |\n1 | \"dsjfsjdfjdsfjkdskjfjkds\"\n | ^---\n |\n = expected type_system_definition\n" + } + ] + } +} diff --git a/tests/core/snapshots/showcase.md_4.snap b/tests/core/snapshots/showcase.md_4.snap new file mode 100644 index 0000000000..543411ada6 --- /dev/null +++ b/tests/core/snapshots/showcase.md_4.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Unexpected GraphQL Request: invalid type: map, expected a string at line 1 column 9" + } + ] + } +} diff --git a/tests/core/snapshots/showcase.md_client.snap b/tests/core/snapshots/showcase.md_client.snap new file mode 100644 index 0000000000..7d841d7546 --- /dev/null +++ b/tests/core/snapshots/showcase.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + not_user: User +} + +scalar Url + +type User { + not_id: Int + not_name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/showcase.md_merged.snap b/tests/core/snapshots/showcase.md_merged.snap new file mode 100644 index 0000000000..dcc936a453 --- /dev/null +++ b/tests/core/snapshots/showcase.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(showcase: true) @upstream { + query: Query +} + +type Query { + not_user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + not_id: Int + not_name: String +} diff --git a/tests/core/snapshots/simple-graphql.md_0.snap b/tests/core/snapshots/simple-graphql.md_0.snap new file mode 100644 index 0000000000..13a20b3310 --- /dev/null +++ b/tests/core/snapshots/simple-graphql.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": "foo" + } + } + } +} diff --git a/tests/core/snapshots/simple-graphql.md_1.snap b/tests/core/snapshots/simple-graphql.md_1.snap new file mode 100644 index 0000000000..543411ada6 --- /dev/null +++ b/tests/core/snapshots/simple-graphql.md_1.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "Unexpected GraphQL Request: invalid type: map, expected a string at line 1 column 9" + } + ] + } +} diff --git a/tests/core/snapshots/simple-graphql.md_client.snap b/tests/core/snapshots/simple-graphql.md_client.snap new file mode 100644 index 0000000000..f8c9c2fa86 --- /dev/null +++ b/tests/core/snapshots/simple-graphql.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/simple-graphql.md_merged.snap b/tests/core/snapshots/simple-graphql.md_merged.snap new file mode 100644 index 0000000000..fb720f6f46 --- /dev/null +++ b/tests/core/snapshots/simple-graphql.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/simple-query.md_0.snap b/tests/core/snapshots/simple-query.md_0.snap new file mode 100644 index 0000000000..d24c105fb6 --- /dev/null +++ b/tests/core/snapshots/simple-query.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "firstUser": { + "name": "foo" + } + } + } +} diff --git a/tests/core/snapshots/simple-query.md_client.snap b/tests/core/snapshots/simple-query.md_client.snap new file mode 100644 index 0000000000..fd73bea4ae --- /dev/null +++ b/tests/core/snapshots/simple-query.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + firstUser: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/simple-query.md_merged.snap b/tests/core/snapshots/simple-query.md_merged.snap new file mode 100644 index 0000000000..4582691ba7 --- /dev/null +++ b/tests/core/snapshots/simple-query.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + firstUser: User @http(path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-add-field-list.md_client.snap b/tests/core/snapshots/test-add-field-list.md_client.snap new file mode 100644 index 0000000000..63732a49c6 --- /dev/null +++ b/tests/core/snapshots/test-add-field-list.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type A { + b: B +} + +type B { + c: String +} + +scalar Date + +scalar Email + +scalar Empty + +type Foo { + a: A +} + +scalar JSON + +scalar PhoneNumber + +type Query { + b: B + foo: [Foo] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-add-field-list.md_merged.snap b/tests/core/snapshots/test-add-field-list.md_merged.snap new file mode 100644 index 0000000000..10f3b9ca79 --- /dev/null +++ b/tests/core/snapshots/test-add-field-list.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type A { + b: B +} + +type B { + c: String +} + +type Foo { + a: A +} + +type Query @addField(name: "b", path: ["foo", "a", "0", "b"]) { + foo: [Foo] @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-add-field.md_client.snap b/tests/core/snapshots/test-add-field.md_client.snap new file mode 100644 index 0000000000..3926ab5706 --- /dev/null +++ b/tests/core/snapshots/test-add-field.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type A { + b: B +} + +type B { + c: String +} + +scalar Date + +scalar Email + +scalar Empty + +type Foo { + a: A +} + +scalar JSON + +scalar PhoneNumber + +type Query { + b: B + foo: Foo +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-add-field.md_merged.snap b/tests/core/snapshots/test-add-field.md_merged.snap new file mode 100644 index 0000000000..095fa8a918 --- /dev/null +++ b/tests/core/snapshots/test-add-field.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type A { + b: B +} + +type B { + c: String +} + +type Foo { + a: A +} + +type Query @addField(name: "b", path: ["foo", "a", "b"]) { + foo: Foo @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-add-link-to-empty-config.md_client.snap b/tests/core/snapshots/test-add-link-to-empty-config.md_client.snap new file mode 100644 index 0000000000..bd1061e7db --- /dev/null +++ b/tests/core/snapshots/test-add-link-to-empty-config.md_client.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +enum Foo { + BAR + BAZ +} + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: Foo + hello: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-add-link-to-empty-config.md_merged.snap b/tests/core/snapshots/test-add-link-to-empty-config.md_merged.snap new file mode 100644 index 0000000000..724d3e15ed --- /dev/null +++ b/tests/core/snapshots/test-add-link-to-empty-config.md_merged.snap @@ -0,0 +1,7 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream @link(src: "link-expr.graphql", type: Config) @link(src: "link-enum.graphql", type: Config) { + query: Query +} diff --git a/tests/core/snapshots/test-batching-group-by.md_client.snap b/tests/core/snapshots/test-batching-group-by.md_client.snap new file mode 100644 index 0000000000..7ae47b261d --- /dev/null +++ b/tests/core/snapshots/test-batching-group-by.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + user: User + userId: Int! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-batching-group-by.md_merged.snap b/tests/core/snapshots/test-batching-group-by.md_merged.snap new file mode 100644 index 0000000000..10cc028bb6 --- /dev/null +++ b/tests/core/snapshots/test-batching-group-by.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(port: 4000) @upstream(baseURL: "http://abc.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + query: Query +} + +type Post { + body: String + id: Int + title: String + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts?id=1&id=11") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-cache.md_client.snap b/tests/core/snapshots/test-cache.md_client.snap new file mode 100644 index 0000000000..f8c9c2fa86 --- /dev/null +++ b/tests/core/snapshots/test-cache.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-cache.md_merged.snap b/tests/core/snapshots/test-cache.md_merged.snap new file mode 100644 index 0000000000..2bf0365875 --- /dev/null +++ b/tests/core/snapshots/test-cache.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Query { + user: User @http(path: "/foo") @cache(maxAge: 300) +} + +type User @cache(maxAge: 900) { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-conflict-allowed-headers.md_merged.snap b/tests/core/snapshots/test-conflict-allowed-headers.md_merged.snap new file mode 100644 index 0000000000..2fb2f3849c --- /dev/null +++ b/tests/core/snapshots/test-conflict-allowed-headers.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(allowedHeaders: ["a", "b", "c", "d"]) { + query: Query +} + +type Query { + hello: String @expr(body: "world") +} diff --git a/tests/core/snapshots/test-conflict-vars.md_merged.snap b/tests/core/snapshots/test-conflict-vars.md_merged.snap new file mode 100644 index 0000000000..eda8f9a1d5 --- /dev/null +++ b/tests/core/snapshots/test-conflict-vars.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(vars: [{key: "a", value: "b"}, {key: "c", value: "d"}, {key: "p", value: "q"}]) @upstream { + query: Query +} + +type Query { + hello: String @expr(body: "world") +} diff --git a/tests/core/snapshots/test-custom-scalar.md_client.snap b/tests/core/snapshots/test-custom-scalar.md_client.snap new file mode 100644 index 0000000000..f15f9a6a3d --- /dev/null +++ b/tests/core/snapshots/test-custom-scalar.md_client.snap @@ -0,0 +1,25 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar Json + +scalar PhoneNumber + +type Query { + foo: [Json] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-custom-scalar.md_merged.snap b/tests/core/snapshots/test-custom-scalar.md_merged.snap new file mode 100644 index 0000000000..01e731dc0a --- /dev/null +++ b/tests/core/snapshots/test-custom-scalar.md_merged.snap @@ -0,0 +1,13 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +scalar Json + +type Query { + foo: [Json] @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-custom-types.md_client.snap b/tests/core/snapshots/test-custom-types.md_client.snap new file mode 100644 index 0000000000..a7308e2bf3 --- /dev/null +++ b/tests/core/snapshots/test-custom-types.md_client.snap @@ -0,0 +1,41 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type Mut { + insertPost(input: PostInput): Post +} + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + userId: Int +} + +input PostInput { + body: String + title: String + userId: Int +} + +type Que { + posts: [Post] +} + +scalar Url + +schema { + query: Que + mutation: Mut +} diff --git a/tests/core/snapshots/test-custom-types.md_merged.snap b/tests/core/snapshots/test-custom-types.md_merged.snap new file mode 100644 index 0000000000..4c4cbc5a39 --- /dev/null +++ b/tests/core/snapshots/test-custom-types.md_merged.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Que + mutation: Mut +} + +input PostInput { + body: String + title: String + userId: Int +} + +type Mut { + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") +} + +type Post { + body: String + id: Int + title: String + userId: Int +} + +type Que { + posts: [Post] @expr(body: [{id: 1}]) +} diff --git a/tests/core/snapshots/test-description-many.md_client.snap b/tests/core/snapshots/test-description-many.md_client.snap new file mode 100644 index 0000000000..c21889cb2e --- /dev/null +++ b/tests/core/snapshots/test-description-many.md_client.snap @@ -0,0 +1,33 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Bar { + """ + This is test2 + """ + baz: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + """ + This is test + """ + foo: Bar +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-description-many.md_merged.snap b/tests/core/snapshots/test-description-many.md_merged.snap new file mode 100644 index 0000000000..a8e2022521 --- /dev/null +++ b/tests/core/snapshots/test-description-many.md_merged.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Bar { + """ + This is test2 + """ + baz: String +} + +type Query { + """ + This is test + """ + foo: Bar @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-enum-default.md_0.snap b/tests/core/snapshots/test-enum-default.md_0.snap new file mode 100644 index 0000000000..d177f0791f --- /dev/null +++ b/tests/core/snapshots/test-enum-default.md_0.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "news": { + "news": [ + { + "id": 1, + "foo": "PUBLISHED" + }, + { + "id": 2, + "foo": "DRAFT" + }, + { + "id": 3, + "foo": "ND" + } + ] + } + } + } +} diff --git a/tests/core/snapshots/test-enum-default.md_client.snap b/tests/core/snapshots/test-enum-default.md_client.snap new file mode 100644 index 0000000000..45aa5dcbe8 --- /dev/null +++ b/tests/core/snapshots/test-enum-default.md_client.snap @@ -0,0 +1,38 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + foo: Status + id: Int +} + +type NewsData { + news: [News]! +} + +scalar PhoneNumber + +type Query { + news: NewsData! +} + +enum Status { + DRAFT + ND + PUBLISHED +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-enum-default.md_merged.snap b/tests/core/snapshots/test-enum-default.md_merged.snap new file mode 100644 index 0000000000..fedfe3b663 --- /dev/null +++ b/tests/core/snapshots/test-enum-default.md_merged.snap @@ -0,0 +1,30 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8080) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "./service.proto", type: Protobuf) { + query: Query +} + +enum Status { + DRAFT + ND + PUBLISHED +} + +type News { + foo: Status + id: Int +} + +type NewsData { + news: [News]! +} + +type NewsInput { + id: Int +} + +type Query { + news: NewsData! @grpc(method: "news.NewsService.GetAllNews") +} diff --git a/tests/core/snapshots/test-enum-merge.md_merged.snap b/tests/core/snapshots/test-enum-merge.md_merged.snap new file mode 100644 index 0000000000..f204828260 --- /dev/null +++ b/tests/core/snapshots/test-enum-merge.md_merged.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +enum Foo { + BAR + BAZ + BOOM +} + +type Query { + foo: Foo @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-enum.md_0.snap b/tests/core/snapshots/test-enum.md_0.snap new file mode 100644 index 0000000000..63a4be352d --- /dev/null +++ b/tests/core/snapshots/test-enum.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "foo": "BAR" + } + } +} diff --git a/tests/core/snapshots/test-enum.md_1.snap b/tests/core/snapshots/test-enum.md_1.snap new file mode 100644 index 0000000000..444b7bb300 --- /dev/null +++ b/tests/core/snapshots/test-enum.md_1.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "foo": "BAZ" + } + } +} diff --git a/tests/core/snapshots/test-enum.md_2.snap b/tests/core/snapshots/test-enum.md_2.snap new file mode 100644 index 0000000000..c19c038cf7 --- /dev/null +++ b/tests/core/snapshots/test-enum.md_2.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "internal: invalid item for enum \"Foo\"", + "locations": [ + { + "line": 1, + "column": 9 + } + ], + "path": [ + "foo" + ] + } + ] + } +} diff --git a/tests/core/snapshots/test-enum.md_client.snap b/tests/core/snapshots/test-enum.md_client.snap new file mode 100644 index 0000000000..5f025dcda8 --- /dev/null +++ b/tests/core/snapshots/test-enum.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +enum Foo { + BAR + BAZ +} + +scalar JSON + +scalar PhoneNumber + +type Query { + foo(val: String!): Foo +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-enum.md_merged.snap b/tests/core/snapshots/test-enum.md_merged.snap new file mode 100644 index 0000000000..eca36df1c1 --- /dev/null +++ b/tests/core/snapshots/test-enum.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://localhost:8080") { + query: Query +} + +enum Foo { + BAR + BAZ +} + +type Query { + foo(val: String!): Foo @expr(body: "{{.args.val}}") +} diff --git a/tests/core/snapshots/test-expr-with-mustache.md_0.snap b/tests/core/snapshots/test-expr-with-mustache.md_0.snap new file mode 100644 index 0000000000..0f772f2f1c --- /dev/null +++ b/tests/core/snapshots/test-expr-with-mustache.md_0.snap @@ -0,0 +1,29 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "a": { + "bc": { + "b": [ + 1, + 2, + 3 + ], + "c": "test", + "d": 1, + "f": { + "e": 1 + }, + "g": true + } + } + } + } +} diff --git a/tests/core/snapshots/test-expr-with-mustache.md_client.snap b/tests/core/snapshots/test-expr-with-mustache.md_client.snap new file mode 100644 index 0000000000..563b3e26f4 --- /dev/null +++ b/tests/core/snapshots/test-expr-with-mustache.md_client.snap @@ -0,0 +1,40 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type A { + a: Int + bc: BC +} + +type BC { + b: [Int] + c: String + d: Int + f: D + g: Boolean +} + +type D { + e: Int +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + a: A +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-expr-with-mustache.md_merged.snap b/tests/core/snapshots/test-expr-with-mustache.md_merged.snap new file mode 100644 index 0000000000..6f192d0dee --- /dev/null +++ b/tests/core/snapshots/test-expr-with-mustache.md_merged.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type A { + a: Int + b: [Int] @modify(omit: true) + bc: BC @expr(body: {b: "{{.value.b}}", c: "{{.value.c}}", d: "{{.value.d.e}}", f: "{{.value.d}}", g: "{{.value.g}}"}) + c: String @modify(omit: true) + d: D @modify(omit: true) + g: Boolean @modify(omit: true) +} + +type BC { + b: [Int] + c: String + d: Int + f: D + g: Boolean +} + +type D { + e: Int +} + +type Query { + a: A @expr(body: {a: 0, b: [1, 2, 3], c: "test", d: {e: 1}, g: true}) +} diff --git a/tests/core/snapshots/test-expr.md_client.snap b/tests/core/snapshots/test-expr.md_client.snap new file mode 100644 index 0000000000..246536f601 --- /dev/null +++ b/tests/core/snapshots/test-expr.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + hello: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-expr.md_merged.snap b/tests/core/snapshots/test-expr.md_merged.snap new file mode 100644 index 0000000000..de0ae43f5d --- /dev/null +++ b/tests/core/snapshots/test-expr.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + hello: String @expr(body: "Hello from server") +} diff --git a/tests/core/snapshots/test-graphqlsource.md_client.snap b/tests/core/snapshots/test-graphqlsource.md_client.snap new file mode 100644 index 0000000000..17bdbf61cc --- /dev/null +++ b/tests/core/snapshots/test-graphqlsource.md_client.snap @@ -0,0 +1,34 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int! + user: User + userId: Int! +} + +type Query { + post(id: Int!): Post +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-graphqlsource.md_merged.snap b/tests/core/snapshots/test-graphqlsource.md_merged.snap new file mode 100644 index 0000000000..c4d9375595 --- /dev/null +++ b/tests/core/snapshots/test-graphqlsource.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://localhost:8000/graphql") { + query: Query +} + +type Post { + id: Int! + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") + userId: Int! +} + +type Query { + post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{.args.id}}") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-grpc.md_client.snap b/tests/core/snapshots/test-grpc.md_client.snap new file mode 100644 index 0000000000..72b8b8dccc --- /dev/null +++ b/tests/core/snapshots/test-grpc.md_client.snap @@ -0,0 +1,43 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +scalar PhoneNumber + +type Query { + news: NewsData! + newsById(news: NewsInput!): News! + newsByIdBatch(news: NewsInput!): News! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-grpc.md_merged.snap b/tests/core/snapshots/test-grpc.md_merged.snap new file mode 100644 index 0000000000..425c09a8d3 --- /dev/null +++ b/tests/core/snapshots/test-grpc.md_merged.snap @@ -0,0 +1,31 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(port: 8000) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 1000}) @link(id: "news", src: "news.proto", type: Protobuf) { + query: Query +} + +input NewsInput { + body: String + id: Int + postImage: String + title: String +} + +type News { + body: String + id: Int + postImage: String + title: String +} + +type NewsData { + news: [News]! +} + +type Query { + news: NewsData! @grpc(method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") +} diff --git a/tests/core/snapshots/test-http-baseurl.md_client.snap b/tests/core/snapshots/test-http-baseurl.md_client.snap new file mode 100644 index 0000000000..9387751799 --- /dev/null +++ b/tests/core/snapshots/test-http-baseurl.md_client.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + bar: String + foo: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-http-baseurl.md_merged.snap b/tests/core/snapshots/test-http-baseurl.md_merged.snap new file mode 100644 index 0000000000..342c76e8a3 --- /dev/null +++ b/tests/core/snapshots/test-http-baseurl.md_merged.snap @@ -0,0 +1,12 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://abc.com") { + query: Query +} + +type Query { + bar: String @http(path: "/bar") + foo: String @http(baseURL: "http://foo.com", path: "/foo") +} diff --git a/tests/core/snapshots/test-http-headers.md_client.snap b/tests/core/snapshots/test-http-headers.md_client.snap new file mode 100644 index 0000000000..374d170a70 --- /dev/null +++ b/tests/core/snapshots/test-http-headers.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-http-headers.md_merged.snap b/tests/core/snapshots/test-http-headers.md_merged.snap new file mode 100644 index 0000000000..b94cdc26fb --- /dev/null +++ b/tests/core/snapshots/test-http-headers.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://localhost:4000") { + query: Query +} + +type Query { + foo: String @http(headers: [{key: "foo", value: "bar"}], path: "/foo") +} diff --git a/tests/core/snapshots/test-http-tmpl.md_client.snap b/tests/core/snapshots/test-http-tmpl.md_client.snap new file mode 100644 index 0000000000..5f5cff8b2f --- /dev/null +++ b/tests/core/snapshots/test-http-tmpl.md_client.snap @@ -0,0 +1,34 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int + user: User + userId: Int! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-http-tmpl.md_merged.snap b/tests/core/snapshots/test-http-tmpl.md_merged.snap new file mode 100644 index 0000000000..0ad2f3d3be --- /dev/null +++ b/tests/core/snapshots/test-http-tmpl.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Post { + id: Int + user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) + userId: Int! +} + +type Query { + posts: [Post] @http(path: "/posts") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-http-with-mustache-expr.md_0.snap b/tests/core/snapshots/test-http-with-mustache-expr.md_0.snap new file mode 100644 index 0000000000..1f4ae40457 --- /dev/null +++ b/tests/core/snapshots/test-http-with-mustache-expr.md_0.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "a": { + "bc": { + "d": { + "e": 1 + }, + "f": true + } + } + } + } +} diff --git a/tests/core/snapshots/test-http-with-mustache-expr.md_client.snap b/tests/core/snapshots/test-http-with-mustache-expr.md_client.snap new file mode 100644 index 0000000000..3ab88b233b --- /dev/null +++ b/tests/core/snapshots/test-http-with-mustache-expr.md_client.snap @@ -0,0 +1,37 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type A { + a: Int + bc: BC +} + +type BC { + d: D + f: Boolean +} + +type D { + e: Int +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + a: A +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-http-with-mustache-expr.md_merged.snap b/tests/core/snapshots/test-http-with-mustache-expr.md_merged.snap new file mode 100644 index 0000000000..c94d63a06f --- /dev/null +++ b/tests/core/snapshots/test-http-with-mustache-expr.md_merged.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type A { + a: Int + bc: BC @expr(body: {d: "{{.value.d}}", f: "{{.value.f}}"}) + d: D @modify(omit: true) +} + +type BC { + d: D + f: Boolean +} + +type D { + e: Int +} + +type Query { + a: A @http(baseURL: "http://localhost:3000", path: "/a") +} diff --git a/tests/core/snapshots/test-http.md_client.snap b/tests/core/snapshots/test-http.md_client.snap new file mode 100644 index 0000000000..1d4b0f34bb --- /dev/null +++ b/tests/core/snapshots/test-http.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: [User] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-http.md_merged.snap b/tests/core/snapshots/test-http.md_merged.snap new file mode 100644 index 0000000000..3cc961ecb4 --- /dev/null +++ b/tests/core/snapshots/test-http.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Query { + foo: [User] @http(path: "/users") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-inline-list.md_client.snap b/tests/core/snapshots/test-inline-list.md_client.snap new file mode 100644 index 0000000000..9308d7eedc --- /dev/null +++ b/tests/core/snapshots/test-inline-list.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type B { + c: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: B +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-inline-list.md_merged.snap b/tests/core/snapshots/test-inline-list.md_merged.snap new file mode 100644 index 0000000000..ec95563c26 --- /dev/null +++ b/tests/core/snapshots/test-inline-list.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type A { + b: B +} + +type B { + c: String +} + +type Foo { + a: A +} + +type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { + foo: [Foo] @http(path: "/foo") @modify(omit: true) +} diff --git a/tests/core/snapshots/test-inline.md_client.snap b/tests/core/snapshots/test-inline.md_client.snap new file mode 100644 index 0000000000..9308d7eedc --- /dev/null +++ b/tests/core/snapshots/test-inline.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type B { + c: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: B +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-inline.md_merged.snap b/tests/core/snapshots/test-inline.md_merged.snap new file mode 100644 index 0000000000..cdb38002a2 --- /dev/null +++ b/tests/core/snapshots/test-inline.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type A { + b: B +} + +type B { + c: String +} + +type Foo { + a: A +} + +type Query @addField(name: "foo", path: ["foo", "a", "b"]) { + foo: Foo @http(path: "/foo") @modify(omit: true) +} diff --git a/tests/core/snapshots/test-interface-result.md_client.snap b/tests/core/snapshots/test-interface-result.md_client.snap new file mode 100644 index 0000000000..f374cc4b72 --- /dev/null +++ b/tests/core/snapshots/test-interface-result.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type B implements IA { + a: String + b: String +} + +scalar Date + +scalar Email + +scalar Empty + +interface IA { + a: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + bar: IA +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-interface-result.md_merged.snap b/tests/core/snapshots/test-interface-result.md_merged.snap new file mode 100644 index 0000000000..f8322407d6 --- /dev/null +++ b/tests/core/snapshots/test-interface-result.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +interface IA { + a: String +} + +type B implements IA { + a: String + b: String +} + +type Query { + bar: IA @http(path: "/user") +} diff --git a/tests/core/snapshots/test-interface.md_client.snap b/tests/core/snapshots/test-interface.md_client.snap new file mode 100644 index 0000000000..c62d23aa48 --- /dev/null +++ b/tests/core/snapshots/test-interface.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type B implements IA { + a: String + b: String +} + +scalar Date + +scalar Email + +scalar Empty + +interface IA { + a: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + bar: B +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-interface.md_merged.snap b/tests/core/snapshots/test-interface.md_merged.snap new file mode 100644 index 0000000000..a01ce94e07 --- /dev/null +++ b/tests/core/snapshots/test-interface.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +interface IA { + a: String +} + +type B implements IA { + a: String + b: String +} + +type Query { + bar: B @http(path: "/user") +} diff --git a/tests/core/snapshots/test-js-request-reponse.md_0.snap b/tests/core/snapshots/test-js-request-reponse.md_0.snap new file mode 100644 index 0000000000..feebdc4cda --- /dev/null +++ b/tests/core/snapshots/test-js-request-reponse.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "hi": "hello world" + } + } +} diff --git a/tests/core/snapshots/test-js-request-reponse.md_client.snap b/tests/core/snapshots/test-js-request-reponse.md_client.snap new file mode 100644 index 0000000000..234db86478 --- /dev/null +++ b/tests/core/snapshots/test-js-request-reponse.md_client.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + hello: String + hi: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-js-request-reponse.md_merged.snap b/tests/core/snapshots/test-js-request-reponse.md_merged.snap new file mode 100644 index 0000000000..74acf0b4ff --- /dev/null +++ b/tests/core/snapshots/test-js-request-reponse.md_merged.snap @@ -0,0 +1,12 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream @link(src: "test.js", type: Script) { + query: Query +} + +type Query { + hello: String @http(baseURL: "http://localhost:3000", path: "/hello") + hi: String @http(baseURL: "http://localhost:3000", path: "/hi") +} diff --git a/tests/core/snapshots/test-merge-batch.md_merged.snap b/tests/core/snapshots/test-merge-batch.md_merged.snap new file mode 100644 index 0000000000..c5fc6e4c4a --- /dev/null +++ b/tests/core/snapshots/test-merge-batch.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(batch: {delay: 5, headers: ["a", "b", "c"], maxSize: 100}) { + query: Query +} + +type Query { + hello: String @expr(body: "world") +} diff --git a/tests/core/snapshots/test-merge-nested.md_merged.snap b/tests/core/snapshots/test-merge-nested.md_merged.snap new file mode 100644 index 0000000000..55c1e360a9 --- /dev/null +++ b/tests/core/snapshots/test-merge-nested.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://abc.com") { + query: Query +} + +type Foo { + """ + test2 + """ + a: String + """ + test1 + """ + b: String +} + +type Query { + hi: Foo @expr(body: {a: "world"}) +} diff --git a/tests/core/snapshots/test-merge-query.md_merged.snap b/tests/core/snapshots/test-merge-query.md_merged.snap new file mode 100644 index 0000000000..56a1e62198 --- /dev/null +++ b/tests/core/snapshots/test-merge-query.md_merged.snap @@ -0,0 +1,12 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(port: 8000) @upstream(baseURL: "http://abc.com", proxy: {url: "http://localhost:3000"}) { + query: Query +} + +type Query { + hello: String @expr(body: "world") + hi: String @expr(body: "world") +} diff --git a/tests/core/snapshots/test-merge-right-with-link-config.md_client.snap b/tests/core/snapshots/test-merge-right-with-link-config.md_client.snap new file mode 100644 index 0000000000..40d931b741 --- /dev/null +++ b/tests/core/snapshots/test-merge-right-with-link-config.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +type Foo { + bar: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: Foo +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-merge-right-with-link-config.md_merged.snap b/tests/core/snapshots/test-merge-right-with-link-config.md_merged.snap new file mode 100644 index 0000000000..752503e827 --- /dev/null +++ b/tests/core/snapshots/test-merge-right-with-link-config.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(allowedHeaders: ["Authorization"]) @link(src: "stripe-types.graphql", type: Config) { + query: Query +} + +type Query { + foo: Foo @expr(body: {bar: "foo"}) +} diff --git a/tests/core/snapshots/test-merge-server-sdl.md_client.snap b/tests/core/snapshots/test-merge-server-sdl.md_client.snap new file mode 100644 index 0000000000..1d4b0f34bb --- /dev/null +++ b/tests/core/snapshots/test-merge-server-sdl.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: [User] +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-merge-server-sdl.md_merged.snap b/tests/core/snapshots/test-merge-server-sdl.md_merged.snap new file mode 100644 index 0000000000..3cc961ecb4 --- /dev/null +++ b/tests/core/snapshots/test-merge-server-sdl.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Query { + foo: [User] @http(path: "/users") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-merge-union.md_merged.snap b/tests/core/snapshots/test-merge-union.md_merged.snap new file mode 100644 index 0000000000..05a24d2691 --- /dev/null +++ b/tests/core/snapshots/test-merge-union.md_merged.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +union FooBar = Bar | Baz | Foo + +type Bar { + bar: String +} + +type Baz { + baz: String +} + +type Foo { + a: String + foo: String +} + +type Query { + foo: FooBar @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-modify.md_client.snap b/tests/core/snapshots/test-modify.md_client.snap new file mode 100644 index 0000000000..8d46ada4a5 --- /dev/null +++ b/tests/core/snapshots/test-modify.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +input Foo { + bar: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + data(input: Foo): String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-modify.md_merged.snap b/tests/core/snapshots/test-modify.md_merged.snap new file mode 100644 index 0000000000..88436fcb55 --- /dev/null +++ b/tests/core/snapshots/test-modify.md_merged.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +input Foo { + bar: String +} + +type Query { + foo(input: Foo): String @http(path: "/foo") @modify(name: "data") +} diff --git a/tests/core/snapshots/test-multi-interface.md_client.snap b/tests/core/snapshots/test-multi-interface.md_client.snap new file mode 100644 index 0000000000..b3e62e99f4 --- /dev/null +++ b/tests/core/snapshots/test-multi-interface.md_client.snap @@ -0,0 +1,36 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type B implements IA & IB { + a: String + b: String +} + +scalar Date + +scalar Email + +scalar Empty + +interface IA { + a: String +} + +interface IB { + b: String +} + +scalar JSON + +scalar PhoneNumber + +type Query { + bar: B +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-multi-interface.md_merged.snap b/tests/core/snapshots/test-multi-interface.md_merged.snap new file mode 100644 index 0000000000..f7edbcebf6 --- /dev/null +++ b/tests/core/snapshots/test-multi-interface.md_merged.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +interface IA { + a: String +} + +interface IB { + b: String +} + +type B implements IA & IB { + a: String + b: String +} + +type Query { + bar: B @http(path: "/user") +} diff --git a/tests/core/snapshots/test-nested-input.md_client.snap b/tests/core/snapshots/test-nested-input.md_client.snap new file mode 100644 index 0000000000..5ea104885a --- /dev/null +++ b/tests/core/snapshots/test-nested-input.md_client.snap @@ -0,0 +1,43 @@ +--- +source: tests/core/spec.rs +expression: client +--- +input A { + b: B +} + +input B { + c: C +} + +input C { + d: D +} + +input D { + e: Int +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + a(a: A!): X +} + +scalar Url + +type X { + a: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-nested-input.md_merged.snap b/tests/core/snapshots/test-nested-input.md_merged.snap new file mode 100644 index 0000000000..13f30f666d --- /dev/null +++ b/tests/core/snapshots/test-nested-input.md_merged.snap @@ -0,0 +1,31 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +input A { + b: B +} + +input B { + c: C +} + +input C { + d: D +} + +input D { + e: Int +} + +type Query { + a(a: A!): X @expr(body: {a: "hello"}) +} + +type X { + a: String +} diff --git a/tests/core/snapshots/test-nested-link.md_client.snap b/tests/core/snapshots/test-nested-link.md_client.snap new file mode 100644 index 0000000000..7d41dd312a --- /dev/null +++ b/tests/core/snapshots/test-nested-link.md_client.snap @@ -0,0 +1,40 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +enum Foo { + BAR + BAZ +} + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int! + user: User + userId: Int! +} + +type Query { + foo: Foo + post(id: Int!): Post +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-nested-link.md_merged.snap b/tests/core/snapshots/test-nested-link.md_merged.snap new file mode 100644 index 0000000000..7c13bd430b --- /dev/null +++ b/tests/core/snapshots/test-nested-link.md_merged.snap @@ -0,0 +1,7 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream @link(src: "graphql-with-link.graphql", type: Config) { + query: Query +} diff --git a/tests/core/snapshots/test-nested-value.md_client.snap b/tests/core/snapshots/test-nested-value.md_client.snap new file mode 100644 index 0000000000..fc6739e632 --- /dev/null +++ b/tests/core/snapshots/test-nested-value.md_client.snap @@ -0,0 +1,33 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int + user: User! +} + +type Query { + posts: [Post] +} + +scalar Url + +type User { + id: Int! + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-nested-value.md_merged.snap b/tests/core/snapshots/test-nested-value.md_merged.snap new file mode 100644 index 0000000000..954ba8405b --- /dev/null +++ b/tests/core/snapshots/test-nested-value.md_merged.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Post { + id: Int + user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.id}}"}]) +} + +type Query { + posts: [Post] @http(path: "/posts") +} + +type User { + id: Int! + name: String +} diff --git a/tests/core/snapshots/test-null-in-array.md_0.snap b/tests/core/snapshots/test-null-in-array.md_0.snap new file mode 100644 index 0000000000..4d68912c6b --- /dev/null +++ b/tests/core/snapshots/test-null-in-array.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "hi": null + } + } +} diff --git a/tests/core/snapshots/test-null-in-array.md_client.snap b/tests/core/snapshots/test-null-in-array.md_client.snap new file mode 100644 index 0000000000..b452d72d74 --- /dev/null +++ b/tests/core/snapshots/test-null-in-array.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Company { + id: ID + name: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + hi(id: ID!): [Company] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-null-in-array.md_merged.snap b/tests/core/snapshots/test-null-in-array.md_merged.snap new file mode 100644 index 0000000000..d11138e7df --- /dev/null +++ b/tests/core/snapshots/test-null-in-array.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Company { + id: ID + name: String +} + +type Query { + hi(id: ID!): [Company] @http(baseURL: "http://localhost:3000", path: "/hi") +} diff --git a/tests/core/snapshots/test-null-in-object.md_0.snap b/tests/core/snapshots/test-null-in-object.md_0.snap new file mode 100644 index 0000000000..4d68912c6b --- /dev/null +++ b/tests/core/snapshots/test-null-in-object.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "hi": null + } + } +} diff --git a/tests/core/snapshots/test-null-in-object.md_client.snap b/tests/core/snapshots/test-null-in-object.md_client.snap new file mode 100644 index 0000000000..b2bd05a708 --- /dev/null +++ b/tests/core/snapshots/test-null-in-object.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Company { + id: ID + name: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + hi(id: ID!): Company +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-null-in-object.md_merged.snap b/tests/core/snapshots/test-null-in-object.md_merged.snap new file mode 100644 index 0000000000..e5a749bb3e --- /dev/null +++ b/tests/core/snapshots/test-null-in-object.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Company { + id: ID + name: String +} + +type Query { + hi(id: ID!): Company @http(baseURL: "http://localhost:3000", path: "/hi") +} diff --git a/tests/core/snapshots/test-omit-list.md_client.snap b/tests/core/snapshots/test-omit-list.md_client.snap new file mode 100644 index 0000000000..9308d7eedc --- /dev/null +++ b/tests/core/snapshots/test-omit-list.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type B { + c: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: B +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-omit-list.md_merged.snap b/tests/core/snapshots/test-omit-list.md_merged.snap new file mode 100644 index 0000000000..672f7a5282 --- /dev/null +++ b/tests/core/snapshots/test-omit-list.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type A { + b: B +} + +type B { + c: String +} + +type Foo { + a: A +} + +type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { + foo: [Foo] @http(path: "/foo") @omit +} diff --git a/tests/core/snapshots/test-omit.md_client.snap b/tests/core/snapshots/test-omit.md_client.snap new file mode 100644 index 0000000000..9308d7eedc --- /dev/null +++ b/tests/core/snapshots/test-omit.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type B { + c: String +} + +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: B +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-omit.md_merged.snap b/tests/core/snapshots/test-omit.md_merged.snap new file mode 100644 index 0000000000..bb6a6a4f07 --- /dev/null +++ b/tests/core/snapshots/test-omit.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type A { + b: B +} + +type B { + c: String +} + +type Foo { + a: A +} + +type Query @addField(name: "foo", path: ["foo", "a", "b"]) { + foo: Foo @http(path: "/foo") @omit +} diff --git a/tests/core/snapshots/test-params-as-body.md_0.snap b/tests/core/snapshots/test-params-as-body.md_0.snap new file mode 100644 index 0000000000..79e85dfc9a --- /dev/null +++ b/tests/core/snapshots/test-params-as-body.md_0.snap @@ -0,0 +1,18 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "firstUser": { + "id": 1, + "name": "foo" + } + } + } +} diff --git a/tests/core/snapshots/test-params-as-body.md_client.snap b/tests/core/snapshots/test-params-as-body.md_client.snap new file mode 100644 index 0000000000..926203748b --- /dev/null +++ b/tests/core/snapshots/test-params-as-body.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + firstUser(id: Int, name: String): User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-params-as-body.md_merged.snap b/tests/core/snapshots/test-params-as-body.md_merged.snap new file mode 100644 index 0000000000..8d9f37e2a6 --- /dev/null +++ b/tests/core/snapshots/test-params-as-body.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + firstUser(id: Int, name: String): User @http(body: "{{.args}}", method: "POST", path: "/users") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-query-documentation.md_client.snap b/tests/core/snapshots/test-query-documentation.md_client.snap new file mode 100644 index 0000000000..bfbe74a5fb --- /dev/null +++ b/tests/core/snapshots/test-query-documentation.md_client.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + """ + This is test + """ + foo: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-query-documentation.md_merged.snap b/tests/core/snapshots/test-query-documentation.md_merged.snap new file mode 100644 index 0000000000..10a23ea587 --- /dev/null +++ b/tests/core/snapshots/test-query-documentation.md_merged.snap @@ -0,0 +1,14 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Query { + """ + This is test + """ + foo: String @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-query.md_client.snap b/tests/core/snapshots/test-query.md_client.snap new file mode 100644 index 0000000000..374d170a70 --- /dev/null +++ b/tests/core/snapshots/test-query.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-query.md_merged.snap b/tests/core/snapshots/test-query.md_merged.snap new file mode 100644 index 0000000000..a1301a03b5 --- /dev/null +++ b/tests/core/snapshots/test-query.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Query { + foo: String @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-ref-other.md_client.snap b/tests/core/snapshots/test-ref-other.md_client.snap new file mode 100644 index 0000000000..78c6f4d5f1 --- /dev/null +++ b/tests/core/snapshots/test-ref-other.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +type InPost { + get: [Post] +} + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int! + userId: Int! +} + +type Query { + posts: InPost +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-ref-other.md_merged.snap b/tests/core/snapshots/test-ref-other.md_merged.snap new file mode 100644 index 0000000000..d70cae6042 --- /dev/null +++ b/tests/core/snapshots/test-ref-other.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type InPost { + get: [Post] @http(path: "/posts") +} + +type Post { + id: Int! + userId: Int! +} + +type Query { + posts: InPost +} diff --git a/tests/core/snapshots/test-response-header-merge.md_merged.snap b/tests/core/snapshots/test-response-header-merge.md_merged.snap new file mode 100644 index 0000000000..d8808602d5 --- /dev/null +++ b/tests/core/snapshots/test-response-header-merge.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {custom: [{key: "a", value: "a"}, {key: "a", value: "b"}]}) @upstream { + query: Query +} + +type Query { + user: User @expr(body: {name: "John"}) +} + +type User { + age: Int + name: String +} diff --git a/tests/core/snapshots/test-scalars.md_0.snap b/tests/core/snapshots/test-scalars.md_0.snap new file mode 100644 index 0000000000..f9589339d0 --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_0.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "email": "alo@valid.com" + } + } +} diff --git a/tests/core/snapshots/test-scalars.md_1.snap b/tests/core/snapshots/test-scalars.md_1.snap new file mode 100644 index 0000000000..500fc09ad1 --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_1.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "phone": "+1 (614) 1234567" + } + } +} diff --git a/tests/core/snapshots/test-scalars.md_2.snap b/tests/core/snapshots/test-scalars.md_2.snap new file mode 100644 index 0000000000..4f94abe2af --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_2.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "date": "2023-03-08T12:45:26-05:00" + } + } +} diff --git a/tests/core/snapshots/test-scalars.md_3.snap b/tests/core/snapshots/test-scalars.md_3.snap new file mode 100644 index 0000000000..e40c6e03cc --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_3.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "url": "https://tailcall.run/" + } + } +} diff --git a/tests/core/snapshots/test-scalars.md_4.snap b/tests/core/snapshots/test-scalars.md_4.snap new file mode 100644 index 0000000000..f05fab41e1 --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_4.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "internal: invalid value for scalar \"Email\", expected \"FieldValue::Value\"", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "email" + ] + } + ] + } +} diff --git a/tests/core/snapshots/test-scalars.md_5.snap b/tests/core/snapshots/test-scalars.md_5.snap new file mode 100644 index 0000000000..8b0ea58a37 --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_5.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "internal: invalid value for scalar \"PhoneNumber\", expected \"FieldValue::Value\"", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "phone" + ] + } + ] + } +} diff --git a/tests/core/snapshots/test-scalars.md_6.snap b/tests/core/snapshots/test-scalars.md_6.snap new file mode 100644 index 0000000000..8b0ea58a37 --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_6.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "internal: invalid value for scalar \"PhoneNumber\", expected \"FieldValue::Value\"", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "phone" + ] + } + ] + } +} diff --git a/tests/core/snapshots/test-scalars.md_7.snap b/tests/core/snapshots/test-scalars.md_7.snap new file mode 100644 index 0000000000..31a1a3502f --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_7.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "internal: invalid value for scalar \"Date\", expected \"FieldValue::Value\"", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "date" + ] + } + ] + } +} diff --git a/tests/core/snapshots/test-scalars.md_8.snap b/tests/core/snapshots/test-scalars.md_8.snap new file mode 100644 index 0000000000..4ab684e59e --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_8.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "internal: invalid value for scalar \"Url\", expected \"FieldValue::Value\"", + "locations": [ + { + "line": 1, + "column": 3 + } + ], + "path": [ + "url" + ] + } + ] + } +} diff --git a/tests/core/snapshots/test-scalars.md_client.snap b/tests/core/snapshots/test-scalars.md_client.snap new file mode 100644 index 0000000000..12653f5f33 --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_client.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + date(value: Date!): Date! + email(value: Email!): Email! + phone(value: PhoneNumber!): PhoneNumber! + url(value: Url!): Url! +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-scalars.md_merged.snap b/tests/core/snapshots/test-scalars.md_merged.snap new file mode 100644 index 0000000000..69c62c196e --- /dev/null +++ b/tests/core/snapshots/test-scalars.md_merged.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(graphiql: true, hostname: "localhost", port: 8000) @upstream { + query: Query +} + +scalar Date + +scalar Email + +scalar PhoneNumber + +scalar Url + +type Query { + date(value: Date!): Date! @expr(body: "{{.args.value}}") + email(value: Email!): Email! @expr(body: "{{.args.value}}") + phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{.args.value}}") + url(value: Url!): Url! @expr(body: "{{.args.value}}") +} diff --git a/tests/core/snapshots/test-server-base-types.md_merged.snap b/tests/core/snapshots/test-server-base-types.md_merged.snap new file mode 100644 index 0000000000..7174daba96 --- /dev/null +++ b/tests/core/snapshots/test-server-base-types.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(port: 8000) @upstream(baseURL: "http://abc.com", proxy: {url: "http://localhost:3000"}) { + query: Query +} + +type Query { + hello: String @expr(body: "world") +} diff --git a/tests/core/snapshots/test-server-vars.md_client.snap b/tests/core/snapshots/test-server-vars.md_client.snap new file mode 100644 index 0000000000..374d170a70 --- /dev/null +++ b/tests/core/snapshots/test-server-vars.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-server-vars.md_merged.snap b/tests/core/snapshots/test-server-vars.md_merged.snap new file mode 100644 index 0000000000..4f83424678 --- /dev/null +++ b/tests/core/snapshots/test-server-vars.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(vars: [{key: "foo", value: "bar"}]) @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type Query { + foo: String @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-set-cookie-headers.md_0.snap b/tests/core/snapshots/test-set-cookie-headers.md_0.snap new file mode 100644 index 0000000000..3353c44cf4 --- /dev/null +++ b/tests/core/snapshots/test-set-cookie-headers.md_0.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json", + "set-cookie": "user=1; user=2" + }, + "body": { + "data": { + "u1": { + "name": "foo" + }, + "u2": { + "name": "bar" + } + } + } +} diff --git a/tests/core/snapshots/test-set-cookie-headers.md_client.snap b/tests/core/snapshots/test-set-cookie-headers.md_client.snap new file mode 100644 index 0000000000..cb11214253 --- /dev/null +++ b/tests/core/snapshots/test-set-cookie-headers.md_client.snap @@ -0,0 +1,32 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + email: String! + id: Int! + name: String! + phone: String + username: String! + website: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-set-cookie-headers.md_merged.snap b/tests/core/snapshots/test-set-cookie-headers.md_merged.snap new file mode 100644 index 0000000000..8660783954 --- /dev/null +++ b/tests/core/snapshots/test-set-cookie-headers.md_merged.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server(headers: {setCookies: true}, graphiql: true, hostname: "0.0.0.0", port: 8080) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + user(id: Int!): User @http(path: "/users/{{.args.id}}") +} + +type User { + email: String! + id: Int! + name: String! + phone: String + username: String! + website: String +} diff --git a/tests/core/snapshots/test-static-value.md_0.snap b/tests/core/snapshots/test-static-value.md_0.snap new file mode 100644 index 0000000000..a085a7c561 --- /dev/null +++ b/tests/core/snapshots/test-static-value.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "firstUser": { + "name": "Leanne Graham" + } + } + } +} diff --git a/tests/core/snapshots/test-static-value.md_client.snap b/tests/core/snapshots/test-static-value.md_client.snap new file mode 100644 index 0000000000..fd73bea4ae --- /dev/null +++ b/tests/core/snapshots/test-static-value.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + firstUser: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-static-value.md_merged.snap b/tests/core/snapshots/test-static-value.md_merged.snap new file mode 100644 index 0000000000..d4fb7c0f4c --- /dev/null +++ b/tests/core/snapshots/test-static-value.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + firstUser: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/test-tag.md_client.snap b/tests/core/snapshots/test-tag.md_client.snap new file mode 100644 index 0000000000..c38b4b5100 --- /dev/null +++ b/tests/core/snapshots/test-tag.md_client.snap @@ -0,0 +1,38 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +type NEWS { + getAllNews: News__NewsList! +} + +type News__News { + body: String + id: Int + postImage: String + title: String +} + +type News__NewsList { + news: [News__News] +} + +scalar PhoneNumber + +type Query { + news: NEWS +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-tag.md_merged.snap b/tests/core/snapshots/test-tag.md_merged.snap new file mode 100644 index 0000000000..f08a7d791d --- /dev/null +++ b/tests/core/snapshots/test-tag.md_merged.snap @@ -0,0 +1,26 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +type NEWS { + getAllNews: News__NewsList! +} + +type News__News @tag(id: "news.News") { + body: String @expr(body: "This is a news body") + id: Int @expr(body: 1) + postImage: String @expr(body: "http://example.com/image.jpg") + title: String @expr(body: "This is a news title") +} + +type News__NewsList @tag(id: "news.NewsList") { + news: [News__News] +} + +type Query { + news: NEWS +} diff --git a/tests/core/snapshots/test-union.md_client.snap b/tests/core/snapshots/test-union.md_client.snap new file mode 100644 index 0000000000..fa316b3e59 --- /dev/null +++ b/tests/core/snapshots/test-union.md_client.snap @@ -0,0 +1,33 @@ +--- +source: tests/core/spec.rs +expression: client +--- +type Bar { + bar: String +} + +scalar Date + +scalar Email + +scalar Empty + +type Foo { + foo: String +} + +union FooBar = Bar | Foo + +scalar JSON + +scalar PhoneNumber + +type Query { + foo: FooBar +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-union.md_merged.snap b/tests/core/snapshots/test-union.md_merged.snap new file mode 100644 index 0000000000..ac9b0682f9 --- /dev/null +++ b/tests/core/snapshots/test-union.md_merged.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { + query: Query +} + +scalar Baz + +union FooBar = Bar | Foo + +type Bar { + bar: String +} + +type Foo { + foo: String +} + +type Query { + foo: FooBar @http(path: "/foo") +} diff --git a/tests/core/snapshots/test-upstream-headers.md_0.snap b/tests/core/snapshots/test-upstream-headers.md_0.snap new file mode 100644 index 0000000000..db824d6b4b --- /dev/null +++ b/tests/core/snapshots/test-upstream-headers.md_0.snap @@ -0,0 +1,22 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "posts": [ + { + "id": 11 + }, + { + "id": 3 + } + ] + } + } +} diff --git a/tests/core/snapshots/test-upstream-headers.md_client.snap b/tests/core/snapshots/test-upstream-headers.md_client.snap new file mode 100644 index 0000000000..5ba4bd7bd2 --- /dev/null +++ b/tests/core/snapshots/test-upstream-headers.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + id: Int +} + +type Query { + posts: [Post] +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-upstream-headers.md_merged.snap b/tests/core/snapshots/test-upstream-headers.md_merged.snap new file mode 100644 index 0000000000..eca1e38232 --- /dev/null +++ b/tests/core/snapshots/test-upstream-headers.md_merged.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(allowedHeaders: ["X-bar", "x-foo"], baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Post { + id: Int +} + +type Query { + posts: [Post] @http(path: "/posts") +} diff --git a/tests/core/snapshots/test-upstream.md_client.snap b/tests/core/snapshots/test-upstream.md_client.snap new file mode 100644 index 0000000000..246536f601 --- /dev/null +++ b/tests/core/snapshots/test-upstream.md_client.snap @@ -0,0 +1,23 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + hello: String +} + +scalar Url + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-upstream.md_merged.snap b/tests/core/snapshots/test-upstream.md_merged.snap new file mode 100644 index 0000000000..1bf8df4afc --- /dev/null +++ b/tests/core/snapshots/test-upstream.md_merged.snap @@ -0,0 +1,11 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(proxy: {url: "http://localhost:8085"}) { + query: Query +} + +type Query { + hello: String @http(baseURL: "http://localhost:8000", path: "/hello") +} diff --git a/tests/core/snapshots/upstream-batching.md_0.snap b/tests/core/snapshots/upstream-batching.md_0.snap new file mode 100644 index 0000000000..e8bca1fdcc --- /dev/null +++ b/tests/core/snapshots/upstream-batching.md_0.snap @@ -0,0 +1,20 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "u1": { + "id": 1 + }, + "u2": { + "id": 2 + } + } + } +} diff --git a/tests/core/snapshots/upstream-batching.md_client.snap b/tests/core/snapshots/upstream-batching.md_client.snap new file mode 100644 index 0000000000..7c0bdf72e9 --- /dev/null +++ b/tests/core/snapshots/upstream-batching.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int): User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/upstream-batching.md_merged.snap b/tests/core/snapshots/upstream-batching.md_merged.snap new file mode 100644 index 0000000000..96bc34ca2a --- /dev/null +++ b/tests/core/snapshots/upstream-batching.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { + query: Query +} + +type Query { + user(id: Int): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/upstream-fail-request.md_0.snap b/tests/core/snapshots/upstream-fail-request.md_0.snap new file mode 100644 index 0000000000..95fd0e3582 --- /dev/null +++ b/tests/core/snapshots/upstream-fail-request.md_0.snap @@ -0,0 +1,24 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": null, + "errors": [ + { + "message": "IOException: Status code error", + "locations": [ + { + "line": 1, + "column": 9 + } + ] + } + ] + } +} diff --git a/tests/core/snapshots/upstream-fail-request.md_client.snap b/tests/core/snapshots/upstream-fail-request.md_client.snap new file mode 100644 index 0000000000..f8c9c2fa86 --- /dev/null +++ b/tests/core/snapshots/upstream-fail-request.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user: User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/upstream-fail-request.md_merged.snap b/tests/core/snapshots/upstream-fail-request.md_merged.snap new file mode 100644 index 0000000000..fb720f6f46 --- /dev/null +++ b/tests/core/snapshots/upstream-fail-request.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/with-args-url.md_0.snap b/tests/core/snapshots/with-args-url.md_0.snap new file mode 100644 index 0000000000..13a20b3310 --- /dev/null +++ b/tests/core/snapshots/with-args-url.md_0.snap @@ -0,0 +1,17 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "name": "foo" + } + } + } +} diff --git a/tests/core/snapshots/with-args-url.md_client.snap b/tests/core/snapshots/with-args-url.md_client.snap new file mode 100644 index 0000000000..a39792ca85 --- /dev/null +++ b/tests/core/snapshots/with-args-url.md_client.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): User +} + +scalar Url + +type User { + id: Int + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/with-args-url.md_merged.snap b/tests/core/snapshots/with-args-url.md_merged.snap new file mode 100644 index 0000000000..90a785cd57 --- /dev/null +++ b/tests/core/snapshots/with-args-url.md_merged.snap @@ -0,0 +1,16 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/{{.args.id}}") +} + +type User { + id: Int + name: String +} diff --git a/tests/core/snapshots/with-args.md_0.snap b/tests/core/snapshots/with-args.md_0.snap new file mode 100644 index 0000000000..47bfa75fff --- /dev/null +++ b/tests/core/snapshots/with-args.md_0.snap @@ -0,0 +1,19 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": [ + { + "name": "Leanne Graham" + } + ] + } + } +} diff --git a/tests/core/snapshots/with-args.md_client.snap b/tests/core/snapshots/with-args.md_client.snap new file mode 100644 index 0000000000..4b24b72bbe --- /dev/null +++ b/tests/core/snapshots/with-args.md_client.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Query { + user(id: Int!): [User] +} + +scalar Url + +type User { + name: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/with-args.md_merged.snap b/tests/core/snapshots/with-args.md_merged.snap new file mode 100644 index 0000000000..8d4d6edafd --- /dev/null +++ b/tests/core/snapshots/with-args.md_merged.snap @@ -0,0 +1,15 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream { + query: Query +} + +type Query { + user(id: Int!): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) +} + +type User { + name: String +} diff --git a/tests/core/snapshots/with-nesting.md_0.snap b/tests/core/snapshots/with-nesting.md_0.snap new file mode 100644 index 0000000000..29d1a1dfea --- /dev/null +++ b/tests/core/snapshots/with-nesting.md_0.snap @@ -0,0 +1,27 @@ +--- +source: tests/core/spec.rs +expression: response +--- +{ + "status": 200, + "headers": { + "content-type": "application/json" + }, + "body": { + "data": { + "user": { + "posts": [ + { + "title": "title1" + }, + { + "title": "title2" + }, + { + "title": "title3" + } + ] + } + } + } +} diff --git a/tests/core/snapshots/with-nesting.md_client.snap b/tests/core/snapshots/with-nesting.md_client.snap new file mode 100644 index 0000000000..762317c8a7 --- /dev/null +++ b/tests/core/snapshots/with-nesting.md_client.snap @@ -0,0 +1,40 @@ +--- +source: tests/core/spec.rs +expression: client +--- +scalar Date + +scalar Email + +scalar Empty + +scalar JSON + +scalar PhoneNumber + +type Post { + body: String + id: Int + title: String + userId: Int +} + +type Query { + user: User +} + +scalar Url + +type User { + email: String! + id: Int! + name: String! + phone: String + posts: [Post] + username: String! + website: String +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/with-nesting.md_merged.snap b/tests/core/snapshots/with-nesting.md_merged.snap new file mode 100644 index 0000000000..5a3a7c2cb0 --- /dev/null +++ b/tests/core/snapshots/with-nesting.md_merged.snap @@ -0,0 +1,28 @@ +--- +source: tests/core/spec.rs +expression: merged +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Post { + body: String + id: Int + title: String + userId: Int +} + +type Query { + user: User @http(path: "/users/1") +} + +type User { + email: String! + id: Int! + name: String! + phone: String + posts: [Post] @http(path: "/users/{{.value.id}}/posts") + username: String! + website: String +} diff --git a/tests/core/spec.rs b/tests/core/spec.rs new file mode 100644 index 0000000000..6b3e5b72af --- /dev/null +++ b/tests/core/spec.rs @@ -0,0 +1,328 @@ +extern crate core; + +use std::collections::BTreeMap; +use std::path::Path; +use std::sync::Arc; +use std::{fs, panic}; + +use anyhow::Context; +use colored::Colorize; +use futures_util::future::join_all; +use hyper::{Body, Request}; +use serde::{Deserialize, Serialize}; +use tailcall::async_graphql_hyper::{GraphQLBatchRequest, GraphQLRequest}; +use tailcall::blueprint::Blueprint; +use tailcall::config::reader::ConfigReader; +use tailcall::config::{Config, ConfigModule, Source}; +use tailcall::http::{handle_request, AppContext}; +use tailcall::merge_right::MergeRight; +use tailcall::print_schema::print_schema; +use tailcall::valid::{Cause, ValidationError, Validator as _}; + +use super::file::File; +use super::http::Http; +use super::model::*; +use super::runtime::ExecutionSpec; +use crate::core::runtime; + +#[derive(Debug, Default, Deserialize, Serialize, PartialEq)] +struct SDLError { + message: String, + trace: Vec, + description: Option, +} + +impl<'a> From> for SDLError { + fn from(value: Cause<&'a str>) -> Self { + SDLError { + message: value.message.to_string(), + trace: value.trace.iter().map(|e| e.to_string()).collect(), + description: None, + } + } +} + +impl From> for SDLError { + fn from(value: Cause) -> Self { + SDLError { + message: value.message.to_string(), + trace: value.trace.iter().map(|e| e.to_string()).collect(), + description: value.description, + } + } +} + +async fn is_sdl_error(spec: ExecutionSpec, mock_http_client: Arc) -> bool { + if spec.sdl_error { + // errors: errors are expected, make sure they match + let (source, content) = &spec.server[0]; + + if !matches!(source, Source::GraphQL) { + panic!("Cannot use \"sdl error\" directive with a non-GraphQL server block."); + } + + let config = Config::from_sdl(content).to_result(); + + let config = match config { + Ok(config) => { + let mut runtime = runtime::create_runtime(mock_http_client, spec.env.clone(), None); + runtime.file = Arc::new(File::new(spec.clone())); + let reader = ConfigReader::init(runtime); + match reader.resolve(config, spec.path.parent()).await { + Ok(config) => Blueprint::try_from(&config), + Err(e) => Err(ValidationError::new(e.to_string())), + } + } + Err(e) => Err(e), + }; + + match config { + Ok(_) => { + tracing::error!("\terror FAIL"); + panic!( + "Spec {} {:?} with \"sdl error\" directive did not have a validation error.", + spec.name, spec.path + ); + } + Err(cause) => { + let errors: Vec = + cause.as_vec().iter().map(|e| e.to_owned().into()).collect(); + + let snapshot_name = format!("execution_spec__{}_errors", spec.safe_name); + + insta::assert_json_snapshot!(snapshot_name, errors); + } + }; + + return true; + } + false +} + +async fn check_server_config(spec: ExecutionSpec) -> Vec { + let mut server: Vec = Vec::with_capacity(spec.server.len()); + + for (i, (source, content)) in spec.server.iter().enumerate() { + let config = Config::from_source(source.to_owned(), content).unwrap_or_else(|e| { + panic!( + "Couldn't parse GraphQL in server definition #{} of {:#?}: {}", + i + 1, + spec.path, + e + ) + }); + + let config = Config::default().merge_right(config); + + // TODO: we should probably figure out a way to do this for every test + // but GraphQL identity checking is very hard, since a lot depends on the code + // style the re-serializing check gives us some of the advantages of the + // identity check too, but we are missing out on some by having it only + // enabled for either new tests that request it or old graphql_spec + // tests that were explicitly written with it in mind + if spec.check_identity { + if matches!(source, Source::GraphQL) { + let identity = config.to_sdl(); + + // \r is added automatically in windows, it's safe to replace it with \n + let content = content.replace("\r\n", "\n"); + + let path_str = spec.path.display().to_string(); + + let identity = tailcall_prettier::format( + identity, + tailcall_prettier::Parser::detect(path_str.as_str()).unwrap(), + ) + .await + .unwrap(); + + let content = tailcall_prettier::format( + content, + tailcall_prettier::Parser::detect(path_str.as_str()).unwrap(), + ) + .await + .unwrap(); + + pretty_assertions::assert_eq!( + identity, + content, + "Identity check failed for {:#?}", + spec.path, + ); + } else { + panic!( + "Spec {:#?} has \"check identity\" enabled, but its config isn't in GraphQL.", + spec.path + ); + } + } + + server.push(config); + } + server +} + +async fn run_query_tests_on_spec( + spec: ExecutionSpec, + server: Vec, + mock_http_client: Arc, +) { + if let Some(tests) = spec.test.as_ref() { + let app_ctx = spec + .app_context( + server.first().unwrap(), + spec.env.clone().unwrap_or_default(), + mock_http_client.clone(), + ) + .await; + + // test: Run test specs + + for (i, test) in tests.iter().enumerate() { + let response = run_test(app_ctx.clone(), test) + .await + .context(spec.path.to_str().unwrap().to_string()) + .unwrap(); + + let mut headers: BTreeMap = BTreeMap::new(); + + for (key, value) in response.headers() { + headers.insert(key.to_string(), value.to_str().unwrap().to_string()); + } + + let response: APIResponse = APIResponse { + status: response.status().clone().as_u16(), + headers, + body: Some(APIBody::Value( + serde_json::from_slice( + &hyper::body::to_bytes(response.into_body()).await.unwrap(), + ) + .unwrap_or_default(), + )), + }; + + let snapshot_name = format!("{}_{}", spec.safe_name, i); + + insta::assert_json_snapshot!(snapshot_name, response); + } + + mock_http_client.test_hits(&spec.path); + } +} + +async fn test_spec(spec: ExecutionSpec) { + // insta settings + let mut insta_settings = insta::Settings::clone_current(); + insta_settings.set_prepend_module_to_snapshot(false); + let _guard = insta::Settings::bind_to_scope(&insta_settings); + + let mock_http_client = Arc::new(Http::new(&spec)); + + // check sdl error if any + if is_sdl_error(spec.clone(), mock_http_client.clone()).await { + return; + } + + // Parse and validate all server configs + check for identity + let server = check_server_config(spec.clone()).await; + + // merged: Run merged specs + let merged = server + .iter() + .fold(Config::default(), |acc, c| acc.merge_right(c.clone())) + .to_sdl(); + + let snapshot_name = format!("{}_merged", spec.safe_name); + + insta::assert_snapshot!(snapshot_name, merged); + + // Resolve all configs + let mut runtime = runtime::create_runtime(mock_http_client.clone(), spec.env.clone(), None); + runtime.file = Arc::new(File::new(spec.clone())); + let reader = ConfigReader::init(runtime); + + let server: Vec = join_all( + server + .into_iter() + .map(|config| reader.resolve(config, spec.path.parent())), + ) + .await + .into_iter() + .enumerate() + .map(|(i, result)| { + result.unwrap_or_else(|e| { + panic!( + "Couldn't resolve GraphQL in server definition #{} of {:#?}: {}", + i + 1, + spec.path, + e + ) + }) + }) + .collect(); + + // client: Check if client spec matches snapshot + if server.len() == 1 { + let config = &server[0]; + + let client = print_schema( + (Blueprint::try_from(config) + .context(format!("file: {}", spec.path.to_str().unwrap())) + .unwrap()) + .to_schema(), + ); + let snapshot_name = format!("{}_client", spec.safe_name); + + insta::assert_snapshot!(snapshot_name, client); + } + + // run query tests + run_query_tests_on_spec(spec, server, mock_http_client).await; +} + +pub async fn load_and_test_execution_spec(path: &Path) -> anyhow::Result<()> { + let contents = fs::read_to_string(path)?; + let spec: ExecutionSpec = ExecutionSpec::from_source(path, contents) + .await + .with_context(|| path.display().to_string())?; + + match spec.runner { + Some(Annotation::Skip) => { + println!("{} ... {}", spec.path.display(), "skipped".blue()); + } + None => test_spec(spec).await, + } + + Ok(()) +} + +async fn run_test( + app_ctx: Arc, + request: &APIRequest, +) -> anyhow::Result> { + let body = request + .body + .as_ref() + .map(|body| Body::from(body.to_bytes())) + .unwrap_or_default(); + + let method = request.method.clone(); + let headers = request.headers.clone(); + let url = request.url.clone(); + let req = headers + .into_iter() + .fold( + Request::builder() + .method(method.to_hyper()) + .uri(url.as_str()), + |acc, (key, value)| acc.header(key, value), + ) + .body(body)?; + + // TODO: reuse logic from server.rs to select the correct handler + if app_ctx.blueprint.server.enable_batch_requests { + handle_request::(req, app_ctx).await + } else { + handle_request::(req, app_ctx).await + } +} diff --git a/tests/execution/add-field-index-list.md b/tests/execution/add-field-index-list.md index e7fde54745..2b58267db9 100644 --- a/tests/execution/add-field-index-list.md +++ b/tests/execution/add-field-index-list.md @@ -18,7 +18,6 @@ type Query @addField(name: "username", path: ["users", "0", "name"]) { - request: method: GET url: http://jsonplaceholder.typicode.com/users - body: null response: status: 200 body: @@ -26,7 +25,7 @@ type Query @addField(name: "username", path: ["users", "0", "name"]) { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/add-field-modify.md b/tests/execution/add-field-modify.md index 29afaf8d3c..46549bd3b4 100644 --- a/tests/execution/add-field-modify.md +++ b/tests/execution/add-field-modify.md @@ -28,7 +28,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -40,7 +39,7 @@ type Query { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/add-field-with-composition.md b/tests/execution/add-field-with-composition.md index 59fef3df3c..732bc40115 100644 --- a/tests/execution/add-field-with-composition.md +++ b/tests/execution/add-field-with-composition.md @@ -30,8 +30,7 @@ type Query - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null - expected_hits: 2 + expectedHits: 2 response: status: 200 body: @@ -43,7 +42,7 @@ type Query name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/add-field-with-modify.md b/tests/execution/add-field-with-modify.md index 782bbae26e..ec738b8f11 100644 --- a/tests/execution/add-field-with-modify.md +++ b/tests/execution/add-field-with-modify.md @@ -18,7 +18,6 @@ type Query @addField(name: "user1", path: ["person1", "name"]) @addField(name: " - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -27,7 +26,6 @@ type Query @addField(name: "user1", path: ["person1", "name"]) @addField(name: " - request: method: GET url: http://jsonplaceholder.typicode.com/users/2 - body: null response: status: 200 body: @@ -35,7 +33,7 @@ type Query @addField(name: "user1", path: ["person1", "name"]) @addField(name: " name: Ervin Howell ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/add-field.md b/tests/execution/add-field.md index 21f186e1af..5fab2d7367 100644 --- a/tests/execution/add-field.md +++ b/tests/execution/add-field.md @@ -26,7 +26,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -37,7 +36,7 @@ type Query { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/apollo-tracing.md b/tests/execution/apollo-tracing.md index 2165f821b9..e534dc0780 100644 --- a/tests/execution/apollo-tracing.md +++ b/tests/execution/apollo-tracing.md @@ -16,13 +16,12 @@ type Query { - request: method: GET url: http://api.com - body: null response: status: 200 body: hello ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8000/graphql body: diff --git a/tests/execution/auth-basic.md b/tests/execution/auth-basic.md index 010e10fff6..95f413e2aa 100644 --- a/tests/execution/auth-basic.md +++ b/tests/execution/auth-basic.md @@ -47,7 +47,7 @@ testuser3:{SHA}Y2fEjdGT1W6nsLqtJbGUVeUp9e4= nested: mutation nested ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/auth-jwt.md b/tests/execution/auth-jwt.md index fb570af9a5..d91aeb4f22 100644 --- a/tests/execution/auth-jwt.md +++ b/tests/execution/auth-jwt.md @@ -56,7 +56,7 @@ type ProtectedType @protected { nested: mutation nested ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/batching-default.md b/tests/execution/batching-default.md index cbe0e28331..1c8936528a 100644 --- a/tests/execution/batching-default.md +++ b/tests/execution/batching-default.md @@ -15,7 +15,11 @@ type Post { body: String userId: Int! user: User - @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}], batchKey: ["id"]) + @http( + path: "/users" + query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] + batchKey: ["id"] + ) } type User { @@ -28,7 +32,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1 - body: null response: status: 200 body: @@ -39,7 +42,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users?id=1&foo=bar&id=2&foo=bar - body: null response: status: 200 body: @@ -47,7 +49,7 @@ type User { - id: 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/batching-disabled.md b/tests/execution/batching-disabled.md index 51ccfeff6f..4c8d4c6ea0 100644 --- a/tests/execution/batching-disabled.md +++ b/tests/execution/batching-disabled.md @@ -27,7 +27,7 @@ } }, "http": { - "path": "/users/{{args.id}}" + "path": "/users/{{.args.id}}" }, "cache": null } @@ -59,7 +59,6 @@ - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -68,7 +67,6 @@ - request: method: GET url: http://jsonplaceholder.typicode.com/users/2 - body: null response: status: 200 body: @@ -76,7 +74,7 @@ name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/batching-group-by-default.md b/tests/execution/batching-group-by-default.md index 448eaf3312..19b6e035a8 100644 --- a/tests/execution/batching-group-by-default.md +++ b/tests/execution/batching-group-by-default.md @@ -17,7 +17,11 @@ type Post { body: String userId: Int! user: User - @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) + @http( + batchKey: ["id"] + path: "/users" + query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] + ) } type User { @@ -30,7 +34,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1 - body: null response: status: 200 body: @@ -45,7 +48,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users?id=1&foo=bar&id=2&foo=bar - body: null response: status: 200 body: @@ -55,7 +57,7 @@ type User { name: bar ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/batching-group-by.md b/tests/execution/batching-group-by.md index ba5588130f..e78ab62899 100644 --- a/tests/execution/batching-group-by.md +++ b/tests/execution/batching-group-by.md @@ -17,7 +17,11 @@ type Post { body: String userId: Int! user: User - @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}], batchKey: ["id"]) + @http( + path: "/users" + query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] + batchKey: ["id"] + ) } type User { @@ -30,7 +34,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1 - body: null response: status: 200 body: @@ -45,7 +48,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users?id=1&foo=bar&id=2&foo=bar - body: null response: status: 200 body: @@ -55,7 +57,7 @@ type User { name: Ervin Howell ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/batching-post.md b/tests/execution/batching-post.md index eff55702cb..a2a6d42c87 100644 --- a/tests/execution/batching-post.md +++ b/tests/execution/batching-post.md @@ -20,7 +20,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type User { @@ -33,7 +33,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/posts?id=1 - body: null response: status: 200 body: @@ -42,7 +41,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -50,7 +48,7 @@ type User { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/batching.md b/tests/execution/batching.md index 8fd715dac9..ebe91eecb9 100644 --- a/tests/execution/batching.md +++ b/tests/execution/batching.md @@ -46,8 +46,7 @@ url: http://jsonplaceholder.typicode.com/users/1 headers: test: test - body: null - expected_hits: 2 + expectedHits: 2 response: status: 200 body: @@ -55,7 +54,7 @@ name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/cache-control.md b/tests/execution/cache-control.md index 99a758522f..ffef976562 100644 --- a/tests/execution/cache-control.md +++ b/tests/execution/cache-control.md @@ -26,7 +26,7 @@ "query": [ { "key": "id", - "value": "{{args.id}}" + "value": "{{.args.id}}" } ], "baseURL": "http://jsonplaceholder.typicode.com" @@ -59,8 +59,7 @@ url: http://jsonplaceholder.typicode.com/users?id=1 headers: test: test - body: null - expected_hits: 3 + expectedHits: 3 response: status: 200 headers: @@ -73,7 +72,6 @@ url: http://jsonplaceholder.typicode.com/users?id=2 headers: test: test - body: null response: status: 200 headers: @@ -86,8 +84,7 @@ url: http://jsonplaceholder.typicode.com/users?id=3 headers: test: test - body: null - expected_hits: 2 + expectedHits: 2 response: status: 200 headers: @@ -100,8 +97,7 @@ url: http://jsonplaceholder.typicode.com/users?id=4 headers: test: test - body: null - expected_hits: 2 + expectedHits: 2 response: status: 200 headers: @@ -111,7 +107,7 @@ name: barfoo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/caching-collision.md b/tests/execution/caching-collision.md index c9bf85e36b..116a20828b 100644 --- a/tests/execution/caching-collision.md +++ b/tests/execution/caching-collision.md @@ -15,7 +15,7 @@ type Foo { type Bar { id: String! - foo: Foo @http(path: "/foo?id={{value.id}}") @cache(maxAge: 300) + foo: Foo @http(path: "/foo?id={{.value.id}}") @cache(maxAge: 300) } ``` @@ -23,7 +23,6 @@ type Bar { - request: method: GET url: http://example.com/bars - body: null response: status: 200 body: @@ -130,7 +129,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBZh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -138,7 +136,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=ByVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -146,7 +143,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SE3mXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -154,7 +150,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BEVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -162,7 +157,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DFPDXIwHe - body: null response: status: 200 body: @@ -170,7 +164,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSoYIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -178,7 +171,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZigeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -186,7 +178,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEomXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -194,7 +185,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKFxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -202,7 +192,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvePbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -210,7 +199,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jsz1qh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -218,7 +206,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ5f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -226,7 +213,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYftglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -234,7 +220,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQ7YUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -242,7 +227,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqp8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -250,7 +234,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -258,7 +241,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtHlFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -266,7 +248,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbczXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -274,7 +255,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeF6bPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -282,7 +262,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFGbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -290,7 +269,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSxrIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -298,7 +276,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSo9IxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -306,7 +283,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjrXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -314,7 +290,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FtO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -322,7 +297,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3n2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -330,7 +304,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FoO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -338,7 +311,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvVvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -346,7 +318,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3VpzFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -354,7 +325,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoumL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -362,7 +332,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTYZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -370,7 +339,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtgRFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -378,7 +346,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sfZV2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -386,7 +353,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwKe - body: null response: status: 200 body: @@ -394,7 +360,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jjzyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -402,7 +367,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmcWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -410,7 +374,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFw4i4DNPDXIwHe - body: null response: status: 200 body: @@ -418,7 +381,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL3345FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -426,7 +388,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgaFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -434,7 +395,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImR33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -442,7 +402,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXRorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -450,7 +409,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvfKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -458,7 +416,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQIf7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -466,7 +423,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnOImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -474,7 +430,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPmckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -482,7 +437,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbc9XSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -490,7 +444,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3q7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -498,7 +451,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFkbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -506,7 +458,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoTmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -514,7 +465,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIFmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -522,7 +472,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33d5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -530,7 +479,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSosIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -538,7 +486,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SVjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -546,7 +493,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4JszyJh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -554,7 +500,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFhoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -562,7 +507,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSSrIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -570,7 +514,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Za6x1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -578,7 +521,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFwbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -586,7 +528,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SIjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -594,7 +535,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImt33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -602,7 +542,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoIwL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -610,7 +549,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdw4DNPDXIwHe - body: null response: status: 200 body: @@ -618,7 +556,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4J6zyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -626,7 +563,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jskyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -634,7 +570,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2NFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -642,7 +577,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorFxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -650,7 +584,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25yXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -658,7 +591,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4lszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -666,7 +598,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFmdi4DNPDXIwHe - body: null response: status: 200 body: @@ -674,7 +605,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jsjyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -682,7 +612,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sfXV2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -690,7 +619,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYe25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -698,7 +626,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSogIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -706,7 +633,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33n5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -714,7 +640,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZqgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -722,7 +647,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwJi4DNPDXIwHe - body: null response: status: 200 body: @@ -730,7 +654,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoKmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -738,7 +661,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FY625TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -746,7 +668,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTzZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -754,7 +675,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoIFL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -762,7 +682,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvNKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -770,7 +689,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTMZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -778,7 +696,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFyoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -786,7 +703,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3VqzFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -794,7 +710,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4oszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -802,7 +717,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDHIwHe - body: null response: status: 200 body: @@ -810,7 +724,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKvxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -818,7 +731,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1yf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -826,7 +738,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f8Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -834,7 +745,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25rXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -842,7 +752,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgPFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -850,7 +759,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi45NPDXIwHe - body: null response: status: 200 body: @@ -858,7 +766,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQHf7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -866,7 +773,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPb9kXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -874,7 +780,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnonmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -882,7 +787,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUhkJszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -890,7 +794,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvFKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -898,7 +801,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5SYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -906,7 +808,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Pszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -914,7 +815,6 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtgHFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: @@ -922,14 +822,13 @@ type Bar { - request: method: GET url: http://example.com/foo?id=BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmIUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe - body: null response: status: 200 body: id: 99 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/caching.md b/tests/execution/caching.md index 2b9bafa9c4..0dd9ee7616 100644 --- a/tests/execution/caching.md +++ b/tests/execution/caching.md @@ -68,7 +68,7 @@ type TypeCache @cache(maxAge: 1000) { - id: 33 ``` -```yml @assert +```yml @test # the same request to validate caching - method: POST url: http://localhost:8080/graphql diff --git a/tests/execution/call-graphql-datasource.md b/tests/execution/call-graphql-datasource.md index f71abe0087..df32c6d7ad 100644 --- a/tests/execution/call-graphql-datasource.md +++ b/tests/execution/call-graphql-datasource.md @@ -10,7 +10,7 @@ schema type Query { posts: [Post] @http(path: "/posts") user(id: Int!): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -27,7 +27,7 @@ type Post { userId: Int! title: String! body: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } ``` @@ -35,7 +35,6 @@ type Post { - request: method: GET url: http://jsonplaceholder.typicode.com/posts - body: null response: status: 200 body: @@ -54,8 +53,8 @@ type Post { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { user(id: 1) { name } }" }' - expected_hits: 1 + textBody: '{ "query": "query { user(id: 1) { name } }" }' + expectedHits: 1 response: status: 200 body: @@ -65,8 +64,8 @@ type Post { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { user(id: 2) { name } }" }' - expected_hits: 1 + textBody: '{ "query": "query { user(id: 2) { name } }" }' + expectedHits: 1 response: status: 200 body: @@ -75,7 +74,7 @@ type Post { name: Ervin Howell ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/call-multiple-steps-piping.md b/tests/execution/call-multiple-steps-piping.md index 137d3a611b..fba8b69b7b 100644 --- a/tests/execution/call-multiple-steps-piping.md +++ b/tests/execution/call-multiple-steps-piping.md @@ -6,18 +6,18 @@ schema { } type Query { - a_input(input: JSON): JSON @expr(body: {input: "{{args.input.a}}"}) - b_input(input: JSON): JSON @expr(body: {input: "{{args.input.b}}"}) - a(input: JSON): JSON @expr(body: "{{args.input.a}}") - b(input: JSON): JSON @expr(body: "{{args.input.b}}") - c(input: JSON): JSON @expr(body: "{{args.input.c}}") - wrap_args: JSON @expr(body: {input: "{{args}}"}) - wrap_input(input: JSON): JSON @expr(body: {input: "{{args.input}}"}) + a_input(input: JSON): JSON @expr(body: {input: "{{.args.input.a}}"}) + b_input(input: JSON): JSON @expr(body: {input: "{{.args.input.b}}"}) + a(input: JSON): JSON @expr(body: "{{.args.input.a}}") + b(input: JSON): JSON @expr(body: "{{.args.input.b}}") + c(input: JSON): JSON @expr(body: "{{.args.input.c}}") + wrap_args: JSON @expr(body: {input: "{{.args}}"}) + wrap_input(input: JSON): JSON @expr(body: {input: "{{.args.input}}"}) abc_input(input: JSON): JSON @call( steps: [ - {query: "wrap_input", args: {input: "{{args.input}}"}} + {query: "wrap_input", args: {input: "{{.args.input}}"}} {query: "a_input"} {query: "wrap_input"} {query: "b_input"} @@ -28,7 +28,7 @@ type Query { abc(input: JSON): JSON @call( steps: [ - {query: "a", args: {input: "{{args.input}}"}} + {query: "a", args: {input: "{{.args.input}}"}} {query: "wrap_args"} {query: "b"} {query: "wrap_args"} @@ -38,7 +38,7 @@ type Query { } ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/call-mutation.md b/tests/execution/call-mutation.md index 714c4ca3e2..929d6bbf8f 100644 --- a/tests/execution/call-mutation.md +++ b/tests/execution/call-mutation.md @@ -20,16 +20,16 @@ input PostInputWithoutUserId { type Mutation { attachPostToFirstUser(postId: Int!): User - @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{args.postId}}", userId: 1}}]) + @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{.args.postId}}", userId: 1}}]) attachPostToUser(userId: Int!, postId: Int!): User - @http(body: "{\"postId\":{{args.postId}}}", method: "PATCH", path: "/users/{{args.userId}}") - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + @http(body: "{\"postId\":{{.args.postId}}}", method: "PATCH", path: "/users/{{.args.userId}}") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") insertPostToFirstUser(input: PostInputWithoutUserId): Post - @call(steps: [{mutation: "insertPostToUser", args: {input: "{{args.input}}", userId: 1}}]) + @call(steps: [{mutation: "insertPostToUser", args: {input: "{{.args.input}}", userId: 1}}]) insertMockedPost: Post @call(steps: [{mutation: "insertPost", args: {input: {body: "post-body", title: "post-title", userId: 1}}}]) insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post - @http(body: "{{args.input}}", method: "POST", path: "/users/{{args.userId}}/posts") + @http(body: "{{.args.input}}", method: "POST", path: "/users/{{.args.userId}}/posts") } type Post { @@ -41,13 +41,13 @@ type Post { type Query { firstUser: User @http(method: "GET", path: "/users/1") - postFromUser(userId: Int!): Post @http(path: "/posts?userId={{args.userId}}") + postFromUser(userId: Int!): Post @http(path: "/posts?userId={{.args.userId}}") } type User { id: Int name: String - posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{.value.id}}"}}]) } ``` @@ -55,8 +55,8 @@ type User { - request: method: POST url: http://jsonplaceholder.typicode.com/posts - body: '{"body":"post-body","title":"post-title","userId":1}' - expected_hits: 2 + body: {"body": "post-body", "title": "post-title", "userId": 1} + expectedHits: 2 response: status: 200 body: @@ -66,7 +66,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -75,7 +74,7 @@ type User { - request: method: PATCH url: http://jsonplaceholder.typicode.com/users/1 - body: '{"postId":1}' + body: {"postId": 1} response: status: 200 body: @@ -84,7 +83,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/posts?userId=1 - body: null response: status: 200 body: @@ -103,7 +101,7 @@ type User { - request: method: POST url: http://jsonplaceholder.typicode.com/users/1/posts - body: '{"body":"post-body","title":"post-title"}' + body: {"body": "post-body", "title": "post-title"} response: status: 200 body: @@ -112,7 +110,7 @@ type User { userId: 1 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/call-operator.md b/tests/execution/call-operator.md index b91f1a2c85..cfff8e49ce 100644 --- a/tests/execution/call-operator.md +++ b/tests/execution/call-operator.md @@ -47,20 +47,20 @@ schema type Query { userId: Int! @expr(body: 2) posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") - userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{args.id}}"}]) + user(id: Int!): User @http(path: "/users/{{.args.id}}") + userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{.args.id}}"}]) user1: User @http(path: "/users/1") - userFromValue: User @http(path: "/users/{{value.userId}}") - userHttpHeaders(id: ID!): User @http(path: "/users", headers: [{key: "id", value: "{{args.id}}"}]) - userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}]) + userFromValue: User @http(path: "/users/{{.value.userId}}") + userHttpHeaders(id: ID!): User @http(path: "/users", headers: [{key: "id", value: "{{.args.id}}"}]) + userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) userGraphQL(id: Int): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) userGraphQLHeaders(id: Int!): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", headers: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", headers: [{key: "id", value: "{{.args.id}}"}]) userWithPosts: UserWithPosts @http(path: "/users/1") news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsWithPortArg(port: Int!): NewsData! - @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:{{args.port}}") + @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:{{.args.port}}") } type NewsData { @@ -77,7 +77,7 @@ type News { type UserWithPosts { id: Int! name: String! - posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{.value.id}}"}}]) } type User { @@ -96,11 +96,11 @@ type Post { body: String user1: User @call(steps: [{query: "user1"}]) userFromValue: User @call(steps: [{query: "userFromValue"}]) - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) - userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{value.userId}}"}}]) - userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{value.userId}}"}}]) - userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{value.userId}}"}}]) - userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) + userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{.value.userId}}"}}]) + userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{.value.userId}}"}}]) + userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{.value.userId}}"}}]) + userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{.value.userId}}"}}]) news: NewsData! @call(steps: [{query: "news"}]) newsWithPortArg: NewsData! @call(steps: [{query: "news", args: {port: 50051}}]) } @@ -109,7 +109,7 @@ type Post { ```yml @mock - request: url: http://jsonplaceholder.typicode.com/users/1 - expected_hits: 4 + expectedHits: 4 response: body: id: 1 @@ -124,7 +124,7 @@ type Post { name: "Leanne Graham http headers" - request: url: http://jsonplaceholder.typicode.com/posts - expected_hits: 9 + expectedHits: 9 response: body: - id: 1 @@ -138,10 +138,10 @@ type Post { - request: url: http://upstream/graphql method: POST - body: '{ "query": "query { user { name } }" }' + textBody: '{ "query": "query { user { name } }" }' headers: id: 1 - expected_hits: 2 + expectedHits: 2 response: body: data: @@ -149,7 +149,7 @@ type Post { name: "Leanne Graham" - request: url: http://jsonplaceholder.typicode.com/posts?userId=1 - expected_hits: 2 + expectedHits: 2 response: body: - id: 1 @@ -163,12 +163,12 @@ type Post { - request: url: http://localhost:50051/news.NewsService/GetAllNews method: POST - expected_hits: 4 + expectedHits: 4 response: - body: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 + textBody: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/cors-allow-cred-false.md b/tests/execution/cors-allow-cred-false.md index 2e6a005626..b6b6d96143 100644 --- a/tests/execution/cors-allow-cred-false.md +++ b/tests/execution/cors-allow-cred-false.md @@ -22,7 +22,7 @@ type Query { } ``` -```yml @assert +```yml @test # the same request to validate caching - method: OPTIONS url: http://localhost:8080/graphql diff --git a/tests/execution/cors-allow-cred-true.md b/tests/execution/cors-allow-cred-true.md index 3a1d2be223..5ffed35112 100644 --- a/tests/execution/cors-allow-cred-true.md +++ b/tests/execution/cors-allow-cred-true.md @@ -22,7 +22,7 @@ type Query { } ``` -```yml @assert +```yml @test # the same request to validate caching - method: OPTIONS url: http://localhost:8080/graphql diff --git a/tests/execution/cors-allow-cred-vary.md b/tests/execution/cors-allow-cred-vary.md index 99deee2bd7..b1a131542c 100644 --- a/tests/execution/cors-allow-cred-vary.md +++ b/tests/execution/cors-allow-cred-vary.md @@ -22,7 +22,7 @@ type Query { } ``` -```yml @assert +```yml @test # the same request to validate caching - method: POST url: http://localhost:8080/graphql diff --git a/tests/execution/custom-headers.md b/tests/execution/custom-headers.md index 636ae90a81..209130d669 100644 --- a/tests/execution/custom-headers.md +++ b/tests/execution/custom-headers.md @@ -37,7 +37,7 @@ } ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/env-value.md b/tests/execution/env-value.md index ea3fc1405e..41b5d5541f 100644 --- a/tests/execution/env-value.md +++ b/tests/execution/env-value.md @@ -37,21 +37,21 @@ "post1": { "type": "Post", "http": { - "path": "/posts/{{env.ID}}" + "path": "/posts/{{.env.ID}}" }, "cache": null }, "post2": { "type": "Post", "http": { - "path": "/posts/{{env.POST_ID}}" + "path": "/posts/{{.env.POST_ID}}" }, "cache": null }, "post3": { "type": "Post", "http": { - "path": "/posts/{{env.NESTED_POST_ID}}" + "path": "/posts/{{.env.NESTED_POST_ID}}" }, "cache": null } @@ -66,7 +66,6 @@ - request: method: GET url: http://jsonplaceholder.typicode.com/posts/1 - body: null response: status: 200 body: @@ -77,7 +76,6 @@ - request: method: GET url: http://jsonplaceholder.typicode.com/posts/2 - body: null response: status: 200 body: @@ -88,7 +86,6 @@ - request: method: GET url: http://jsonplaceholder.typicode.com/posts/3 - body: null response: status: 200 body: @@ -104,7 +101,7 @@ POST_ID: "2" NESTED_POST_ID: "3" ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/experimental-headers.md b/tests/execution/experimental-headers.md index 70981ba1db..35689aad50 100644 --- a/tests/execution/experimental-headers.md +++ b/tests/execution/experimental-headers.md @@ -19,7 +19,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users - body: null response: status: 200 headers: @@ -31,7 +30,7 @@ type User { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/graphql-dataloader-batch-keys.md b/tests/execution/graphql-dataloader-batch-keys.md index 171b0c054b..c0b065f99c 100644 --- a/tests/execution/graphql-dataloader-batch-keys.md +++ b/tests/execution/graphql-dataloader-batch-keys.md @@ -20,8 +20,8 @@ type A { id: Int! bid: Int! cid: Int! - b: B @graphQL(name: "b", args: [{key: "id", value: "{{value.bid}}"}], batch: true) - c: C @graphQL(name: "c", args: [{key: "id", value: "{{value.cid}}"}], batch: true) + b: B @graphQL(name: "b", args: [{key: "id", value: "{{.value.bid}}"}], batch: true) + c: C @graphQL(name: "c", args: [{key: "id", value: "{{.value.cid}}"}], batch: true) } type C { @@ -39,7 +39,7 @@ type B { - request: method: POST url: http://upstream/graphql - body: '[{"query": "a {id, bid, cid}"}]' + textBody: '[{"query": "a {id, bid, cid}"}]' response: status: 200 body: @@ -60,7 +60,7 @@ type B { - request: method: POST url: http://upstream/graphql - body: '[{"query": "b {y}"},{"query": "c {x}"}]' + textBody: '[{"query": "b {y}"},{"query": "c {x}"}]' response: status: 200 body: @@ -73,7 +73,7 @@ type B { - request: method: POST url: http://upstream/graphql - body: '[{"query": "c {x}"},{"query": "b {y}"}]' + textBody: '[{"query": "c {x}"},{"query": "b {y}"}]' response: status: 200 body: @@ -85,7 +85,7 @@ type B { y: 1 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/graphql-dataloader-batch-request.md b/tests/execution/graphql-dataloader-batch-request.md index 3cbe4be85e..f81f742a83 100644 --- a/tests/execution/graphql-dataloader-batch-request.md +++ b/tests/execution/graphql-dataloader-batch-request.md @@ -11,7 +11,7 @@ type Post { userId: Int user: User @graphQL( - args: [{key: "id", value: "{{value.userId}}"}] + args: [{key: "id", value: "{{.value.userId}}"}] baseURL: "http://upstream/graphql" batch: true name: "user" @@ -32,7 +32,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/posts - body: null response: status: 200 body: @@ -51,7 +50,8 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '[{ "query": "query { user(id: 1) { name } }" },{ "query": "query { user(id: 2) { name } }" }]' + textBody: '[{ "query": "query { user(id: 1) { name } }" },{ "query": "query { user(id: 2) { name } }" }]' + assertHits: false response: status: 200 body: @@ -64,7 +64,8 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '[{ "query": "query { user(id: 2) { name } }" },{ "query": "query { user(id: 1) { name } }" }]' + textBody: '[{ "query": "query { user(id: 2) { name } }" },{ "query": "query { user(id: 1) { name } }" }]' + assertHits: false response: status: 200 body: @@ -76,7 +77,7 @@ type Query { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/graphql-dataloader-no-batch-request.md b/tests/execution/graphql-dataloader-no-batch-request.md index 825f07c271..585eb4da92 100644 --- a/tests/execution/graphql-dataloader-no-batch-request.md +++ b/tests/execution/graphql-dataloader-no-batch-request.md @@ -9,7 +9,7 @@ type Post { id: Int title: String userId: Int - user: User @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{value.userId}}"}]) + user: User @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type User { @@ -26,7 +26,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/posts - body: null response: status: 200 body: @@ -45,7 +44,7 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { user(id: 1) { name } }" }' + textBody: '{ "query": "query { user(id: 1) { name } }" }' response: status: 200 body: @@ -55,7 +54,7 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { user(id: 2) { name } }" }' + textBody: '{ "query": "query { user(id: 2) { name } }" }' response: status: 200 body: @@ -64,7 +63,7 @@ type Query { name: Ervin Howell ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/graphql-datasource-errors.md b/tests/execution/graphql-datasource-errors.md index 640a6eb1d7..788fd4de94 100644 --- a/tests/execution/graphql-datasource-errors.md +++ b/tests/execution/graphql-datasource-errors.md @@ -12,7 +12,7 @@ type User { type Query { user(id: Int): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } ``` @@ -20,7 +20,7 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { user(id: 1) { name } }" }' + textBody: '{ "query": "query { user(id: 1) { name } }" }' response: status: 200 body: @@ -35,7 +35,7 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { user(id: 2) { name id } }" }' + textBody: '{ "query": "query { user(id: 2) { name id } }" }' response: status: 200 body: @@ -50,7 +50,7 @@ type Query { message: Failed to resolve name ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/graphql-datasource-mutation.md b/tests/execution/graphql-datasource-mutation.md index c5f2d93f80..52b9bda7ed 100644 --- a/tests/execution/graphql-datasource-mutation.md +++ b/tests/execution/graphql-datasource-mutation.md @@ -17,7 +17,7 @@ type Query { type Mutation { createUser(user: UserInput!): User - @graphQL(baseURL: "http://upstream/graphql", name: "createUser", args: [{key: "user", value: "{{args.user}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "createUser", args: [{key: "user", value: "{{.args.user}}"}]) } type UserInput { @@ -31,7 +31,7 @@ type UserInput { - request: method: POST url: http://upstream/graphql - body: '{ "query": "mutation { createUser(user: {name: \"Test Name\", email: \"test@email\"}) { name } }" }' + textBody: {"query": 'mutation { createUser(user: {name: "Test Name", email: "test@email"}) { name } }'} response: status: 200 body: @@ -40,7 +40,7 @@ type UserInput { name: Test Name ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/graphql-datasource-no-args.md b/tests/execution/graphql-datasource-no-args.md index ea009251ab..3864a9ca3a 100644 --- a/tests/execution/graphql-datasource-no-args.md +++ b/tests/execution/graphql-datasource-no-args.md @@ -19,7 +19,7 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { users { name } }" }' + textBody: {"query": "query { users { name } }"} response: status: 200 body: @@ -29,7 +29,7 @@ type Query { - name: Ervin Howell ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/graphql-datasource-with-args.md b/tests/execution/graphql-datasource-with-args.md index ebcafeb536..bc60e3ac45 100644 --- a/tests/execution/graphql-datasource-with-args.md +++ b/tests/execution/graphql-datasource-with-args.md @@ -17,9 +17,9 @@ type Post { type Query { user(id: Int): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) post(id: Int): Post - @graphQL(baseURL: "http://upstream/graphql", name: "post", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "post", args: [{key: "id", value: "{{.args.id}}"}]) } ``` @@ -27,7 +27,7 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { user(id: 1) { name } }" }' + textBody: '{ "query": "query { user(id: 1) { name } }" }' response: status: 200 body: @@ -37,7 +37,7 @@ type Query { - request: method: POST url: http://upstream/graphql - body: '{ "query": "query { post(id: 1) { id user { name } } }" }' + textBody: '{ "query": "query { post(id: 1) { id user { name } } }" }' response: status: 200 body: @@ -48,7 +48,7 @@ type Query { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/grpc-batch.md b/tests/execution/grpc-batch.md index a06e2376cb..61072baec6 100644 --- a/tests/execution/grpc-batch.md +++ b/tests/execution/grpc-batch.md @@ -50,7 +50,7 @@ type Query { @grpc( method: "news.NewsService.GetMultipleNews" baseURL: "http://localhost:50051" - body: "{{args.news}}" + body: "{{.args.news}}" batchKey: ["news", "id"] ) } @@ -76,13 +76,22 @@ type News { - request: method: POST url: http://localhost:50051/news.NewsService/GetMultipleNews - body: \0\0\0\0\n\x02\x08\x02\n\x02\x08\x03 + textBody: \0\0\0\0\x08\n\x02\x08\x02\n\x02\x08\x03 + assertHits: false response: status: 200 - body: \0\0\0\0t\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2\n#\x08\x03\x12\x06Note 3\x1a\tContent 3\"\x0cPost image 3 + textBody: \0\0\0\0t\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2\n#\x08\x03\x12\x06Note 3\x1a\tContent 3\"\x0cPost image 3 +- request: + method: POST + url: http://localhost:50051/news.NewsService/GetMultipleNews + textBody: \0\0\0\0\x08\n\x02\x08\x03\n\x02\x08\x02 + assertHits: false + response: + status: 200 + textBody: \0\0\0\0t\n#\x08\x03\x12\x06Note 3\x1a\tContent 3\"\x0cPost image 3\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/grpc-error.md b/tests/execution/grpc-error.md index 3170a4d612..2d0ebe2661 100644 --- a/tests/execution/grpc-error.md +++ b/tests/execution/grpc-error.md @@ -47,7 +47,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{args.news}}") + @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int @@ -71,7 +71,6 @@ type News { - request: method: POST url: http://localhost:50051/news.NewsService/GetAllNews - body: null response: status: 200 headers: @@ -82,7 +81,7 @@ type News { body: ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/grpc-override-url-from-upstream.md b/tests/execution/grpc-override-url-from-upstream.md index ffde081bc2..718d5a04de 100644 --- a/tests/execution/grpc-override-url-from-upstream.md +++ b/tests/execution/grpc-override-url-from-upstream.md @@ -47,7 +47,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}", baseURL: "http://localhost:50051") + @grpc(method: "news.NewsService.GetNews", body: "{{.args.news}}", baseURL: "http://localhost:50051") } input NewsInput { id: Int @@ -71,13 +71,12 @@ type News { - request: method: POST url: http://localhost:50051/news.NewsService/GetAllNews - body: null response: status: 200 - body: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 + textBody: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/grpc-proto-with-same-package.md b/tests/execution/grpc-proto-with-same-package.md new file mode 100644 index 0000000000..67925aa28e --- /dev/null +++ b/tests/execution/grpc-proto-with-same-package.md @@ -0,0 +1,80 @@ +# Grpc when multiple proto files have the same package name + +```protobuf @file:foo.proto +syntax = "proto3"; + +import "google/protobuf/empty.proto"; + +package test; + +message Foo { + string foo = 1; +} + +service FooService { + rpc GetFoo (google.protobuf.Empty) returns (Foo) {} +} +``` + +```protobuf @file:bar.proto +syntax = "proto3"; + +import "google/protobuf/empty.proto"; + +package test; + + +message Bar { + string bar = 1; +} + +service BarService { + rpc GetBar (google.protobuf.Empty) returns (Bar) {} +} +``` + +```graphql @server +schema + @server(port: 8000, graphiql: true) + @upstream(baseURL: "http://localhost:50051") + @link(src: "foo.proto", type: Protobuf) + @link(src: "bar.proto", type: Protobuf) { + query: Query +} + +type Query { + foo: Foo! @grpc(method: "test.FooService.GetFoo") + bar: Bar! @grpc(method: "test.BarService.GetBar") +} + +type Foo { + foo: String +} + +type Bar { + bar: String +} +``` + +```yml @mock +- request: + method: POST + url: http://localhost:50051/test.FooService/GetFoo + response: + status: 200 + textBody: \0\0\0\0\n\n\x08test-foo + +- request: + method: POST + url: http://localhost:50051/test.BarService/GetBar + response: + status: 200 + textBody: \0\0\0\0\n\n\x08test-bar +``` + +```yml @test +- method: POST + url: http://localhost:8080/graphql + body: + query: query { foo { foo } bar { bar } } +``` diff --git a/tests/execution/grpc-reflection.md b/tests/execution/grpc-reflection.md new file mode 100644 index 0000000000..d054bd8399 --- /dev/null +++ b/tests/execution/grpc-reflection.md @@ -0,0 +1,57 @@ +# Grpc datasource + +```graphql @server +schema + @server(port: 8000, graphiql: true) + @upstream(httpCache: true, baseURL: "http://localhost:50051") + @link(src: "http://localhost:50051", type: Grpc) { + query: Query +} + +type Query { + news: NewsData! @grpc(method: "news.NewsService.GetAllNews") +} + +type NewsData { + news: [News]! +} + +type News { + id: Int + title: String + body: String + postImage: String +} +``` + +```yml @mock +- request: + method: POST + url: http://localhost:50051/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo + textBody: \0\0\0\0\x02:\0 + response: + status: 200 + fileBody: grpc/reflection/news-list-services.bin + +- request: + method: POST + url: http://localhost:50051/grpc.reflection.v1alpha.ServerReflection/ServerReflectionInfo + textBody: \0\0\0\0\x12\"\x10news.NewsService + response: + status: 200 + fileBody: grpc/reflection/news-service-descriptor.bin + +- request: + method: POST + url: http://localhost:50051/news.NewsService/GetAllNews + response: + status: 200 + textBody: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 +``` + +```yml @test +- method: POST + url: http://localhost:8080/graphql + body: + query: query { news {news{ id }} } +``` diff --git a/tests/execution/grpc-simple.md b/tests/execution/grpc-simple.md index f1e968fcec..c38344903e 100644 --- a/tests/execution/grpc-simple.md +++ b/tests/execution/grpc-simple.md @@ -47,7 +47,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{args.news}}") + @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int @@ -71,13 +71,12 @@ type News { - request: method: POST url: http://localhost:50051/news.NewsService/GetAllNews - body: null response: status: 200 - body: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 + textBody: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/grpc-url-from-upstream.md b/tests/execution/grpc-url-from-upstream.md index 84375c69f6..db2c8ac4af 100644 --- a/tests/execution/grpc-url-from-upstream.md +++ b/tests/execution/grpc-url-from-upstream.md @@ -46,7 +46,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}") + newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{.args.news}}") } input NewsInput { id: Int @@ -70,13 +70,12 @@ type News { - request: method: POST url: http://localhost:50051/news.NewsService/GetAllNews - body: null response: status: 200 - body: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 + textBody: \0\0\0\0t\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n#\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/https.md b/tests/execution/https.md index 582903eac2..0cd1a62a0a 100644 --- a/tests/execution/https.md +++ b/tests/execution/https.md @@ -44,7 +44,6 @@ - request: method: GET url: https://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -52,7 +51,7 @@ name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/inline-field.md b/tests/execution/inline-field.md index fec966def1..638ffabff4 100644 --- a/tests/execution/inline-field.md +++ b/tests/execution/inline-field.md @@ -26,7 +26,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -37,7 +36,7 @@ type Query { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/inline-index-list.md b/tests/execution/inline-index-list.md index 8775a60452..071555e9c2 100644 --- a/tests/execution/inline-index-list.md +++ b/tests/execution/inline-index-list.md @@ -18,7 +18,6 @@ type Query @addField(name: "username", path: ["username", "0", "name"]) { - request: method: GET url: http://jsonplaceholder.typicode.com/users - body: null response: status: 200 body: @@ -26,7 +25,7 @@ type Query @addField(name: "username", path: ["username", "0", "name"]) { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/input-type-protected-error.md b/tests/execution/input-type-protected-error.md index 76431e3d87..fdcbb21c54 100644 --- a/tests/execution/input-type-protected-error.md +++ b/tests/execution/input-type-protected-error.md @@ -16,7 +16,7 @@ type Query { type Mutation { data(input: Input): String @expr(body: "value") - newPost(post: NewPost): Post @http(baseURL: "", path: "/posts", method: POST, body: "{{args.post}}") + newPost(post: NewPost): Post @http(baseURL: "", path: "/posts", method: POST, body: "{{.args.post}}") } input Input @protected { diff --git a/tests/execution/io-cache.md b/tests/execution/io-cache.md index 2dd753222a..16f3161e15 100644 --- a/tests/execution/io-cache.md +++ b/tests/execution/io-cache.md @@ -21,7 +21,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` @@ -29,7 +29,6 @@ type Post { - request: method: GET url: http://jsonplaceholder.typicode.com/posts - body: null response: status: 200 body: @@ -53,21 +52,21 @@ type Post { userId: 2 - request: url: http://jsonplaceholder.typicode.com/users/1 - expected_hits: 1 + expectedHits: 1 response: status: 200 body: name: Leanne Graham - request: url: http://jsonplaceholder.typicode.com/users/2 - expected_hits: 1 + expectedHits: 1 response: status: 200 body: name: Ervin Howell ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/jsonplaceholder-call-post.md b/tests/execution/jsonplaceholder-call-post.md index 06ff15cc92..0b4674de28 100644 --- a/tests/execution/jsonplaceholder-call-post.md +++ b/tests/execution/jsonplaceholder-call-post.md @@ -10,7 +10,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -22,14 +22,14 @@ type Post { id: Int! userId: Int! title: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } ``` ```yml @mock - request: url: http://jsonplaceholder.typicode.com/posts - expected_hits: 1 + expectedHits: 1 response: body: - id: 1 @@ -37,14 +37,14 @@ type Post { userId: 1 - request: url: http://jsonplaceholder.typicode.com/users/1 - expected_hits: 1 + expectedHits: 1 response: body: id: 1 name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/modified-field.md b/tests/execution/modified-field.md index 1532882d71..ffca3bf021 100644 --- a/tests/execution/modified-field.md +++ b/tests/execution/modified-field.md @@ -18,7 +18,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -26,7 +25,7 @@ type Query { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/mutation-put.md b/tests/execution/mutation-put.md index 3c60a9f45f..e411bdfaf6 100644 --- a/tests/execution/mutation-put.md +++ b/tests/execution/mutation-put.md @@ -14,7 +14,7 @@ input PostInput { } type Mutation { - insertPost(input: PostInput!): Post @http(body: "{{args.input}}", method: "PUT", path: "/posts/{{args.input.id}}") + insertPost(input: PostInput!): Post @http(body: "{{.args.input}}", method: "PUT", path: "/posts/{{.args.input.id}}") } type Post { @@ -38,14 +38,14 @@ type User { - request: method: PUT url: http://jsonplaceholder.typicode.com/posts/100 - body: '{"body":"abc","id":100,"title":"bar","userId":1}' + body: {"body": "abc", "id": 100, "title": "bar", "userId": 1} response: status: 200 body: body: abc ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/mutation.md b/tests/execution/mutation.md index 0f43edda11..8f0c4399a1 100644 --- a/tests/execution/mutation.md +++ b/tests/execution/mutation.md @@ -13,7 +13,7 @@ input PostInput { } type Mutation { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") } type Post { @@ -37,7 +37,7 @@ type User { - request: method: POST url: http://jsonplaceholder.typicode.com/posts - body: '{"body":"post-body","title":"post-title","userId":1}' + body: {"body": "post-body", "title": "post-title", "userId": 1} response: status: 200 body: @@ -46,7 +46,7 @@ type User { userId: 1 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/n-plus-one-list.md b/tests/execution/n-plus-one-list.md index 2833005547..b17ae0237f 100644 --- a/tests/execution/n-plus-one-list.md +++ b/tests/execution/n-plus-one-list.md @@ -13,13 +13,13 @@ type Query { type Foo { id: Int! name: String! - bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}], batchKey: ["fooId"]) + bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}], batchKey: ["fooId"]) } type Bar { id: Int! fooId: Int! - foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}], batchKey: ["id"]) + foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}], batchKey: ["id"]) } ``` @@ -27,7 +27,6 @@ type Bar { - request: method: GET url: http://example.com/bars - body: null response: status: 200 body: @@ -42,7 +41,6 @@ type Bar { - request: method: GET url: http://example.com/foos?id=1&id=2 - body: null response: status: 200 body: @@ -52,7 +50,7 @@ type Bar { name: foo2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/n-plus-one.md b/tests/execution/n-plus-one.md index 52c948a95f..e6649fa0af 100644 --- a/tests/execution/n-plus-one.md +++ b/tests/execution/n-plus-one.md @@ -13,13 +13,13 @@ type Query { type Foo { id: Int! name: String! - bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}], batchKey: ["fooId"]) + bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}], batchKey: ["fooId"]) } type Bar { id: Int! fooId: Int! - foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}], batchKey: ["id"]) + foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}], batchKey: ["id"]) } ``` @@ -27,7 +27,6 @@ type Bar { - request: method: GET url: http://example.com/foos - body: null response: status: 200 body: @@ -38,7 +37,6 @@ type Bar { - request: method: GET url: http://example.com/bars?fooId=1&fooId=2 - body: null response: status: 200 body: @@ -48,7 +46,7 @@ type Bar { id: 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/nested-objects.md b/tests/execution/nested-objects.md index fc6888ab8c..20c6357125 100644 --- a/tests/execution/nested-objects.md +++ b/tests/execution/nested-objects.md @@ -28,7 +28,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -39,7 +38,7 @@ type Query { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/nesting-level3.md b/tests/execution/nesting-level3.md index 5774f34b51..393662e6f0 100644 --- a/tests/execution/nesting-level3.md +++ b/tests/execution/nesting-level3.md @@ -19,7 +19,7 @@ type User { email: String! phone: String website: String - todos: [Todo] @http(path: "/users/{{value.id}}/todos") + todos: [Todo] @http(path: "/users/{{.value.id}}/todos") } type Post { @@ -27,7 +27,7 @@ type Post { title: String userId: Int! body: String - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` @@ -35,7 +35,6 @@ type Post { - request: method: GET url: http://jsonplaceholder.typicode.com/posts/1 - body: null response: status: 200 body: @@ -43,7 +42,6 @@ type Post { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -52,7 +50,6 @@ type Post { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1/todos - body: null response: status: 200 body: @@ -64,7 +61,7 @@ type Post { - completed: false ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/nullable-arg-query.md b/tests/execution/nullable-arg-query.md index 9a6fd15656..b0dce76c45 100644 --- a/tests/execution/nullable-arg-query.md +++ b/tests/execution/nullable-arg-query.md @@ -7,7 +7,7 @@ schema { type Query { users(id: ID): [User] - @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") } type User { @@ -20,7 +20,6 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users - body: null response: status: 200 body: @@ -37,14 +36,13 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users?id=1 - body: null response: status: 200 body: - id: 1 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/omit-index-list.md b/tests/execution/omit-index-list.md index 8775a60452..071555e9c2 100644 --- a/tests/execution/omit-index-list.md +++ b/tests/execution/omit-index-list.md @@ -18,7 +18,6 @@ type Query @addField(name: "username", path: ["username", "0", "name"]) { - request: method: GET url: http://jsonplaceholder.typicode.com/users - body: null response: status: 200 body: @@ -26,7 +25,7 @@ type Query @addField(name: "username", path: ["username", "0", "name"]) { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/omit-resolved-by-parent.md b/tests/execution/omit-resolved-by-parent.md index 4643035118..31c225be45 100644 --- a/tests/execution/omit-resolved-by-parent.md +++ b/tests/execution/omit-resolved-by-parent.md @@ -22,7 +22,6 @@ type User @addField(name: "address", path: ["address", "street"]) { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -32,7 +31,7 @@ type User @addField(name: "address", path: ["address", "street"]) { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/recursive-type-json.md b/tests/execution/recursive-type-json.md index 8e590dd64e..56848de283 100644 --- a/tests/execution/recursive-type-json.md +++ b/tests/execution/recursive-type-json.md @@ -53,7 +53,6 @@ - request: method: GET url: https://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -62,7 +61,6 @@ - request: method: GET url: https://jsonplaceholder.typicode.com/friends/1 - body: null response: status: 200 body: @@ -70,7 +68,7 @@ name: User2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/recursive-types.md b/tests/execution/recursive-types.md index c1f7bcb461..ed21992989 100644 --- a/tests/execution/recursive-types.md +++ b/tests/execution/recursive-types.md @@ -20,7 +20,6 @@ type Query { - request: method: GET url: https://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -29,7 +28,6 @@ type Query { - request: method: GET url: https://jsonplaceholder.typicode.com/friends/1 - body: null response: status: 200 body: @@ -37,7 +35,7 @@ type Query { name: User2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/ref-other-nested.md b/tests/execution/ref-other-nested.md index 540ffa2b83..7b104a3e3b 100644 --- a/tests/execution/ref-other-nested.md +++ b/tests/execution/ref-other-nested.md @@ -66,8 +66,7 @@ - request: method: GET url: https://jsonplaceholder.typicode.com/users/1 - body: null - expected_hits: 1 + expectedHits: 1 response: status: 200 body: @@ -75,7 +74,7 @@ name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/ref-other.md b/tests/execution/ref-other.md index bd8c5f65d6..c38521b510 100644 --- a/tests/execution/ref-other.md +++ b/tests/execution/ref-other.md @@ -23,7 +23,6 @@ type Query { - request: method: GET url: https://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -31,7 +30,7 @@ type Query { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/rename-field.md b/tests/execution/rename-field.md index a94d14e77a..7d9aa53414 100644 --- a/tests/execution/rename-field.md +++ b/tests/execution/rename-field.md @@ -18,7 +18,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -27,7 +26,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/2 - body: null response: status: 200 body: @@ -35,7 +33,7 @@ type Query { name: Ervin Howell ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/request-to-upstream-batching.md b/tests/execution/request-to-upstream-batching.md index 1523aef674..eb97ccce75 100644 --- a/tests/execution/request-to-upstream-batching.md +++ b/tests/execution/request-to-upstream-batching.md @@ -31,7 +31,7 @@ "query": [ { "key": "id", - "value": "{{args.id}}" + "value": "{{.args.id}}" } ], "baseURL": "http://jsonplaceholder.typicode.com", @@ -65,7 +65,6 @@ url: http://jsonplaceholder.typicode.com/users?id=1&id=2 headers: test: test - body: null response: status: 200 body: @@ -75,7 +74,7 @@ name: bar ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/resolve-with-headers.md b/tests/execution/resolve-with-headers.md index 71e32c0f41..d1ab78cb3f 100644 --- a/tests/execution/resolve-with-headers.md +++ b/tests/execution/resolve-with-headers.md @@ -13,7 +13,7 @@ type Post { } type Query { - post1: Post @http(path: "/posts/{{headers.authorization}}", baseURL: "http://jsonplaceholder.typicode.com") + post1: Post @http(path: "/posts/{{.headers.authorization}}", baseURL: "http://jsonplaceholder.typicode.com") } ``` @@ -32,7 +32,7 @@ type Query { title: post title ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql headers: diff --git a/tests/execution/resolve-with-vars.md b/tests/execution/resolve-with-vars.md index 4839bbe483..2303654204 100644 --- a/tests/execution/resolve-with-vars.md +++ b/tests/execution/resolve-with-vars.md @@ -12,7 +12,7 @@ type User { type Query { user: [User] - @http(path: "/users", query: [{key: "id", value: "{{vars.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: [{key: "id", value: "{{.vars.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") } ``` @@ -20,7 +20,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users?id=1 - body: null response: status: 200 body: @@ -28,7 +27,7 @@ type Query { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/resolved-by-parent.md b/tests/execution/resolved-by-parent.md index 4643035118..31c225be45 100644 --- a/tests/execution/resolved-by-parent.md +++ b/tests/execution/resolved-by-parent.md @@ -22,7 +22,6 @@ type User @addField(name: "address", path: ["address", "street"]) { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -32,7 +31,7 @@ type User @addField(name: "address", path: ["address", "street"]) { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/rest-api-error.md b/tests/execution/rest-api-error.md index 478aae1b1d..a498049199 100644 --- a/tests/execution/rest-api-error.md +++ b/tests/execution/rest-api-error.md @@ -18,7 +18,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -31,13 +31,12 @@ type User { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: {} ``` -```yml @assert +```yml @test - method: GET url: http://localhost:8080/api/user/1 ``` diff --git a/tests/execution/rest-api-post.md b/tests/execution/rest-api-post.md index 60bdd4dc62..3a154e5cb2 100644 --- a/tests/execution/rest-api-post.md +++ b/tests/execution/rest-api-post.md @@ -18,7 +18,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -33,7 +33,6 @@ type User { url: http://jsonplaceholder.typicode.com/users/1 headers: test: test - body: null response: status: 200 body: @@ -41,7 +40,7 @@ type User { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/api/user/1 ``` diff --git a/tests/execution/rest-api.md b/tests/execution/rest-api.md index 75e3a4d9f0..08301d8364 100644 --- a/tests/execution/rest-api.md +++ b/tests/execution/rest-api.md @@ -18,7 +18,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -33,7 +33,6 @@ type User { url: http://jsonplaceholder.typicode.com/users/1 headers: test: test - body: null response: status: 200 body: @@ -41,7 +40,7 @@ type User { name: foo ``` -```yml @assert +```yml @test - method: GET url: http://localhost:8080/api/user/1 ``` diff --git a/tests/execution/showcase.md b/tests/execution/showcase.md index e26f4af3b8..44f2f48546 100644 --- a/tests/execution/showcase.md +++ b/tests/execution/showcase.md @@ -21,7 +21,6 @@ type Query { url: http://jsonplaceholder.typicode.com/users/1 headers: test: test - body: null response: status: 200 body: @@ -30,8 +29,7 @@ type Query { - request: method: GET url: http://example.com/simple.graphql - body: null - expected_hits: 2 + expectedHits: 2 response: status: 200 textBody: |2- @@ -41,13 +39,12 @@ type Query { - request: method: GET url: http://example.com/invalid.graphql - body: null response: status: 200 body: dsjfsjdfjdsfjkdskjfjkds ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/showcase/graphql?config=http%3A%2F%2Fexample.com%2Fsimple.graphql body: diff --git a/tests/execution/simple-graphql.md b/tests/execution/simple-graphql.md index 0854639c29..250dbf7a82 100644 --- a/tests/execution/simple-graphql.md +++ b/tests/execution/simple-graphql.md @@ -21,7 +21,6 @@ type Query { url: http://jsonplaceholder.typicode.com/users/1 headers: test: test - body: null response: status: 200 body: @@ -29,7 +28,7 @@ type Query { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/simple-query.md b/tests/execution/simple-query.md index db82cc3913..e803311ff7 100644 --- a/tests/execution/simple-query.md +++ b/tests/execution/simple-query.md @@ -43,7 +43,6 @@ - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -51,7 +50,7 @@ name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/test-batching-group-by.md b/tests/execution/test-batching-group-by.md index 66703f204a..64deab3b2a 100644 --- a/tests/execution/test-batching-group-by.md +++ b/tests/execution/test-batching-group-by.md @@ -13,7 +13,7 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } diff --git a/tests/execution/test-call-operator-errors.md b/tests/execution/test-call-operator-errors.md index dbcdd68867..bce233cdb6 100644 --- a/tests/execution/test-call-operator-errors.md +++ b/tests/execution/test-call-operator-errors.md @@ -12,9 +12,9 @@ schema @server @upstream(baseURL: "http://localhost:3000") { type Query { posts: [Post] @http(path: "/posts") userWithoutResolver(id: Int!): User - user(id: Int!): User @http(path: "/users/{{args.id}}") - userWithGraphQLResolver(id: Int!): User @graphQL(name: "user", args: [{key: "id", value: "{{args.id}}"}]) - userWithGraphQLHeaders(id: Int!): User @graphQL(name: "user", headers: [{key: "id", value: "{{args.id}}"}]) + user(id: Int!): User @http(path: "/users/{{.args.id}}") + userWithGraphQLResolver(id: Int!): User @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + userWithGraphQLHeaders(id: Int!): User @graphQL(name: "user", headers: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -23,8 +23,8 @@ type User { type Post { userId: Int! - withoutResolver: User @call(steps: [{query: "userWithoutResolver", args: {id: "{{value.userId}}"}}]) - withoutOperator: User @call(steps: [{args: {id: "{{value.userId}}"}}]) + withoutResolver: User @call(steps: [{query: "userWithoutResolver", args: {id: "{{.value.userId}}"}}]) + withoutOperator: User @call(steps: [{args: {id: "{{.value.userId}}"}}]) urlMismatchHttp: User @call(steps: [{query: "user"}]) argumentMismatchGraphQL: User @call(steps: [{query: "userWithGraphQLResolver"}]) headersMismatchGraphQL: User @call(steps: [{query: "userWithGraphQLResolver"}]) diff --git a/tests/execution/test-custom-types.md b/tests/execution/test-custom-types.md index 70fce38d65..b1af08f697 100644 --- a/tests/execution/test-custom-types.md +++ b/tests/execution/test-custom-types.md @@ -17,7 +17,7 @@ input PostInput { } type Mut { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") } type Post { diff --git a/tests/execution/test-dbl-usage-many.md b/tests/execution/test-dbl-usage-many.md index 00a3de447a..febc4cddbc 100644 --- a/tests/execution/test-dbl-usage-many.md +++ b/tests/execution/test-dbl-usage-many.md @@ -20,7 +20,7 @@ input Post { } type Query { - user(input: User!): User @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") - post(input: Post!): Post @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") + user(input: User!): User @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") + post(input: Post!): Post @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-dbl-usage.md b/tests/execution/test-dbl-usage.md index 906910d463..44757aa281 100644 --- a/tests/execution/test-dbl-usage.md +++ b/tests/execution/test-dbl-usage.md @@ -15,6 +15,6 @@ type User { } type Query { - user(input: User!): User @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") + user(input: User!): User @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-directives-undef-null-fields.md b/tests/execution/test-directives-undef-null-fields.md index 2caeff85a7..b4af313819 100644 --- a/tests/execution/test-directives-undef-null-fields.md +++ b/tests/execution/test-directives-undef-null-fields.md @@ -21,37 +21,37 @@ type User { type Query { userAccessHeadersVars(id: ID!): User - @http(path: "/user/{{args.id}}/{{headers.garbage}}/{{vars.garbage}}", baseURL: "http://localhost:8080") - userListArg(id: [ID]): User @http(path: "/user/{{args.id}}", baseURL: "http://localhost:8080") - userNullableArg(id: ID): User @http(path: "/user/{{args.id}}", baseURL: "http://localhost:8080") - userUndefinedArg(id: ID): User @http(path: "/user/{{args.uid}}", baseURL: "http://localhost:8080") + @http(path: "/user/{{.args.id}}/{{.headers.garbage}}/{{.vars.garbage}}", baseURL: "http://localhost:8080") + userListArg(id: [ID]): User @http(path: "/user/{{.args.id}}", baseURL: "http://localhost:8080") + userNullableArg(id: ID): User @http(path: "/user/{{.args.id}}", baseURL: "http://localhost:8080") + userUndefinedArg(id: ID): User @http(path: "/user/{{.args.uid}}", baseURL: "http://localhost:8080") } type Post { id: Int! userId: Int - user: User @http(path: "/users/{{value.id}}", baseURL: "http://localhost:8080") - nonNullableUser: User! @http(path: "/users/{{value.id}}", baseURL: "http://localhost:8080") - userArg: User @http(path: "/users/{{args.id}}", baseURL: "http://localhost:8080") - userInvalidDirective: User @http(path: "/users/{{Vale.userId}}", baseURL: "http://localhost:8080") - userNonScalar: User @http(path: "/users/{{value.nonNullableUser}}", baseURL: "http://localhost:8080") - userNullable: User @http(path: "/users/{{value.user.id}}", baseURL: "http://localhost:8080") + user: User @http(path: "/users/{{.value.id}}", baseURL: "http://localhost:8080") + nonNullableUser: User! @http(path: "/users/{{.value.id}}", baseURL: "http://localhost:8080") + userArg: User @http(path: "/users/{{.args.id}}", baseURL: "http://localhost:8080") + userInvalidDirective: User @http(path: "/users/{{.Vale.userId}}", baseURL: "http://localhost:8080") + userNonScalar: User @http(path: "/users/{{.value.nonNullableUser}}", baseURL: "http://localhost:8080") + userNullable: User @http(path: "/users/{{.value.user.id}}", baseURL: "http://localhost:8080") nestedUserNullable: User - @http(path: "/users/{{value.nonNullableUser.nestedUser.id}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nestedUser.id}}", baseURL: "http://localhost:8080") nestedNonScalar: User - @http(path: "/users/{{value.nonNullableUser.nonNullableNestedUser}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nonNullableNestedUser}}", baseURL: "http://localhost:8080") nestedUndefinedValue: User - @http(path: "/users/{{value.nonNullableUser.nonNullableNestedUser.userId}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nonNullableNestedUser.userId}}", baseURL: "http://localhost:8080") nestedNullable: User - @http(path: "/users/{{value.nonNullableUser.nonNullableNestedUser.id}}", baseURL: "http://localhost:8080") - userNullValue: User @http(path: "/users/{{value.userId}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nonNullableNestedUser.id}}", baseURL: "http://localhost:8080") + userNullValue: User @http(path: "/users/{{.value.userId}}", baseURL: "http://localhost:8080") # nullable values are allowed in queries userNullValueQuery: User - @http(path: "/users", query: [{key: "id", value: "{{value.id}}"}], baseURL: "http://localhost:8080") - userUndefinedValue: User @http(path: "/users/{{value.userid}}", baseURL: "http://localhost:8080") + @http(path: "/users", query: [{key: "id", value: "{{.value.id}}"}], baseURL: "http://localhost:8080") + userUndefinedValue: User @http(path: "/users/{{.value.userid}}", baseURL: "http://localhost:8080") # but not undefined values userUndefinedValueQuery: User - @http(path: "/users", query: [{key: "id", value: "{{value.userid}}"}], baseURL: "http://localhost:8080") - userVars: User @http(path: "/users/{{vars.a}}", baseURL: "http://localhost:8080") + @http(path: "/users", query: [{key: "id", value: "{{.value.userid}}"}], baseURL: "http://localhost:8080") + userVars: User @http(path: "/users/{{.vars.a}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-duplicated-link.md b/tests/execution/test-duplicated-link.md index c3fbb2277c..82440af786 100644 --- a/tests/execution/test-duplicated-link.md +++ b/tests/execution/test-duplicated-link.md @@ -14,7 +14,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -31,7 +31,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` @@ -47,7 +47,7 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -64,6 +64,6 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/tests/execution/test-empty-link.md b/tests/execution/test-empty-link.md index ea99a3843b..ba78293dc3 100644 --- a/tests/execution/test-empty-link.md +++ b/tests/execution/test-empty-link.md @@ -11,7 +11,7 @@ schema @upstream(baseURL: "https://jsonplaceholder.typicode.com") @link(type: Co type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -28,6 +28,6 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/tests/execution/test-enum-default.md b/tests/execution/test-enum-default.md index e8e76d9842..37c163fc68 100644 --- a/tests/execution/test-enum-default.md +++ b/tests/execution/test-enum-default.md @@ -65,13 +65,13 @@ type NewsData { - request: method: POST url: http://localhost:50051/news.NewsService/GetAllNews - body: '\0\0\0\0\0' + textBody: \0\0\0\0\0 response: status: 200 - body: '\0\0\0\0s\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n%\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2(\x01\n%\x08\x03\x12\x06Note 3\x1a\tContent 3\"\x0cPost image 3(\x02' + textBody: '\0\0\0\0s\n#\x08\x01\x12\x06Note 1\x1a\tContent 1\"\x0cPost image 1\n%\x08\x02\x12\x06Note 2\x1a\tContent 2\"\x0cPost image 2(\x01\n%\x08\x03\x12\x06Note 3\x1a\tContent 3\"\x0cPost image 3(\x02' ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/test-enum.md b/tests/execution/test-enum.md index fa2fe74588..c47c8d3c73 100644 --- a/tests/execution/test-enum.md +++ b/tests/execution/test-enum.md @@ -15,11 +15,11 @@ enum Foo { } type Query { - foo(val: String!): Foo @expr(body: "{{args.val}}") + foo(val: String!): Foo @expr(body: "{{.args.val}}") } ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/test-expr-with-mustache.md b/tests/execution/test-expr-with-mustache.md index ec5837c05d..289e63d8cf 100644 --- a/tests/execution/test-expr-with-mustache.md +++ b/tests/execution/test-expr-with-mustache.md @@ -15,7 +15,7 @@ type A { c: String @modify(omit: true) g: Boolean @modify(omit: true) d: D @modify(omit: true) - bc: BC @expr(body: {b: "{{value.b}}", c: "{{value.c}}", d: "{{value.d.e}}", f: "{{value.d}}", g: "{{value.g}}"}) + bc: BC @expr(body: {b: "{{.value.b}}", c: "{{.value.c}}", d: "{{.value.d.e}}", f: "{{.value.d}}", g: "{{.value.g}}"}) } type BC { @@ -30,7 +30,7 @@ type D { } ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8000/graphql body: diff --git a/tests/execution/test-field-already-implemented-from-Interface.md b/tests/execution/test-field-already-implemented-from-Interface.md index a72e9869ad..af7558c25a 100644 --- a/tests/execution/test-field-already-implemented-from-Interface.md +++ b/tests/execution/test-field-already-implemented-from-Interface.md @@ -19,6 +19,6 @@ type User implements IUser { } type Query { - user: User @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") + user: User @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-graphqlsource-no-base-url.md b/tests/execution/test-graphqlsource-no-base-url.md index e9b3bb3203..075202869c 100644 --- a/tests/execution/test-graphqlsource-no-base-url.md +++ b/tests/execution/test-graphqlsource-no-base-url.md @@ -11,11 +11,11 @@ schema { type Post { id: Int! - user: User @graphQL(name: "user", args: [{key: "id", value: "{{value.userId}}"}]) + user: User @graphQL(name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{args.id}}") + post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-graphqlsource.md b/tests/execution/test-graphqlsource.md index 9a91667da9..575866c642 100644 --- a/tests/execution/test-graphqlsource.md +++ b/tests/execution/test-graphqlsource.md @@ -11,12 +11,12 @@ schema @server @upstream(baseURL: "http://localhost:8000/graphql") { type Post { id: Int! - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], name: "user") + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") userId: Int! } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{args.id}}") + post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-groupby-without-batching.md b/tests/execution/test-groupby-without-batching.md index ed084206a7..f1243b765a 100644 --- a/tests/execution/test-groupby-without-batching.md +++ b/tests/execution/test-groupby-without-batching.md @@ -15,6 +15,6 @@ type User { } type Query { - user(id: Int!): User @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}], batchKey: ["id"]) + user(id: Int!): User @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}], batchKey: ["id"]) } ``` diff --git a/tests/execution/test-grpc-group-by.md b/tests/execution/test-grpc-group-by.md index c35a619608..368808f3b8 100644 --- a/tests/execution/test-grpc-group-by.md +++ b/tests/execution/test-grpc-group-by.md @@ -53,7 +53,7 @@ type Query { @grpc( method: "news.NewsService.GetMultipleNews" baseURL: "http://localhost:50051" - body: "{{args.news}}" + body: "{{.args.news}}" batchKey: ["id"] ) } diff --git a/tests/execution/test-grpc-nested-data.md b/tests/execution/test-grpc-nested-data.md index cd65342add..6a601f3e14 100644 --- a/tests/execution/test-grpc-nested-data.md +++ b/tests/execution/test-grpc-nested-data.md @@ -51,7 +51,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): [News]! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{args.news}}") + @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/test-grpc.md b/tests/execution/test-grpc.md index 69da3f81a4..9394cae654 100644 --- a/tests/execution/test-grpc.md +++ b/tests/execution/test-grpc.md @@ -65,7 +65,7 @@ type NewsData { type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{args.news}}", method: "news.NewsService.GetNews") - newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") + newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") } ``` diff --git a/tests/execution/test-http-tmpl.md b/tests/execution/test-http-tmpl.md index 04186d1167..9d7fda2f98 100644 --- a/tests/execution/test-http-tmpl.md +++ b/tests/execution/test-http-tmpl.md @@ -11,7 +11,7 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) + user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } diff --git a/tests/execution/test-http-with-add-field.md b/tests/execution/test-http-with-add-field.md index 215b8fc33a..c9d6814564 100644 --- a/tests/execution/test-http-with-add-field.md +++ b/tests/execution/test-http-with-add-field.md @@ -18,7 +18,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type User { diff --git a/tests/execution/test-http-with-inline.md b/tests/execution/test-http-with-inline.md index 53c347ecd6..b66ddb1a59 100644 --- a/tests/execution/test-http-with-inline.md +++ b/tests/execution/test-http-with-inline.md @@ -10,7 +10,7 @@ schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { } type Query @addField(name: "username", path: ["post", "user", "name"]) { - post: Post @http(path: "/posts/1") @http(path: "/users/{{value.userId}}") + post: Post @http(path: "/posts/1") @http(path: "/users/{{.value.userId}}") } type Post { @@ -18,7 +18,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type User { diff --git a/tests/execution/test-http-with-mustache-expr.md b/tests/execution/test-http-with-mustache-expr.md index 4b1b45d582..e549128f7b 100644 --- a/tests/execution/test-http-with-mustache-expr.md +++ b/tests/execution/test-http-with-mustache-expr.md @@ -12,7 +12,7 @@ type Query { type A { a: Int d: D @modify(omit: true) - bc: BC @expr(body: {d: "{{value.d}}", f: "{{value.f}}"}) + bc: BC @expr(body: {d: "{{.value.d}}", f: "{{.value.f}}"}) } type BC { @@ -37,7 +37,7 @@ type D { f: true ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8000/graphql body: diff --git a/tests/execution/test-invalid-query-in-http.md b/tests/execution/test-invalid-query-in-http.md index effaf8eefa..0fc9da4e29 100644 --- a/tests/execution/test-invalid-query-in-http.md +++ b/tests/execution/test-invalid-query-in-http.md @@ -16,6 +16,6 @@ type User { type Query { user: [User] - @http(path: "/users", query: {key: "id", value: "{{vars.id}}"}, baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: {key: "id", value: "{{.vars.id}}"}, baseURL: "http://jsonplaceholder.typicode.com") } ``` diff --git a/tests/execution/test-js-request-reponse.md b/tests/execution/test-js-request-reponse.md index 0fa7cfaa55..6ed9a02701 100644 --- a/tests/execution/test-js-request-reponse.md +++ b/tests/execution/test-js-request-reponse.md @@ -42,7 +42,7 @@ type Query { body: hello world ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/test-missing-argument-on-all-resolvers.md b/tests/execution/test-missing-argument-on-all-resolvers.md index 4bda8bab29..5e4b65168c 100644 --- a/tests/execution/test-missing-argument-on-all-resolvers.md +++ b/tests/execution/test-missing-argument-on-all-resolvers.md @@ -61,12 +61,12 @@ type NewsData { } type Query { - postGraphQLArgs: Post @graphQL(name: "post", args: [{key: "id", value: "{{args.id}}"}]) - postGraphQLHeaders: Post @graphQL(name: "post", headers: [{key: "id", value: "{{args.id}}"}]) - postHttp: Post @http(path: "/posts/{{args.id}}") - newsGrpcHeaders: NewsData! @grpc(method: "news.NewsService.GetAllNews", headers: [{key: "id", value: "{{args.id}}"}]) - newsGrpcUrl: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "{{args.url}}") - newsGrpcBody: NewsData! @grpc(method: "news.NewsService.GetAllNews", body: "{{args.id}}") + postGraphQLArgs: Post @graphQL(name: "post", args: [{key: "id", value: "{{.args.id}}"}]) + postGraphQLHeaders: Post @graphQL(name: "post", headers: [{key: "id", value: "{{.args.id}}"}]) + postHttp: Post @http(path: "/posts/{{.args.id}}") + newsGrpcHeaders: NewsData! @grpc(method: "news.NewsService.GetAllNews", headers: [{key: "id", value: "{{.args.id}}"}]) + newsGrpcUrl: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "{{.args.url}}") + newsGrpcBody: NewsData! @grpc(method: "news.NewsService.GetAllNews", body: "{{.args.id}}") } type User { diff --git a/tests/execution/test-nested-link.md b/tests/execution/test-nested-link.md index 4dc775ee09..259c1b4f71 100644 --- a/tests/execution/test-nested-link.md +++ b/tests/execution/test-nested-link.md @@ -27,11 +27,11 @@ schema @server @upstream(baseURL: "http://localhost:8000/graphql") @link(src: "l type Post { id: Int! userId: Int! - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], name: "user") + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{args.id}}") + post(id: Int!): Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-nested-value.md b/tests/execution/test-nested-value.md index f49cc6b6b4..5bc1b6a4a5 100644 --- a/tests/execution/test-nested-value.md +++ b/tests/execution/test-nested-value.md @@ -11,7 +11,7 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.id}}"}]) + user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.id}}"}]) } type Query { diff --git a/tests/execution/test-null-in-array.md b/tests/execution/test-null-in-array.md new file mode 100644 index 0000000000..1ec038ebe2 --- /dev/null +++ b/tests/execution/test-null-in-array.md @@ -0,0 +1,30 @@ +# Empty Array Response + +```graphql @server +schema @server { + query: Query +} + +type Query { + hi(id: ID!): [Company] @http(baseURL: "http://localhost:3000", path: "/hi") +} +type Company { + name: String + id: ID +} +``` + +```yml @mock +- request: + method: GET + url: http://localhost:3000/hi + response: + status: 200 +``` + +```yml @test +- method: POST + url: http://localhost:8080/graphql + body: + query: "query { hi (id: 1) { name id } }" +``` diff --git a/tests/execution/test-null-in-object.md b/tests/execution/test-null-in-object.md new file mode 100644 index 0000000000..a356b1f3be --- /dev/null +++ b/tests/execution/test-null-in-object.md @@ -0,0 +1,30 @@ +# Empty Object Response + +```graphql @server +schema @server { + query: Query +} + +type Query { + hi(id: ID!): Company @http(baseURL: "http://localhost:3000", path: "/hi") +} +type Company { + name: String + id: ID +} +``` + +```yml @mock +- request: + method: GET + url: http://localhost:3000/hi + response: + status: 200 +``` + +```yml @test +- method: POST + url: http://localhost:8080/graphql + body: + query: "query { hi (id: 1) { name id } }" +``` diff --git a/tests/execution/test-params-as-body.md b/tests/execution/test-params-as-body.md index a1f8a9fb68..f9d2c346b3 100644 --- a/tests/execution/test-params-as-body.md +++ b/tests/execution/test-params-as-body.md @@ -6,7 +6,7 @@ schema @server(port: 8000, graphiql: true) @upstream(baseURL: "http://jsonplaceh } type Query { - firstUser(id: Int, name: String): User @http(method: POST, path: "/users", body: "{{args}}") + firstUser(id: Int, name: String): User @http(method: POST, path: "/users", body: "{{.args}}") } type User { @@ -19,7 +19,7 @@ type User { - request: method: POST url: http://jsonplaceholder.typicode.com/users - body: '{"id":1,"name":"foo"}' + body: {"id": 1, "name": "foo"} response: status: 200 body: @@ -27,7 +27,7 @@ type User { name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/test-scalars.md b/tests/execution/test-scalars.md index b33a30de37..ec54cd9ca5 100644 --- a/tests/execution/test-scalars.md +++ b/tests/execution/test-scalars.md @@ -11,14 +11,14 @@ schema @server(port: 8000, graphiql: true, hostname: "localhost") { } type Query { - email(value: Email!): Email! @expr(body: "{{args.value}}") - phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{args.value}}") - date(value: Date!): Date! @expr(body: "{{args.value}}") - url(value: Url!): Url! @expr(body: "{{args.value}}") + email(value: Email!): Email! @expr(body: "{{.args.value}}") + phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{.args.value}}") + date(value: Date!): Date! @expr(body: "{{.args.value}}") + url(value: Url!): Url! @expr(body: "{{.args.value}}") } ``` -```yml @assert +```yml @test # Valid value tests - method: POST url: http://localhost:8000/graphql diff --git a/tests/execution/test-set-cookie-headers.md b/tests/execution/test-set-cookie-headers.md index 90d9c95aa1..bd5a1e7344 100644 --- a/tests/execution/test-set-cookie-headers.md +++ b/tests/execution/test-set-cookie-headers.md @@ -8,7 +8,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { id: Int! @@ -46,7 +46,7 @@ type User { name: bar ``` -```yaml @assert +```yaml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/test-static-value.md b/tests/execution/test-static-value.md index 7a1cf9944f..a36d245d1e 100644 --- a/tests/execution/test-static-value.md +++ b/tests/execution/test-static-value.md @@ -42,7 +42,6 @@ - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -50,7 +49,7 @@ name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/test-undefined-query.md b/tests/execution/test-undefined-query.md index 448c69b885..e94e6225d9 100644 --- a/tests/execution/test-undefined-query.md +++ b/tests/execution/test-undefined-query.md @@ -11,10 +11,10 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{value.test.id}}"}]) - nested: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.nested.test}}"}]) - innerNested: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.nested.inner.test.id}}"}]) - innerIdNested: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.nested.inner.id.test}}"}]) + user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.test.id}}"}]) + nested: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.nested.test}}"}]) + innerNested: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.nested.inner.test.id}}"}]) + innerIdNested: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.nested.inner.id.test}}"}]) } type Query { diff --git a/tests/execution/test-upstream-headers.md b/tests/execution/test-upstream-headers.md index 29caf23ea4..2c57085d70 100644 --- a/tests/execution/test-upstream-headers.md +++ b/tests/execution/test-upstream-headers.md @@ -19,7 +19,6 @@ type Post { headers: x-foo: bar x-bar: baz - body: null response: status: 200 body: @@ -33,7 +32,7 @@ type Post { userId: 2 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8000/graphql headers: diff --git a/tests/execution/upstream-batching.md b/tests/execution/upstream-batching.md index 1f938623fd..b5a782fafa 100644 --- a/tests/execution/upstream-batching.md +++ b/tests/execution/upstream-batching.md @@ -28,7 +28,7 @@ "query": [ { "key": "id", - "value": "{{args.id}}" + "value": "{{.args.id}}" } ], "baseURL": "http://jsonplaceholder.typicode.com", @@ -62,7 +62,6 @@ url: http://jsonplaceholder.typicode.com/users?id=1&id=2 headers: test: test - body: null response: status: 200 body: @@ -72,7 +71,7 @@ name: bar ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/upstream-fail-request.md b/tests/execution/upstream-fail-request.md index 8d6c82cd9a..fa3e1bc1be 100644 --- a/tests/execution/upstream-fail-request.md +++ b/tests/execution/upstream-fail-request.md @@ -19,13 +19,12 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 503 body: {} ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/with-args-url.md b/tests/execution/with-args-url.md index e22b8772d5..0ad9853fc3 100644 --- a/tests/execution/with-args-url.md +++ b/tests/execution/with-args-url.md @@ -21,7 +21,7 @@ } }, "http": { - "path": "/users/{{args.id}}", + "path": "/users/{{.args.id}}", "baseURL": "http://jsonplaceholder.typicode.com" }, "cache": null @@ -52,7 +52,6 @@ url: http://jsonplaceholder.typicode.com/users/1 headers: test: test - body: null response: status: 200 body: @@ -60,7 +59,7 @@ name: foo ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/with-args.md b/tests/execution/with-args.md index a4d6518cd4..06cd07b479 100644 --- a/tests/execution/with-args.md +++ b/tests/execution/with-args.md @@ -11,7 +11,7 @@ type User { type Query { user(id: Int!): [User] - @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") } ``` @@ -19,7 +19,6 @@ type Query { - request: method: GET url: http://jsonplaceholder.typicode.com/users?id=1 - body: null response: status: 200 body: @@ -27,7 +26,7 @@ type Query { name: Leanne Graham ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution/with-nesting.md b/tests/execution/with-nesting.md index db8cceb9d8..120d3674d5 100644 --- a/tests/execution/with-nesting.md +++ b/tests/execution/with-nesting.md @@ -16,7 +16,7 @@ type User { email: String! phone: String website: String - posts: [Post] @http(path: "/users/{{value.id}}/posts") + posts: [Post] @http(path: "/users/{{.value.id}}/posts") } type Post { @@ -31,7 +31,6 @@ type Post { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1 - body: null response: status: 200 body: @@ -42,7 +41,6 @@ type Post { - request: method: GET url: http://jsonplaceholder.typicode.com/users/1/posts - body: null response: status: 200 body: @@ -51,7 +49,7 @@ type Post { - title: title3 ``` -```yml @assert +```yml @test - method: POST url: http://localhost:8080/graphql body: diff --git a/tests/execution_spec.rs b/tests/execution_spec.rs index ef2edccd52..7d279ecf2f 100644 --- a/tests/execution_spec.rs +++ b/tests/execution_spec.rs @@ -1,1099 +1,12 @@ -extern crate core; +mod core; -mod telemetry; +use core::spec::load_and_test_execution_spec; +use std::path::Path; -use std::borrow::Cow; -use std::collections::{BTreeMap, HashMap}; -use std::path::{Path, PathBuf}; -use std::str::FromStr; -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::sync::{Arc, Once}; -use std::{fs, panic}; +fn run_execution_spec(path: &Path) -> datatest_stable::Result<()> { + let result = tokio_test::block_on(load_and_test_execution_spec(path)); -use anyhow::{anyhow, Context}; -use derive_setters::Setters; -use futures_util::future::join_all; -use hyper::body::Bytes; -use hyper::{Body, Request}; -use markdown::mdast::Node; -use markdown::ParseOptions; -use reqwest::header::{HeaderName, HeaderValue}; -use serde::{Deserialize, Serialize}; -use serde_json::Value; -use tailcall::async_graphql_hyper::{GraphQLBatchRequest, GraphQLRequest}; -use tailcall::blueprint::{self, Blueprint}; -use tailcall::cache::InMemoryCache; -use tailcall::cli::javascript; -use tailcall::cli::metrics::init_metrics; -use tailcall::config::reader::ConfigReader; -use tailcall::config::{Config, ConfigModule, Source}; -use tailcall::http::{handle_request, AppContext, Method, Response}; -use tailcall::merge_right::MergeRight; -use tailcall::print_schema::print_schema; -use tailcall::runtime::TargetRuntime; -use tailcall::valid::{Cause, ValidationError, Validator as _}; -use tailcall::{EnvIO, FileIO, HttpIO}; -use telemetry::in_memory::InMemoryTelemetry; -use telemetry::init::init_opentelemetry; -use url::Url; - -#[cfg(test)] -pub mod test { - use std::borrow::Cow; - use std::collections::HashMap; - use std::sync::Arc; - - use anyhow::anyhow; - use tailcall::cache::InMemoryCache; - use tailcall::cli::javascript; - use tailcall::runtime::TargetRuntime; - use tokio::io::{AsyncReadExt, AsyncWriteExt}; - - use crate::{blueprint, EnvIO, FileIO, MockHttpClient}; - - #[derive(Clone)] - struct TestFileIO {} - - impl TestFileIO { - fn init() -> Self { - TestFileIO {} - } - } - - #[async_trait::async_trait] - impl FileIO for TestFileIO { - async fn write<'a>(&'a self, path: &'a str, content: &'a [u8]) -> anyhow::Result<()> { - let mut file = tokio::fs::File::create(path).await?; - file.write_all(content) - .await - .map_err(|e| anyhow!("{}", e))?; - Ok(()) - } - - async fn read<'a>(&'a self, path: &'a str) -> anyhow::Result { - let mut file = tokio::fs::File::open(path).await?; - let mut buffer = Vec::new(); - file.read_to_end(&mut buffer) - .await - .map_err(|e| anyhow!("{}", e))?; - Ok(String::from_utf8(buffer)?) - } - } - - #[derive(Clone)] - struct TestEnvIO { - vars: HashMap, - } - - impl EnvIO for TestEnvIO { - fn get(&self, key: &str) -> Option> { - self.vars.get(key).map(Cow::from) - } - } - - impl TestEnvIO { - pub fn init(vars: Option>) -> Self { - Self { vars: vars.unwrap_or_default() } - } - } - - pub fn create_runtime( - http_client: Arc, - env: Option>, - script: Option, - ) -> TargetRuntime { - let http = if let Some(script) = script.clone() { - javascript::init_http(http_client.clone(), script) - } else { - http_client.clone() - }; - - let http2 = if let Some(script) = script { - javascript::init_http(http_client.clone(), script) - } else { - http_client.clone() - }; - - let file = TestFileIO::init(); - let env = TestEnvIO::init(env); - - TargetRuntime { - http, - http2_only: http2, - env: Arc::new(env), - file: Arc::new(file), - cache: Arc::new(InMemoryCache::new()), - extensions: Arc::new(vec![]), - } - } -} - -static INIT: Once = Once::new(); - -#[derive(Serialize, Deserialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -enum Annotation { - Skip, - Only, -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] -struct APIRequest { - #[serde(default)] - method: Method, - url: Url, - #[serde(default)] - headers: BTreeMap, - #[serde(default)] - body: serde_json::Value, - #[serde(default)] - assert_traces: bool, - #[serde(default)] - assert_metrics: bool, -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -struct APIResponse { - #[serde(default = "default_status")] - status: u16, - #[serde(default)] - headers: BTreeMap, - #[serde(default)] - body: serde_json::Value, - #[serde(default)] - #[serde(skip_serializing_if = "Option::is_none")] - text_body: Option, -} - -pub struct Env { - env: HashMap, -} - -impl EnvIO for Env { - fn get(&self, key: &str) -> Option> { - self.env.get(key).map(Cow::from) - } -} - -impl Env { - pub fn init(map: HashMap) -> Self { - Self { env: map } - } -} - -fn default_status() -> u16 { - 200 -} - -fn default_expected_hits() -> usize { - 1 -} - -#[derive(Serialize, Deserialize, Clone, Debug, Eq, PartialEq)] -struct UpstreamRequest(APIRequest); - -#[derive(Serialize, Deserialize, Clone, Debug)] -struct UpstreamResponse(APIResponse); - -#[derive(Serialize, Deserialize, Clone, Debug)] -#[serde(rename_all = "camelCase")] -enum ConfigSource { - File(String), - Inline(Config), -} - -#[derive(Serialize, Deserialize, Clone, Debug)] -struct Mock { - request: UpstreamRequest, - response: UpstreamResponse, - #[serde(default = "default_expected_hits")] - expected_hits: usize, -} - -#[derive(Debug, Default, Deserialize, Serialize, PartialEq)] -struct SDLError { - message: String, - trace: Vec, - description: Option, -} - -impl<'a> From> for SDLError { - fn from(value: Cause<&'a str>) -> Self { - SDLError { - message: value.message.to_string(), - trace: value.trace.iter().map(|e| e.to_string()).collect(), - description: None, - } - } -} - -impl From> for SDLError { - fn from(value: Cause) -> Self { - SDLError { - message: value.message.to_string(), - trace: value.trace.iter().map(|e| e.to_string()).collect(), - description: value.description, - } - } -} - -#[derive(Clone, Setters)] -struct ExecutionSpec { - path: PathBuf, - name: String, - safe_name: String, - - server: Vec<(Source, String)>, - mock: Option>, - env: Option>, - assert: Option>, - files: BTreeMap, - - // Annotations for the runner - runner: Option, - - check_identity: bool, - sdl_error: bool, -} - -impl ExecutionSpec { - async fn cargo_read(path: &str) -> anyhow::Result> { - let dir_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join(path) - .canonicalize()?; - let mut files = Vec::new(); - - for entry in fs::read_dir(&dir_path)? { - let path = entry?.path(); - if path.is_dir() { - continue; - } - if path.is_file() { - if let Some(ext) = path.extension().and_then(|x| x.to_str()) { - if ext == "md" { - let contents = fs::read_to_string(&path)?; - let spec: ExecutionSpec = Self::from_source(&path, contents) - .await - .map_err(|err| err.context(path.to_str().unwrap().to_string()))?; - - files.push(spec.path(path)); - } - } - } - } - - assert!( - !files.is_empty(), - "No files found in {}", - dir_path.to_str().unwrap_or_default() - ); - Ok(files) - } - - fn filter_specs(specs: Vec) -> Vec { - let mut only_specs = Vec::new(); - let mut filtered_specs = Vec::new(); - - for spec in specs { - match spec.runner { - Some(Annotation::Skip) => { - tracing::warn!("{} {} ... skipped", spec.name, spec.path.display()) - } - Some(Annotation::Only) => only_specs.push(spec), - None => filtered_specs.push(spec), - } - } - - // If any spec has the Only annotation, use those; otherwise, use the filtered - // list. - if !only_specs.is_empty() { - only_specs - } else { - filtered_specs - } - } - - async fn from_source(path: &Path, contents: String) -> anyhow::Result { - INIT.call_once(|| {}); - - let ast = markdown::to_mdast(&contents, &ParseOptions::default()).unwrap(); - let mut children = ast - .children() - .unwrap_or_else(|| panic!("Failed to parse {:?}: empty file unexpected", path)) - .iter() - .peekable(); - - let mut name: Option = None; - let mut server: Vec<(Source, String)> = Vec::with_capacity(2); - let mut mock: Option> = None; - let mut env: Option> = None; - let mut files: BTreeMap = BTreeMap::new(); - let mut assert: Option> = None; - let mut runner: Option = None; - let mut check_identity = false; - let mut sdl_error = false; - - while let Some(node) = children.next() { - match node { - Node::Heading(heading) => { - if heading.depth == 1 { - // Parse test name - if name.is_none() { - if let Some(Node::Text(text)) = heading.children.first() { - name = Some(text.value.clone()); - } else { - return Err(anyhow!( - "Unexpected content of level 1 heading in {:?}: {:#?}", - path, - heading - )); - } - } else { - return Err(anyhow!( - "Unexpected double-declaration of test name in {:?}", - path - )); - } - - // Consume optional test description - if let Some(Node::Paragraph(_)) = children.peek() { - let _ = children.next(); - } - } else if heading.depth == 2 { - if let Some(Node::Text(expect)) = heading.children.first() { - let split = expect.value.splitn(2, ':').collect::>(); - match split[..] { - [a, b] => { - check_identity = - a.contains("check_identity") && b.ends_with("true"); - sdl_error = a.contains("expect_validation_error") - && b.ends_with("true"); - } - _ => { - return Err(anyhow!( - "Unexpected header annotation {:?} in {:?}", - expect.value, - path, - )) - } - } - } - } else if heading.depth == 5 { - // Parse annotation - if runner.is_none() { - if let Some(Node::Text(text)) = heading.children.first() { - runner = Some(match text.value.as_str() { - "skip" => Annotation::Skip, - "only" => Annotation::Only, - _ => { - return Err(anyhow!( - "Unexpected runner annotation {:?} in {:?}", - text.value, - path, - )); - } - }); - } else { - return Err(anyhow!( - "Unexpected content of level 5 heading in {:?}: {:#?}", - path, - heading - )); - } - } else { - return Err(anyhow!( - "Unexpected double-declaration of runner annotation in {:?}", - path - )); - } - } else if heading.depth == 4 { - } else { - return Err(anyhow!( - "Unexpected level {} heading in {:?}: {:#?}", - heading.depth, - path, - heading - )); - } - } - Node::Code(code) => { - // Parse following code block - let (content, lang, meta) = { - ( - code.value.to_owned(), - code.lang.to_owned(), - code.meta.to_owned(), - ) - }; - if let Some(meta_str) = meta.as_ref().filter(|s| s.contains('@')) { - let temp_cleaned_meta = meta_str.replace('@', ""); - let name: &str = &temp_cleaned_meta; - if let Some(name) = name.strip_prefix("file:") { - if files.insert(name.to_string(), content).is_some() { - return Err(anyhow!( - "Double declaration of file {:?} in {:#?}", - name, - path - )); - } - } else { - let lang = match lang { - Some(x) => Ok(x), - None => Err(anyhow!( - "Unexpected code block with no specific language in {:?}", - path - )), - }?; - - let source = Source::from_str(&lang)?; - - match name { - "server" => { - // Server configs are only parsed if the test isn't skipped. - server.push((source, content)); - } - "mock" => { - if mock.is_none() { - mock = match source { - Source::Json => Ok(serde_json::from_str(&content)?), - Source::Yml => Ok(serde_yaml::from_str(&content)?), - _ => Err(anyhow!("Unexpected language in mock block in {:?} (only JSON and YAML are supported)", path)), - }?; - } else { - return Err(anyhow!("Unexpected number of mock blocks in {:?} (only one is allowed)", path)); - } - } - "env" => { - if env.is_none() { - env = match source { - Source::Json => Ok(serde_json::from_str(&content)?), - Source::Yml => Ok(serde_yaml::from_str(&content)?), - _ => Err(anyhow!("Unexpected language in env block in {:?} (only JSON and YAML are supported)", path)), - }?; - } else { - return Err(anyhow!("Unexpected number of env blocks in {:?} (only one is allowed)", path)); - } - } - "assert" => { - if assert.is_none() { - assert = match source { - Source::Json => Ok(serde_json::from_str(&content)?), - Source::Yml => Ok(serde_yaml::from_str(&content)?), - _ => Err(anyhow!("Unexpected language in assert block in {:?} (only JSON and YAML are supported)", path)), - }?; - } else { - return Err(anyhow!("Unexpected number of assert blocks in {:?} (only one is allowed)", path)); - } - } - _ => { - return Err(anyhow!( - "Unexpected component {:?} in {:?}: {:#?}", - name, - path, - meta - )); - } - } - } - } else { - return Err(anyhow!( - "Unexpected content of code in {:?}: {:#?}", - path, - meta - )); - } - } - Node::Definition(d) => { - if let Some(title) = &d.title { - tracing::info!("Comment found in: {:?} with title: {}", path, title); - } - } - Node::ThematicBreak(_) => { - // skip this for and put execute logic in heading.depth - // above to escape ThematicBreaks like - // `---`, `***` or `___` - } - _ => return Err(anyhow!("Unexpected node in {:?}: {:#?}", path, node)), - } - } - - if server.is_empty() { - return Err(anyhow!( - "Unexpected blocks in {:?}: You must define a GraphQL Config in an execution test.", - path, - )); - } - - let spec = ExecutionSpec { - path: path.to_owned(), - name: name.unwrap_or_else(|| path.file_name().unwrap().to_str().unwrap().to_string()), - safe_name: path.file_name().unwrap().to_str().unwrap().to_string(), - - server, - mock, - env, - assert, - files, - - runner, - check_identity, - sdl_error, - }; - - anyhow::Ok(spec) - } - - async fn app_context( - &self, - config: &ConfigModule, - env: HashMap, - http_client: Arc, - ) -> Arc { - let blueprint = Blueprint::try_from(config).unwrap(); - let http = if let Some(script) = blueprint.server.script.clone() { - javascript::init_http(http_client, script) - } else { - http_client - }; - - let http2_only = http.clone(); - - let runtime = TargetRuntime { - http, - http2_only, - file: Arc::new(MockFileSystem::new(self.clone())), - env: Arc::new(Env::init(env)), - cache: Arc::new(InMemoryCache::new()), - extensions: Arc::new(vec![]), - }; - - // TODO: move inside tailcall core if possible - init_metrics(&runtime).unwrap(); - - let endpoints = config - .extensions - .endpoint_set - .clone() - .into_checked(&blueprint, runtime.clone()) - .await - .unwrap(); - - Arc::new(AppContext::new(blueprint, runtime, endpoints)) - } -} - -#[derive(Clone, Debug)] -struct ExecutionMock { - mock: Mock, - actual_hits: Arc, -} - -impl ExecutionMock { - fn assert_hits(&self, path: impl AsRef) { - let url = &self.mock.request.0.url; - let is_batch_graphql = url.path().starts_with("/graphql") - && self - .mock - .request - .0 - .body - .as_str() - .map(|s| s.contains(',')) - .unwrap_or_default(); - - // do not assert hits for mocks for batch graphql requests - // since that requires having 2 mocks with different order of queries in - // single request and only one of that mocks is actually called during run. - // for other protocols there is no issues right now, because: - // - for http the keys are always sorted https://github.com/tailcallhq/tailcall/blob/51d8b7aff838f0f4c362d4ee9e39492ae1f51fdb/src/http/data_loader.rs#L71 - // - for grpc body is not used for matching the mock and grpc will use grouping based on id https://github.com/tailcallhq/tailcall/blob/733b641c41f17c60b15b36b025b4db99d0f9cdcd/tests/execution_spec.rs#L769 - if is_batch_graphql { - return; - } - - let expected_hits = self.mock.expected_hits; - let actual_hits = self.actual_hits.load(Ordering::Relaxed); - - assert_eq!( - expected_hits, - actual_hits, - "expected mock for {url} to be hit exactly {expected_hits} times, but it was hit {actual_hits} times for file: {:?}", - path.as_ref() - ); - } + Ok(result?) } -#[derive(Clone, Debug)] -pub struct MockHttpClient { - mocks: Vec, - spec_path: String, -} - -impl MockHttpClient { - fn new(spec: &ExecutionSpec) -> Self { - let mocks = spec - .mock - .as_ref() - .map(|mocks| { - mocks - .iter() - .map(|mock| ExecutionMock { - mock: mock.clone(), - actual_hits: Arc::new(AtomicUsize::default()), - }) - .collect() - }) - .unwrap_or_default(); - - let spec_path = spec - .path - .strip_prefix(std::env::current_dir().unwrap()) - .unwrap_or(&spec.path) - .to_string_lossy() - .into_owned(); - - MockHttpClient { mocks, spec_path } - } - - fn assert_hits(&self, path: impl AsRef) { - for mock in &self.mocks { - mock.assert_hits(path.as_ref()); - } - } -} - -fn string_to_bytes(input: &str) -> Vec { - let mut bytes = Vec::new(); - let mut chars = input.chars().peekable(); - - while let Some(c) = chars.next() { - match c { - '\\' => match chars.next() { - Some('0') => bytes.push(0), - Some('n') => bytes.push(b'\n'), - Some('t') => bytes.push(b'\t'), - Some('r') => bytes.push(b'\r'), - Some('\\') => bytes.push(b'\\'), - Some('\"') => bytes.push(b'\"'), - Some('x') => { - let mut hex = chars.next().unwrap().to_string(); - hex.push(chars.next().unwrap()); - let byte = u8::from_str_radix(&hex, 16).unwrap(); - bytes.push(byte); - } - _ => panic!("Unsupported escape sequence"), - }, - _ => bytes.push(c as u8), - } - } - - bytes -} - -#[async_trait::async_trait] -impl HttpIO for MockHttpClient { - async fn execute(&self, req: reqwest::Request) -> anyhow::Result> { - // Determine if the request is a GRPC request based on PORT - let is_grpc = req.url().as_str().contains("50051"); - - // Try to find a matching mock for the incoming request. - let execution_mock = self - .mocks - .iter() - .find(|mock| { - let mock_req = &mock.mock.request; - let method_match = req.method() == mock_req.0.method.clone().to_hyper(); - let url_match = req.url().as_str() == mock_req.0.url.clone().as_str(); - let req_body = match req.body() { - Some(body) => { - if let Some(bytes) = body.as_bytes() { - if let Ok(body_str) = std::str::from_utf8(bytes) { - Value::from(body_str) - } else { - Value::Null - } - } else { - Value::Null - } - } - None => Value::Null, - }; - let body_match = req_body == mock_req.0.body; - let headers_match = req - .headers() - .iter() - .filter(|(key, _)| *key != "content-type") - .all(|(key, value)| { - let header_name = key.to_string(); - - let header_value = value.to_str().unwrap(); - let mock_header_value = "".to_string(); - let mock_header_value = mock_req - .0 - .headers - .get(&header_name) - .unwrap_or(&mock_header_value); - header_value == mock_header_value - }); - method_match && url_match && headers_match && (body_match || is_grpc) - }) - .ok_or(anyhow!( - "No mock found for request: {:?} {} in {}", - req.method(), - req.url(), - self.spec_path - ))?; - - execution_mock.actual_hits.fetch_add(1, Ordering::Relaxed); - - // Clone the response from the mock to avoid borrowing issues. - let mock_response = execution_mock.mock.response.clone(); - - // Build the response with the status code from the mock. - let status_code = reqwest::StatusCode::from_u16(mock_response.0.status)?; - - if status_code.is_client_error() || status_code.is_server_error() { - return Err(anyhow::format_err!("Status code error")); - } - - let mut response = Response { status: status_code, ..Default::default() }; - - // Insert headers from the mock into the response. - for (key, value) in mock_response.0.headers { - let header_name = HeaderName::from_str(&key)?; - let header_value = HeaderValue::from_str(&value)?; - response.headers.insert(header_name, header_value); - } - - // Special Handling for GRPC - if let Some(body) = mock_response.0.text_body { - // Return plaintext body if specified - let body = string_to_bytes(&body); - response.body = Bytes::from_iter(body); - } else if is_grpc { - // Special Handling for GRPC - let body = string_to_bytes(mock_response.0.body.as_str().unwrap_or_default()); - response.body = Bytes::from_iter(body); - } else { - let body = serde_json::to_vec(&mock_response.0.body)?; - response.body = Bytes::from_iter(body); - } - - Ok(response) - } -} - -struct MockFileSystem { - spec: ExecutionSpec, -} - -impl MockFileSystem { - fn new(spec: ExecutionSpec) -> MockFileSystem { - MockFileSystem { spec } - } -} - -#[async_trait::async_trait] -impl FileIO for MockFileSystem { - async fn write<'a>(&'a self, _path: &'a str, _content: &'a [u8]) -> anyhow::Result<()> { - Err(anyhow!("Cannot write to a file in an execution spec")) - } - - async fn read<'a>(&'a self, path: &'a str) -> anyhow::Result { - let base = PathBuf::from(path); - let path = base - .file_name() - .context("Invalid file path")? - .to_str() - .context("Invalid OsString")?; - match self.spec.files.get(path) { - Some(x) => Ok(x.to_owned()), - None => Err(anyhow!("No such file or directory (os error 2)")), - } - } -} - -async fn assert_spec(spec: ExecutionSpec, opentelemetry: &InMemoryTelemetry) { - let mock_http_client = Arc::new(MockHttpClient::new(&spec)); - // Parse and validate all server configs + check for identity - - if spec.sdl_error { - // errors: errors are expected, make sure they match - let (source, content) = &spec.server[0]; - - if !matches!(source, Source::GraphQL) { - panic!("Cannot use \"sdl error\" directive with a non-GraphQL server block."); - } - - let config = Config::from_sdl(content).to_result(); - - let config = match config { - Ok(config) => { - let mut runtime = test::create_runtime(mock_http_client, spec.env.clone(), None); - runtime.file = Arc::new(MockFileSystem::new(spec.clone())); - let reader = ConfigReader::init(runtime); - match reader.resolve(config, spec.path.parent()).await { - Ok(config) => Blueprint::try_from(&config), - Err(e) => Err(ValidationError::new(e.to_string())), - } - } - Err(e) => Err(e), - }; - - match config { - Ok(_) => { - tracing::error!("\terror FAIL"); - panic!( - "Spec {} {:?} with \"sdl error\" directive did not have a validation error.", - spec.name, spec.path - ); - } - Err(cause) => { - let errors: Vec = - cause.as_vec().iter().map(|e| e.to_owned().into()).collect(); - - let snapshot_name = format!("{}_errors", spec.safe_name); - - insta::assert_json_snapshot!(snapshot_name, errors); - } - }; - - return; - } - - let mut server: Vec = Vec::with_capacity(spec.server.len()); - - for (i, (source, content)) in spec.server.iter().enumerate() { - let config = Config::from_source(source.to_owned(), content).unwrap_or_else(|e| { - panic!( - "Couldn't parse GraphQL in server definition #{} of {:#?}: {}", - i + 1, - spec.path, - e - ) - }); - - let config = Config::default().merge_right(config); - - // TODO: we should probably figure out a way to do this for every test - // but GraphQL identity checking is very hard, since a lot depends on the code - // style the re-serializing check gives us some of the advantages of the - // identity check too, but we are missing out on some by having it only - // enabled for either new tests that request it or old graphql_spec - // tests that were explicitly written with it in mind - if spec.check_identity { - if matches!(source, Source::GraphQL) { - let identity = config.to_sdl(); - - // \r is added automatically in windows, it's safe to replace it with \n - let content = content.replace("\r\n", "\n"); - - let path_str = spec.path.display().to_string(); - - let identity = tailcall_prettier::format( - identity, - tailcall_prettier::Parser::detect(path_str.as_str()).unwrap(), - ) - .await - .unwrap(); - - let content = tailcall_prettier::format( - content, - tailcall_prettier::Parser::detect(path_str.as_str()).unwrap(), - ) - .await - .unwrap(); - - pretty_assertions::assert_eq!( - identity, - content, - "Identity check failed for {:#?}", - spec.path, - ); - } else { - panic!( - "Spec {:#?} has \"check identity\" enabled, but its config isn't in GraphQL.", - spec.path - ); - } - } - - server.push(config); - } - - // merged: Run merged specs - - let merged = server - .iter() - .fold(Config::default(), |acc, c| acc.merge_right(c.clone())) - .to_sdl(); - - let snapshot_name = format!("{}_merged", spec.safe_name); - - insta::assert_snapshot!(snapshot_name, merged); - // Resolve all configs - let mut runtime = test::create_runtime(mock_http_client.clone(), spec.env.clone(), None); - runtime.file = Arc::new(MockFileSystem::new(spec.clone())); - let reader = ConfigReader::init(runtime); - - let server: Vec = join_all( - server - .into_iter() - .map(|config| reader.resolve(config, spec.path.parent())), - ) - .await - .into_iter() - .enumerate() - .map(|(i, result)| { - result.unwrap_or_else(|e| { - panic!( - "Couldn't resolve GraphQL in server definition #{} of {:#?}: {}", - i + 1, - spec.path, - e - ) - }) - }) - .collect(); - - if server.len() == 1 { - let config = &server[0]; - - // client: Check if client spec matches snapshot - let client = print_schema( - (Blueprint::try_from(config) - .context(format!("file: {}", spec.path.to_str().unwrap())) - .unwrap()) - .to_schema(), - ); - let snapshot_name = format!("{}_client", spec.safe_name); - - insta::assert_snapshot!(snapshot_name, client); - } - - if let Some(assert_spec) = spec.assert.as_ref() { - let app_ctx = spec - .app_context( - server.first().unwrap(), - spec.env.clone().unwrap_or_default(), - mock_http_client.clone(), - ) - .await; - - // assert: Run assert specs - for (i, assertion) in assert_spec.iter().enumerate() { - opentelemetry.reset(); - - let response = run_assert(app_ctx.clone(), assertion) - .await - .context(spec.path.to_str().unwrap().to_string()) - .unwrap(); - - let mut headers: BTreeMap = BTreeMap::new(); - - for (key, value) in response.headers() { - headers.insert(key.to_string(), value.to_str().unwrap().to_string()); - } - - let response: APIResponse = APIResponse { - status: response.status().clone().as_u16(), - headers, - body: serde_json::from_slice( - &hyper::body::to_bytes(response.into_body()).await.unwrap(), - ) - .unwrap_or(serde_json::Value::Null), - text_body: None, - }; - - let snapshot_name = format!("{}_assert_{}", spec.safe_name, i); - - insta::assert_json_snapshot!(snapshot_name, response); - - if assertion.assert_traces { - let snapshot_name = format!("{}_assert_traces_{}", spec.safe_name, i); - insta::assert_json_snapshot!(snapshot_name, opentelemetry.get_traces().unwrap()); - } - - if assertion.assert_metrics { - let snapshot_name = format!("{}_assert_metrics_{}", spec.safe_name, i); - insta::assert_json_snapshot!( - snapshot_name, - opentelemetry.get_metrics().await.unwrap() - ); - } - } - - mock_http_client.assert_hits(&spec.path); - } - - tracing::info!("{} ... ok", spec.path.display()); -} - -#[tokio::test] -async fn test() -> anyhow::Result<()> { - let opentelemetry = init_opentelemetry(); - // Explicitly only run one test if specified in command line args - // This is used by test-convertor to auto-apply the snapshots of incompatible - // fail-annotated http specs - - let args: Vec = std::env::args().collect(); - let expected_arg = ["insta", "i"]; - - let index = args - .iter() - .position(|arg| expected_arg.contains(&arg.as_str())) - .unwrap_or(usize::MAX); - - let spec = if index == usize::MAX { - let spec = ExecutionSpec::cargo_read("tests/execution").await?; - ExecutionSpec::filter_specs(spec) - } else { - let mut vec = vec![]; - let insta_values: Vec<&String> = args.iter().skip(index + 1).collect(); - for arg in insta_values { - let path = PathBuf::from(arg) - .canonicalize() - .unwrap_or_else(|_| panic!("Failed to parse explicit test path {:?}", arg)); - - let contents = fs::read_to_string(&path)?; - let spec: ExecutionSpec = ExecutionSpec::from_source(&path, contents) - .await - .map_err(|err| err.context(path.to_str().unwrap().to_string()))?; - vec.push(spec); - } - vec - }; - - for spec in spec.into_iter() { - assert_spec(spec, &opentelemetry).await; - } - - Ok(()) -} - -async fn run_assert( - app_ctx: Arc, - request: &APIRequest, -) -> anyhow::Result> { - let query_string = serde_json::to_string(&request.body).expect("body is required"); - let method = request.method.clone(); - let headers = request.headers.clone(); - let url = request.url.clone(); - let req = headers - .into_iter() - .fold( - Request::builder() - .method(method.to_hyper()) - .uri(url.as_str()), - |acc, (key, value)| acc.header(key, value), - ) - .body(Body::from(query_string))?; - - // TODO: reuse logic from server.rs to select the correct handler - if app_ctx.blueprint.server.enable_batch_requests { - handle_request::(req, app_ctx).await - } else { - handle_request::(req, app_ctx).await - } -} +datatest_stable::harness!(run_execution_spec, "tests/execution", r"^.*\.md$"); diff --git a/tests/expression_spec.rs b/tests/expression_spec.rs index dd9255d305..45e07d2b3e 100644 --- a/tests/expression_spec.rs +++ b/tests/expression_spec.rs @@ -1,26 +1,71 @@ -use async_graphql::Value; -use pretty_assertions::assert_eq; -use serde_json::json; -use tailcall::blueprint::{Blueprint, DynamicValue}; -use tailcall::http::RequestContext; -use tailcall::lambda::{Concurrent, EmptyResolverContext, Eval, EvaluationContext, Expression}; -use tailcall::mustache::Mustache; - -async fn eval(expr: &Expression) -> anyhow::Result { - let runtime = tailcall::cli::runtime::init(&Blueprint::default()); - let req_ctx = RequestContext::new(runtime); - let res_ctx = EmptyResolverContext {}; - let eval_ctx = EvaluationContext::new(&req_ctx, &res_ctx); - expr.eval(eval_ctx, &Concurrent::Parallel).await -} +#[cfg(test)] +mod tests { + use async_graphql::Value; + use pretty_assertions::assert_eq; + use serde_json::json; + use tailcall::blueprint::{Blueprint, DynamicValue}; + use tailcall::http::RequestContext; + use tailcall::lambda::{Concurrent, EmptyResolverContext, Eval, EvaluationContext, Expression}; + use tailcall::mustache::Mustache; -#[tokio::test] -async fn test_and_then() { - let abcde = DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(); - let expr = Expression::Dynamic(abcde) - .and_then(Expression::Dynamic(DynamicValue::Mustache( + async fn eval(expr: &Expression) -> anyhow::Result { + let runtime = tailcall::cli::runtime::init(&Blueprint::default()); + let req_ctx = RequestContext::new(runtime); + let res_ctx = EmptyResolverContext {}; + let eval_ctx = EvaluationContext::new(&req_ctx, &res_ctx); + expr.eval(eval_ctx, &Concurrent::Parallel).await + } + + #[tokio::test] + async fn test_and_then() { + let abcde = DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(); + let expr = Expression::Dynamic(abcde) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.a}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.b}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.c}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.d}}").unwrap(), + ))); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual, expected); + } + + #[tokio::test] + async fn test_with_args() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.a.b.c.d}}").unwrap(), + )) + .with_args(args); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual, expected); + } + + #[tokio::test] + async fn test_with_args_piping() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( Mustache::parse("{{args.a}}").unwrap(), - ))) + )) + .with_args(args) .and_then(Expression::Dynamic(DynamicValue::Mustache( Mustache::parse("{{args.b}}").unwrap(), ))) @@ -31,51 +76,85 @@ async fn test_and_then() { Mustache::parse("{{args.d}}").unwrap(), ))); - let actual = eval(&expr).await.unwrap(); - let expected = Value::from_json(json!("e")).unwrap(); + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); - assert_eq!(actual, expected); -} + assert_eq!(actual, expected); + } -#[tokio::test] -async fn test_with_args() { - let args = Expression::Dynamic( - DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), - ); + #[tokio::test] + async fn test_optional_dot_in_expression() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); - let expr = Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.a.b.c.d}}").unwrap(), - )) - .with_args(args); + let expr_with_dot = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.a.b.c.d}}").unwrap(), + )) + .with_args(args.clone()); - let actual = eval(&expr).await.unwrap(); - let expected = Value::from_json(json!("e")).unwrap(); + let expr_without_dot = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.a.b.c.d}}").unwrap(), + )) + .with_args(args); - assert_eq!(actual, expected); -} + let actual_with_dot = eval(&expr_with_dot).await.unwrap(); + let actual_without_dot = eval(&expr_without_dot).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual_with_dot, expected); + assert_eq!(actual_without_dot, expected); + } + + #[tokio::test] + async fn test_optional_dot_piping() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.a}}").unwrap(), + )) + .with_args(args) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.b}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.c}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.d}}").unwrap(), + ))); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual, expected); + } + + #[tokio::test] + async fn test_mixed_dot_usages() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.a}}").unwrap(), + )) + .with_args(args) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.b}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.c}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.d}}").unwrap(), + ))); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); -#[tokio::test] -async fn test_with_args_piping() { - let args = Expression::Dynamic( - DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), - ); - - let expr = Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.a}}").unwrap(), - )) - .with_args(args) - .and_then(Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.b}}").unwrap(), - ))) - .and_then(Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.c}}").unwrap(), - ))) - .and_then(Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.d}}").unwrap(), - ))); - - let actual = eval(&expr).await.unwrap(); - let expected = Value::from_json(json!("e")).unwrap(); - - assert_eq!(actual, expected); + assert_eq!(actual, expected); + } } diff --git a/tests/graphql/todo/test-batched-query.graphql b/tests/graphql/todo/test-batched-query.graphql deleted file mode 100644 index 0d36ab391a..0000000000 --- a/tests/graphql/todo/test-batched-query.graphql +++ /dev/null @@ -1,69 +0,0 @@ -#> server-sdl -schema @server @upstream(baseURL: "http://127.0.0.1:3000") { - query: Query -} - -type Query { - users: [User] @http(path: "/users") -} - -type User { - id: Int! - name: String! - username: String! - email: String! - phone: String - website: String - postsBatched: [Post] @http(path: "/posts", query: {userId: "{{parent.value.id}}"}) @batch(key: "id", path: ["userId"]) - firstPost: Post @http(path: "/firstPost", query: {userId: "{{parent.value.id}}"}) @batch(key: "id", path: ["userId"]) -} - -type Post { - id: Int - title: String - userId: String - body: String -} - -#> client-query -query -@expect( - json: { - data: { - users: [ - {postsBatched: [{title: "User 1 Post 1"}, {title: "User 1 Post 2"}]} - {postsBatched: [{title: "User 2 Post 1"}, {title: "User 2 Post 2"}]} - {postsBatched: [{title: "User 3 Post 1"}, {title: "User 3 Post 2"}]} - ] - } - } -) { - users { - postsBatched { - title - } - postsUnbatched { - title - } - } -} - -#> client-query -query -@expect( - json: { - data: { - users: [ - {firstPost: {title: "User 1 Post 1"}} - {firstPost: {title: "User 2 Post 1"}} - {firstPost: {title: "User 3 Post 1"}} - ] - } - } -) { - users { - firstPost { - title - } - } -} diff --git a/tests/graphql/todo/test-dictionary.graphql b/tests/graphql/todo/test-dictionary.graphql deleted file mode 100644 index 93707eae47..0000000000 --- a/tests/graphql/todo/test-dictionary.graphql +++ /dev/null @@ -1,35 +0,0 @@ -#> server-sdl -schema { - query: Query -} - -type A { - a: Int - b: [B] -} - -type B { - key: String - value: Int -} - -type Query { - z: A @http(path: "/dictionary", baseURL: "https://foo.com") -} - -#> client-query -query ($expect: Json = {z: {a: 1, b: [{key: "k1", value: 1}, {key: "k2", value: 2}, {key: "k3", value: 3}]}}) { - z { - a - b { - key - value - } - } -} - -query @expect(json: {z: {a: 1}}) { - z { - a - } -} diff --git a/tests/graphql/todo/test-inline-with-list.graphql b/tests/graphql/todo/test-inline-with-list.graphql deleted file mode 100644 index 523e8fbd92..0000000000 --- a/tests/graphql/todo/test-inline-with-list.graphql +++ /dev/null @@ -1,27 +0,0 @@ -#> server-sdl -schema { - query: Query -} - -type A { - b: [B] -} - -type B { - c: String -} - -type Foo { - a: [A] -} - -type Query @addField(name: "foo", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/inlineWithList", baseURL: "https://foo.com") @modify(omit: true) -} - -#> client-query -query @expect(json: {foo: [[{c: "Hello"}]]}) { - foo { - c - } -} diff --git a/tests/graphql/todo/test-nested-type.graphql b/tests/graphql/todo/test-nested-type.graphql deleted file mode 100644 index afbbdcdc27..0000000000 --- a/tests/graphql/todo/test-nested-type.graphql +++ /dev/null @@ -1,25 +0,0 @@ -#> server-sdl -schema { - query: Query -} - -type A { - b: [B] -} - -type B { - c: Int -} - -type Query { - a: A @http(path: "/nestedType", baseURL: "https://foo.com") -} - -#> client-query -query @expect(json: {a: {b: [{c: 1}, {c: 2}, {c: 3}]}}) { - a { - b { - c - } - } -} diff --git a/tests/graphql/todo/test-nesting-array-ctx.graphql b/tests/graphql/todo/test-nesting-array-ctx.graphql deleted file mode 100644 index a3813511ad..0000000000 --- a/tests/graphql/todo/test-nesting-array-ctx.graphql +++ /dev/null @@ -1,25 +0,0 @@ -#> server-sdl -schema { - query: Query -} - -type Bar { - value: Int @http(path: "/withNestingArrayCtxValue", query: {data: "{{value}}"}, baseURL: "https://foo.com") -} - -type Foo { - bar: [Bar] @http(path: "/withNestingArrayCtxBar", baseURL: "https://foo.com") -} - -type Query { - foo: Foo -} - -#> client-query -query ($expect: Json = {foo: {bar: [{value: 101}, {value: 201}, {value: 301}]}}) { - foo { - bar { - value - } - } -} diff --git a/tests/graphql/todo/test-nesting-array.graphql b/tests/graphql/todo/test-nesting-array.graphql deleted file mode 100644 index f8bedbdbdd..0000000000 --- a/tests/graphql/todo/test-nesting-array.graphql +++ /dev/null @@ -1,25 +0,0 @@ -#> server-sdl -schema { - query: Query -} - -type Bar { - value: Int @http(path: "/withNestingArrayValue", baseURL: "https://foo.com") -} - -type Foo { - bar: [Bar] @http(path: "/withNestingArrayBar", baseURL: "https://foo.com") -} - -type Query { - foo: Foo -} - -#> client-query -query ($expect: Json = {foo: {bar: [{value: 100}, {value: 100}, {value: 100}]}}) { - foo { - bar { - value - } - } -} diff --git a/tests/graphql/todo/test-no-modified-input-field.graphql b/tests/graphql/todo/test-no-modified-input-field.graphql deleted file mode 100644 index 7257b51edb..0000000000 --- a/tests/graphql/todo/test-no-modified-input-field.graphql +++ /dev/null @@ -1,24 +0,0 @@ -#> server-sdl -schema { - query: Query -} - -input IdentityInput { - a: Int @modify(name: "b") -} - -type Identity { - a: Int @modify(name: "b") -} - -type Query { - identity(input: IdentityInput): Identity - @http(path: "/noModifiedInputField", query: {data: "{{args.input.a}}"}, baseURL: "https://foo.com") -} - -#> client-query -query @expect(json: {identity: {b: 1}}) { - identity(input: {a: 1}) { - b - } -} diff --git a/tests/graphql/todo/test-rename-argument.graphql b/tests/graphql/todo/test-rename-argument.graphql deleted file mode 100644 index 56f55b1a6b..0000000000 --- a/tests/graphql/todo/test-rename-argument.graphql +++ /dev/null @@ -1,20 +0,0 @@ -#> server-sdl -schema { - query: Query -} - -type Bar { - bar: Int -} - -type Query { - foo(input: Int @modify(name: "data")): Bar - @http(path: "/renameArgument", query: {data: "{{args.data}}"}, baseURL: "https://foo.com") -} - -#> client-query -query @expect(json: {foo: {bar: 1}}) { - foo(data: 1) { - bar - } -} diff --git a/tests/snapshots/execution_spec__add-field-index-list.md_assert_0.snap b/tests/snapshots/execution_spec__add-field-index-list.md_assert_0.snap deleted file mode 100644 index 29d33382cd..0000000000 --- a/tests/snapshots/execution_spec__add-field-index-list.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "username": "Leanne Graham" - } - } -} diff --git a/tests/snapshots/execution_spec__add-field-index-list.md_client.snap b/tests/snapshots/execution_spec__add-field-index-list.md_client.snap deleted file mode 100644 index e61b7c1600..0000000000 --- a/tests/snapshots/execution_spec__add-field-index-list.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - username: String - users: [User] -} - -scalar Url - -type User { - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__add-field-index-list.md_merged.snap b/tests/snapshots/execution_spec__add-field-index-list.md_merged.snap deleted file mode 100644 index a99128757f..0000000000 --- a/tests/snapshots/execution_spec__add-field-index-list.md_merged.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query @addField(name: "username", path: ["users", "0", "name"]) { - users: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") -} - -type User { - name: String -} diff --git a/tests/snapshots/execution_spec__add-field-many-list.md_client.snap b/tests/snapshots/execution_spec__add-field-many-list.md_client.snap deleted file mode 100644 index 2456ca4d9f..0000000000 --- a/tests/snapshots/execution_spec__add-field-many-list.md_client.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type A { - b: [String] - c: String - d: String -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - u: U -} - -type U { - a: A - b: [String] - c: String - d: String - e: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__add-field-many-list.md_merged.snap b/tests/snapshots/execution_spec__add-field-many-list.md_merged.snap deleted file mode 100644 index f01797ab15..0000000000 --- a/tests/snapshots/execution_spec__add-field-many-list.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type A { - b: [String] - c: String - d: String -} - -type Query { - u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") -} - -type U @addField(name: "b", path: ["a", "b"]) @addField(name: "c", path: ["a", "c"]) @addField(name: "d", path: ["a", "d"]) { - a: A - e: String -} diff --git a/tests/snapshots/execution_spec__add-field-many.md_client.snap b/tests/snapshots/execution_spec__add-field-many.md_client.snap deleted file mode 100644 index df32ac0aab..0000000000 --- a/tests/snapshots/execution_spec__add-field-many.md_client.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -type Foo { - a: String - b: String - c: String - name: String - x: X -} - -scalar JSON - -scalar PhoneNumber - -type Query { - user: Foo -} - -scalar Url - -type X { - a: String - b: String - c: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__add-field-many.md_merged.snap b/tests/snapshots/execution_spec__add-field-many.md_merged.snap deleted file mode 100644 index 108c262739..0000000000 --- a/tests/snapshots/execution_spec__add-field-many.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Foo @addField(name: "a", path: ["x", "a"]) @addField(name: "b", path: ["x", "b"]) @addField(name: "c", path: ["x", "c"]) { - name: String - x: X -} - -type Query { - user: Foo @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type X { - a: String - b: String - c: String -} diff --git a/tests/snapshots/execution_spec__add-field-modify.md_assert_0.snap b/tests/snapshots/execution_spec__add-field-modify.md_assert_0.snap deleted file mode 100644 index 9b3aeaf49d..0000000000 --- a/tests/snapshots/execution_spec__add-field-modify.md_assert_0.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": "foo", - "street": "Kulas Light", - "city": "Gwenborough", - "zipcode": "92998-3874" - } - } - } -} diff --git a/tests/snapshots/execution_spec__add-field-modify.md_client.snap b/tests/snapshots/execution_spec__add-field-modify.md_client.snap deleted file mode 100644 index 3c9c668b7c..0000000000 --- a/tests/snapshots/execution_spec__add-field-modify.md_client.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Address { - city: String - street: String - zipcode: String -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - address: Address - city: String - name: String - street: String - zipcode: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__add-field-modify.md_merged.snap b/tests/snapshots/execution_spec__add-field-modify.md_merged.snap deleted file mode 100644 index 4307019636..0000000000 --- a/tests/snapshots/execution_spec__add-field-modify.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - city: String - street: String - zipcode: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User @addField(name: "street", path: ["address", "street"]) @addField(name: "city", path: ["address", "city"]) @addField(name: "zipcode", path: ["address", "zipcode"]) { - address: Address - name: String -} diff --git a/tests/snapshots/execution_spec__add-field-with-composition.md_assert_0.snap b/tests/snapshots/execution_spec__add-field-with-composition.md_assert_0.snap deleted file mode 100644 index d017028cc6..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-composition.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "lat": "-37.3159" - } - } -} diff --git a/tests/snapshots/execution_spec__add-field-with-composition.md_assert_1.snap b/tests/snapshots/execution_spec__add-field-with-composition.md_assert_1.snap deleted file mode 100644 index d28ce3b731..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-composition.md_assert_1.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "lng": "81.1496" - } - } -} diff --git a/tests/snapshots/execution_spec__add-field-with-composition.md_client.snap b/tests/snapshots/execution_spec__add-field-with-composition.md_client.snap deleted file mode 100644 index 9c29a08749..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-composition.md_client.snap +++ /dev/null @@ -1,39 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Address { - geo: Geo - street: String -} - -scalar Date - -scalar Email - -scalar Empty - -type Geo { - lat: String - lng: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - lat: String - lng: String - user: User -} - -scalar Url - -type User { - address: Address -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__add-field-with-composition.md_merged.snap b/tests/snapshots/execution_spec__add-field-with-composition.md_merged.snap deleted file mode 100644 index ee4ebae19d..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-composition.md_merged.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - geo: Geo - street: String -} - -type Geo { - lat: String - lng: String -} - -type Query @addField(name: "lat", path: ["user", "address", "geo", "lat"]) @addField(name: "lng", path: ["user", "address", "geo", "lng"]) { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - address: Address -} diff --git a/tests/snapshots/execution_spec__add-field-with-modify.md_assert_0.snap b/tests/snapshots/execution_spec__add-field-with-modify.md_assert_0.snap deleted file mode 100644 index 861c4f9743..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-modify.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user1": "Leanne Graham" - } - } -} diff --git a/tests/snapshots/execution_spec__add-field-with-modify.md_assert_1.snap b/tests/snapshots/execution_spec__add-field-with-modify.md_assert_1.snap deleted file mode 100644 index b5e02c082d..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-modify.md_assert_1.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user2": "Ervin Howell" - } - } -} diff --git a/tests/snapshots/execution_spec__add-field-with-modify.md_client.snap b/tests/snapshots/execution_spec__add-field-with-modify.md_client.snap deleted file mode 100644 index f77eddebb2..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-modify.md_client.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - person1: User - person2: User - user1: String - user2: String -} - -scalar Url - -type User { - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__add-field-with-modify.md_merged.snap b/tests/snapshots/execution_spec__add-field-with-modify.md_merged.snap deleted file mode 100644 index 5ea9e91eca..0000000000 --- a/tests/snapshots/execution_spec__add-field-with-modify.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query @addField(name: "user1", path: ["person1", "name"]) @addField(name: "user2", path: ["person2", "name"]) { - person1: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") - person2: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/2") -} - -type User { - name: String -} diff --git a/tests/snapshots/execution_spec__add-field.md_assert_0.snap b/tests/snapshots/execution_spec__add-field.md_assert_0.snap deleted file mode 100644 index bf508b8b0d..0000000000 --- a/tests/snapshots/execution_spec__add-field.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "lat": "-37.3159" - } - } - } -} diff --git a/tests/snapshots/execution_spec__add-field.md_client.snap b/tests/snapshots/execution_spec__add-field.md_client.snap deleted file mode 100644 index b858be18ec..0000000000 --- a/tests/snapshots/execution_spec__add-field.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Address { - geo: Geo -} - -scalar Date - -scalar Email - -scalar Empty - -type Geo { - lat: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - address: Address - lat: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__add-field.md_merged.snap b/tests/snapshots/execution_spec__add-field.md_merged.snap deleted file mode 100644 index 869fcbf812..0000000000 --- a/tests/snapshots/execution_spec__add-field.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - geo: Geo -} - -type Geo { - lat: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User @addField(name: "lat", path: ["address", "geo", "lat"]) { - address: Address -} diff --git a/tests/snapshots/execution_spec__apollo-tracing.md_assert_0.snap b/tests/snapshots/execution_spec__apollo-tracing.md_assert_0.snap deleted file mode 100644 index d79142407b..0000000000 --- a/tests/snapshots/execution_spec__apollo-tracing.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "hello": "hello" - } - } -} diff --git a/tests/snapshots/execution_spec__apollo-tracing.md_client.snap b/tests/snapshots/execution_spec__apollo-tracing.md_client.snap deleted file mode 100644 index e0c36c9133..0000000000 --- a/tests/snapshots/execution_spec__apollo-tracing.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - hello: String! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__apollo-tracing.md_merged.snap b/tests/snapshots/execution_spec__apollo-tracing.md_merged.snap deleted file mode 100644 index b21a8ec737..0000000000 --- a/tests/snapshots/execution_spec__apollo-tracing.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream { - query: Query -} - -type Query { - hello: String! @http(baseURL: "http://api.com", path: "/") -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_assert_0.snap b/tests/snapshots/execution_spec__auth-basic.md_assert_0.snap deleted file mode 100644 index 23b23fc4c6..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_assert_0.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "scalar": "data from public scalar", - "nested": { - "name": "nested name" - } - } - } -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_assert_1.snap b/tests/snapshots/execution_spec__auth-basic.md_assert_1.snap deleted file mode 100644 index e5615af7a6..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_assert_1.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Authentication Failure: Missing Authorization Header", - "locations": [ - { - "line": 2, - "column": 3 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_assert_2.snap b/tests/snapshots/execution_spec__auth-basic.md_assert_2.snap deleted file mode 100644 index e6f8269b6c..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_assert_2.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Authentication Failure: Invalid Authorization Header", - "locations": [ - { - "line": 2, - "column": 3 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_assert_3.snap b/tests/snapshots/execution_spec__auth-basic.md_assert_3.snap deleted file mode 100644 index 0ca6d0f640..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_assert_3.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "protectedScalar": "data from protected scalar", - "nested": { - "name": "nested name", - "protected": "protected nested" - }, - "protectedType": { - "name": "protected type name", - "nested": "protected type nested" - } - } - } -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_assert_4.snap b/tests/snapshots/execution_spec__auth-basic.md_assert_4.snap deleted file mode 100644 index e5615af7a6..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_assert_4.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Authentication Failure: Missing Authorization Header", - "locations": [ - { - "line": 2, - "column": 3 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_assert_5.snap b/tests/snapshots/execution_spec__auth-basic.md_assert_5.snap deleted file mode 100644 index be4bc718b0..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_assert_5.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "protectedType": { - "name": "mutation name", - "nested": "mutation nested" - } - } - } -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_assert_6.snap b/tests/snapshots/execution_spec__auth-basic.md_assert_6.snap deleted file mode 100644 index e6f8269b6c..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_assert_6.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Authentication Failure: Invalid Authorization Header", - "locations": [ - { - "line": 2, - "column": 3 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_client.snap b/tests/snapshots/execution_spec__auth-basic.md_client.snap deleted file mode 100644 index f3f258d58b..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_client.snap +++ /dev/null @@ -1,41 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type Mutation { - protectedType: ProtectedType -} - -type Nested { - name: String! - protected: String! -} - -scalar PhoneNumber - -type ProtectedType { - name: String! - nested: String! -} - -type Query { - nested: Nested! - protectedScalar: String! - protectedType: ProtectedType - scalar: String! -} - -scalar Url - -schema { - query: Query - mutation: Mutation -} diff --git a/tests/snapshots/execution_spec__auth-basic.md_merged.snap b/tests/snapshots/execution_spec__auth-basic.md_merged.snap deleted file mode 100644 index 0f94953b0f..0000000000 --- a/tests/snapshots/execution_spec__auth-basic.md_merged.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream @link(id: "htpasswd", src: ".htpasswd", type: Htpasswd) { - query: Query - mutation: Mutation -} - -type Mutation { - protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") -} - -type Nested { - name: String! - protected: String! @protected -} - -type ProtectedType @protected { - name: String! - nested: String! -} - -type Query { - nested: Nested! @expr(body: {name: "nested name", protected: "protected nested"}) - protectedScalar: String! @expr(body: "data from protected scalar") @protected - protectedType: ProtectedType @expr(body: {name: "protected type name", nested: "protected type nested"}) - scalar: String! @expr(body: "data from public scalar") -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_assert_0.snap b/tests/snapshots/execution_spec__auth-jwt.md_assert_0.snap deleted file mode 100644 index 23b23fc4c6..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_assert_0.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "scalar": "data from public scalar", - "nested": { - "name": "nested name" - } - } - } -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_assert_1.snap b/tests/snapshots/execution_spec__auth-jwt.md_assert_1.snap deleted file mode 100644 index e5615af7a6..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_assert_1.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Authentication Failure: Missing Authorization Header", - "locations": [ - { - "line": 2, - "column": 3 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_assert_2.snap b/tests/snapshots/execution_spec__auth-jwt.md_assert_2.snap deleted file mode 100644 index 0ca6d0f640..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_assert_2.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "protectedScalar": "data from protected scalar", - "nested": { - "name": "nested name", - "protected": "protected nested" - }, - "protectedType": { - "name": "protected type name", - "nested": "protected type nested" - } - } - } -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_assert_3.snap b/tests/snapshots/execution_spec__auth-jwt.md_assert_3.snap deleted file mode 100644 index e5615af7a6..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_assert_3.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Authentication Failure: Missing Authorization Header", - "locations": [ - { - "line": 2, - "column": 3 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_assert_4.snap b/tests/snapshots/execution_spec__auth-jwt.md_assert_4.snap deleted file mode 100644 index be4bc718b0..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_assert_4.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "protectedType": { - "name": "mutation name", - "nested": "mutation nested" - } - } - } -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_assert_5.snap b/tests/snapshots/execution_spec__auth-jwt.md_assert_5.snap deleted file mode 100644 index e6f8269b6c..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_assert_5.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Authentication Failure: Invalid Authorization Header", - "locations": [ - { - "line": 2, - "column": 3 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_client.snap b/tests/snapshots/execution_spec__auth-jwt.md_client.snap deleted file mode 100644 index f3f258d58b..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_client.snap +++ /dev/null @@ -1,41 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type Mutation { - protectedType: ProtectedType -} - -type Nested { - name: String! - protected: String! -} - -scalar PhoneNumber - -type ProtectedType { - name: String! - nested: String! -} - -type Query { - nested: Nested! - protectedScalar: String! - protectedType: ProtectedType - scalar: String! -} - -scalar Url - -schema { - query: Query - mutation: Mutation -} diff --git a/tests/snapshots/execution_spec__auth-jwt.md_merged.snap b/tests/snapshots/execution_spec__auth-jwt.md_merged.snap deleted file mode 100644 index 49a1a0bff5..0000000000 --- a/tests/snapshots/execution_spec__auth-jwt.md_merged.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream @link(id: "jwks", src: "jwks.json", type: Jwks) { - query: Query - mutation: Mutation -} - -type Mutation { - protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") -} - -type Nested { - name: String! - protected: String! @protected -} - -type ProtectedType @protected { - name: String! - nested: String! -} - -type Query { - nested: Nested! @expr(body: {name: "nested name", protected: "protected nested"}) - protectedScalar: String! @expr(body: "data from protected scalar") @protected - protectedType: ProtectedType @expr(body: {name: "protected type name", nested: "protected type nested"}) - scalar: String! @expr(body: "data from public scalar") -} diff --git a/tests/snapshots/execution_spec__auth.md_client.snap b/tests/snapshots/execution_spec__auth.md_client.snap deleted file mode 100644 index b407a8d7e1..0000000000 --- a/tests/snapshots/execution_spec__auth.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - data: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__auth.md_merged.snap b/tests/snapshots/execution_spec__auth.md_merged.snap deleted file mode 100644 index 8957ba9339..0000000000 --- a/tests/snapshots/execution_spec__auth.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream @link(id: "htpasswd", src: ".htpasswd", type: Htpasswd) @link(id: "jwks", src: "jwks.json", type: Jwks) { - query: Query -} - -type Query { - data: String @expr(body: "data") @protected -} diff --git a/tests/snapshots/execution_spec__batching-default.md_assert_0.snap b/tests/snapshots/execution_spec__batching-default.md_assert_0.snap deleted file mode 100644 index c95cface17..0000000000 --- a/tests/snapshots/execution_spec__batching-default.md_assert_0.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "user": { - "id": 1 - }, - "userId": 1 - }, - { - "user": { - "id": 2 - }, - "userId": 2 - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__batching-default.md_client.snap b/tests/snapshots/execution_spec__batching-default.md_client.snap deleted file mode 100644 index f8e5c29910..0000000000 --- a/tests/snapshots/execution_spec__batching-default.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - user: User - userId: Int! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__batching-default.md_merged.snap b/tests/snapshots/execution_spec__batching-default.md_merged.snap deleted file mode 100644 index 96c394b7f4..0000000000 --- a/tests/snapshots/execution_spec__batching-default.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 10, headers: [], maxSize: 100}, httpCache: true) { - query: Query -} - -type Post { - body: String - id: Int - title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__batching-disabled.md_assert_0.snap b/tests/snapshots/execution_spec__batching-disabled.md_assert_0.snap deleted file mode 100644 index c1db4d440d..0000000000 --- a/tests/snapshots/execution_spec__batching-disabled.md_assert_0.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "u1": { - "id": 1 - }, - "u2": { - "id": 2 - } - } - } -} diff --git a/tests/snapshots/execution_spec__batching-disabled.md_client.snap b/tests/snapshots/execution_spec__batching-disabled.md_client.snap deleted file mode 100644 index e6b70532b1..0000000000 --- a/tests/snapshots/execution_spec__batching-disabled.md_client.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - id: Int - name: String - username: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__batching-disabled.md_merged.snap b/tests/snapshots/execution_spec__batching-disabled.md_merged.snap deleted file mode 100644 index e6e793cb7c..0000000000 --- a/tests/snapshots/execution_spec__batching-disabled.md_merged.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 0, headers: [], maxSize: 100}, httpCache: true) { - query: Query -} - -type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") -} - -type User { - id: Int - name: String - username: String -} diff --git a/tests/snapshots/execution_spec__batching-group-by-default.md_assert_0.snap b/tests/snapshots/execution_spec__batching-group-by-default.md_assert_0.snap deleted file mode 100644 index c95cface17..0000000000 --- a/tests/snapshots/execution_spec__batching-group-by-default.md_assert_0.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "user": { - "id": 1 - }, - "userId": 1 - }, - { - "user": { - "id": 2 - }, - "userId": 2 - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__batching-group-by-default.md_client.snap b/tests/snapshots/execution_spec__batching-group-by-default.md_client.snap deleted file mode 100644 index f8e5c29910..0000000000 --- a/tests/snapshots/execution_spec__batching-group-by-default.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - user: User - userId: Int! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__batching-group-by-default.md_merged.snap b/tests/snapshots/execution_spec__batching-group-by-default.md_merged.snap deleted file mode 100644 index 63dd14da32..0000000000 --- a/tests/snapshots/execution_spec__batching-group-by-default.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: true) { - query: Query -} - -type Post { - body: String - id: Int - title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__batching-group-by.md_assert_0.snap b/tests/snapshots/execution_spec__batching-group-by.md_assert_0.snap deleted file mode 100644 index c95cface17..0000000000 --- a/tests/snapshots/execution_spec__batching-group-by.md_assert_0.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "user": { - "id": 1 - }, - "userId": 1 - }, - { - "user": { - "id": 2 - }, - "userId": 2 - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__batching-group-by.md_client.snap b/tests/snapshots/execution_spec__batching-group-by.md_client.snap deleted file mode 100644 index f8e5c29910..0000000000 --- a/tests/snapshots/execution_spec__batching-group-by.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - user: User - userId: Int! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__batching-group-by.md_merged.snap b/tests/snapshots/execution_spec__batching-group-by.md_merged.snap deleted file mode 100644 index a6a89380c8..0000000000 --- a/tests/snapshots/execution_spec__batching-group-by.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: true) { - query: Query -} - -type Post { - body: String - id: Int - title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__batching-post.md_assert_0.snap b/tests/snapshots/execution_spec__batching-post.md_assert_0.snap deleted file mode 100644 index df16b720ba..0000000000 --- a/tests/snapshots/execution_spec__batching-post.md_assert_0.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "user": { - "name": "Leanne Graham" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__batching-post.md_client.snap b/tests/snapshots/execution_spec__batching-post.md_client.snap deleted file mode 100644 index f8e5c29910..0000000000 --- a/tests/snapshots/execution_spec__batching-post.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - user: User - userId: Int! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__batching-post.md_merged.snap b/tests/snapshots/execution_spec__batching-post.md_merged.snap deleted file mode 100644 index ace737fb85..0000000000 --- a/tests/snapshots/execution_spec__batching-post.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: true) { - query: Query -} - -type Post { - body: String - id: Int - title: String - user: User @http(path: "/users/{{value.userId}}") - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts?id=1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__batching.md_assert_0.snap b/tests/snapshots/execution_spec__batching.md_assert_0.snap deleted file mode 100644 index f4a82d3ebe..0000000000 --- a/tests/snapshots/execution_spec__batching.md_assert_0.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": [ - { - "data": { - "user": { - "id": 1 - } - } - }, - { - "data": { - "user": { - "name": "foo" - } - } - } - ] -} diff --git a/tests/snapshots/execution_spec__batching.md_assert_1.snap b/tests/snapshots/execution_spec__batching.md_assert_1.snap deleted file mode 100644 index 5892866e24..0000000000 --- a/tests/snapshots/execution_spec__batching.md_assert_1.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "id": 1 - } - } - } -} diff --git a/tests/snapshots/execution_spec__batching.md_assert_2.snap b/tests/snapshots/execution_spec__batching.md_assert_2.snap deleted file mode 100644 index 455e22a7d5..0000000000 --- a/tests/snapshots/execution_spec__batching.md_assert_2.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": " --> 1:1\n |\n1 | FOO\n | ^---\n |\n = expected executable_definition", - "locations": [ - { - "line": 1, - "column": 1 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__batching.md_client.snap b/tests/snapshots/execution_spec__batching.md_client.snap deleted file mode 100644 index 84d2907e22..0000000000 --- a/tests/snapshots/execution_spec__batching.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__batching.md_merged.snap b/tests/snapshots/execution_spec__batching.md_merged.snap deleted file mode 100644 index 7f4e597155..0000000000 --- a/tests/snapshots/execution_spec__batching.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(batchRequests: true) @upstream { - query: Query -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__cache-control.md_assert_0.snap b/tests/snapshots/execution_spec__cache-control.md_assert_0.snap deleted file mode 100644 index 7159134df4..0000000000 --- a/tests/snapshots/execution_spec__cache-control.md_assert_0.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "cache-control": "max-age=3600", - "content-type": "application/json" - }, - "body": { - "data": { - "u1": { - "id": 1 - }, - "u2": { - "id": 2 - } - } - } -} diff --git a/tests/snapshots/execution_spec__cache-control.md_assert_1.snap b/tests/snapshots/execution_spec__cache-control.md_assert_1.snap deleted file mode 100644 index adae6faa84..0000000000 --- a/tests/snapshots/execution_spec__cache-control.md_assert_1.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "cache-control": "max-age=3600, private", - "content-type": "application/json" - }, - "body": { - "data": { - "u1": { - "id": 1 - }, - "u3": { - "id": 3 - } - } - } -} diff --git a/tests/snapshots/execution_spec__cache-control.md_assert_2.snap b/tests/snapshots/execution_spec__cache-control.md_assert_2.snap deleted file mode 100644 index 08931aa49c..0000000000 --- a/tests/snapshots/execution_spec__cache-control.md_assert_2.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "cache-control": "no-cache", - "content-type": "application/json" - }, - "body": { - "data": { - "u1": { - "id": 1 - }, - "u4": { - "id": 4 - } - } - } -} diff --git a/tests/snapshots/execution_spec__cache-control.md_assert_3.snap b/tests/snapshots/execution_spec__cache-control.md_assert_3.snap deleted file mode 100644 index fd928f7a26..0000000000 --- a/tests/snapshots/execution_spec__cache-control.md_assert_3.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "cache-control": "no-cache, private", - "content-type": "application/json" - }, - "body": { - "data": { - "u3": { - "id": 3 - }, - "u4": { - "id": 4 - } - } - } -} diff --git a/tests/snapshots/execution_spec__cache-control.md_client.snap b/tests/snapshots/execution_spec__cache-control.md_client.snap deleted file mode 100644 index 89319b393a..0000000000 --- a/tests/snapshots/execution_spec__cache-control.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int): User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__cache-control.md_merged.snap b/tests/snapshots/execution_spec__cache-control.md_merged.snap deleted file mode 100644 index 7d26f247b3..0000000000 --- a/tests/snapshots/execution_spec__cache-control.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {cacheControl: true}) @upstream { - query: Query -} - -type Query { - user(id: Int): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{args.id}}"}]) -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__caching-collision.md_assert_0.snap b/tests/snapshots/execution_spec__caching-collision.md_assert_0.snap deleted file mode 100644 index 5aa7c651c5..0000000000 --- a/tests/snapshots/execution_spec__caching-collision.md_assert_0.snap +++ /dev/null @@ -1,616 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "bars": [ - { - "foo": { - "id": 0 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBZh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 1 - }, - "id": "ByVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 2 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SE3mXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 3 - }, - "id": "BEVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 4 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DFPDXIwHe" - }, - { - "foo": { - "id": 5 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSoYIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 6 - }, - "id": "BVVLvrvaKTxZigeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 7 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEomXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 8 - }, - "id": "BVVLvrvaKFxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 9 - }, - "id": "BVVLvrvaKTxZdgeFvePbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 10 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jsz1qh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 11 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ5f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 12 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYftglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 13 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQ7YUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 14 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqp8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 15 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 16 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtHlFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 17 - }, - "id": "BVVLvrvaKTxZdgeFvbPbczXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 18 - }, - "id": "BVVLvrvaKTxZdgeF6bPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 19 - }, - "id": "BVVLvrvaKTxZdgeFGbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 20 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSxrIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 21 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSo9IxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 22 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjrXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 23 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FtO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 24 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3n2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 25 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FoO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 26 - }, - "id": "BVVLvVvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 27 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3VpzFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 28 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoumL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 29 - }, - "id": "BVVLvrvaKTYZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 30 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtgRFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 31 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sfZV2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 32 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwKe" - }, - { - "foo": { - "id": 33 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jjzyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 34 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmcWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 35 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFw4i4DNPDXIwHe" - }, - { - "foo": { - "id": 36 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL3345FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 37 - }, - "id": "BVVLvrvaKTxZdgaFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 38 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImR33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 39 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXRorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 40 - }, - "id": "BVVLvrvfKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 41 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQIf7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 42 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnOImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 43 - }, - "id": "BVVLvrvaKTxZdgeFvbPmckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 44 - }, - "id": "BVVLvrvaKTxZdgeFvbPbc9XSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 45 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3q7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 46 - }, - "id": "BVVLvrvaKTxZdgeFkbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 47 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoTmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 48 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIFmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 49 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33d5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 50 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSosIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 51 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SVjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 52 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4JszyJh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 53 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFhoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 54 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSSrIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 55 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Za6x1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 56 - }, - "id": "BVVLvrvaKTxZdgeFwbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 57 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SIjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 58 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImt33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 59 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoIwL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 60 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdw4DNPDXIwHe" - }, - { - "foo": { - "id": 61 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4J6zyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 62 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jskyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 63 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2NFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 64 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorFxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 65 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25yXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 66 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4lszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 67 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFmdi4DNPDXIwHe" - }, - { - "foo": { - "id": 68 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jsjyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 69 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sfXV2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 70 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYe25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 71 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSogIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 72 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33n5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 73 - }, - "id": "BVVLvrvaKTxZqgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 74 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwJi4DNPDXIwHe" - }, - { - "foo": { - "id": 75 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoKmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 76 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FY625TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 77 - }, - "id": "BVVLvrvaKTzZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 78 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoIFL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 79 - }, - "id": "BVVLvrvNKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 80 - }, - "id": "BVVLvrvaKTMZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 81 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFyoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 82 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3VqzFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 83 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4oszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 84 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDHIwHe" - }, - { - "foo": { - "id": 85 - }, - "id": "BVVLvrvaKvxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 86 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1yf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 87 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f8Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 88 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25rXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 89 - }, - "id": "BVVLvrvaKTxZdgPFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 90 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi45NPDXIwHe" - }, - { - "foo": { - "id": 91 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQHf7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 92 - }, - "id": "BVVLvrvaKTxZdgeFvbPb9kXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 93 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnonmL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 94 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUhkJszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 95 - }, - "id": "BVVLvrvFKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 96 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtglFnoImL33F5SYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 97 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Pszyqh8SEjmXWIQmYUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 98 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmYUtgHFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - }, - { - "foo": { - "id": 99 - }, - "id": "BVVLvrvaKTxZdgeFvbPbckXSorIxBUh4Jszyqh8SEjmXWIQmIUtglFnoImL33F5FYO25TXzQ3f7Zamx1sf3V2zFwdi4DNPDXIwHe" - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__caching-collision.md_client.snap b/tests/snapshots/execution_spec__caching-collision.md_client.snap deleted file mode 100644 index d22ceed81c..0000000000 --- a/tests/snapshots/execution_spec__caching-collision.md_client.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Bar { - foo: Foo - id: String! -} - -scalar Date - -scalar Email - -scalar Empty - -type Foo { - id: Int! -} - -scalar JSON - -scalar PhoneNumber - -type Query { - bars: [Bar] -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__caching-collision.md_merged.snap b/tests/snapshots/execution_spec__caching-collision.md_merged.snap deleted file mode 100644 index 0e0ac7e319..0000000000 --- a/tests/snapshots/execution_spec__caching-collision.md_merged.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Bar { - foo: Foo @http(path: "/foo?id={{value.id}}") @cache(maxAge: 300) - id: String! -} - -type Foo { - id: Int! -} - -type Query @cache(maxAge: 100) { - bars: [Bar] @http(path: "/bars") -} diff --git a/tests/snapshots/execution_spec__caching.md_assert_0.snap b/tests/snapshots/execution_spec__caching.md_assert_0.snap deleted file mode 100644 index e793e96b14..0000000000 --- a/tests/snapshots/execution_spec__caching.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "fieldCache": { - "id": 1 - } - } - } -} diff --git a/tests/snapshots/execution_spec__caching.md_assert_1.snap b/tests/snapshots/execution_spec__caching.md_assert_1.snap deleted file mode 100644 index c158551d3d..0000000000 --- a/tests/snapshots/execution_spec__caching.md_assert_1.snap +++ /dev/null @@ -1,47 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "fieldCache": { - "id": 1 - }, - "fieldCacheList": [ - { - "id": 1 - }, - { - "id": 2 - }, - { - "id": 3 - } - ], - "typeCache": { - "a": { - "id": 11 - }, - "b": { - "id": 21 - }, - "list": [ - { - "id": 31 - }, - { - "id": 32 - }, - { - "id": 33 - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__caching.md_assert_2.snap b/tests/snapshots/execution_spec__caching.md_assert_2.snap deleted file mode 100644 index c158551d3d..0000000000 --- a/tests/snapshots/execution_spec__caching.md_assert_2.snap +++ /dev/null @@ -1,47 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "fieldCache": { - "id": 1 - }, - "fieldCacheList": [ - { - "id": 1 - }, - { - "id": 2 - }, - { - "id": 3 - } - ], - "typeCache": { - "a": { - "id": 11 - }, - "b": { - "id": 21 - }, - "list": [ - { - "id": 31 - }, - { - "id": 32 - }, - { - "id": 33 - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__caching.md_client.snap b/tests/snapshots/execution_spec__caching.md_client.snap deleted file mode 100644 index 4184399572..0000000000 --- a/tests/snapshots/execution_spec__caching.md_client.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - fieldCache: Type - fieldCacheList: [Type] - typeCache: TypeCache -} - -type Type { - id: Int -} - -type TypeCache { - a: Type - b: Type - list: [Type] -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__caching.md_merged.snap b/tests/snapshots/execution_spec__caching.md_merged.snap deleted file mode 100644 index 141c0ff2e2..0000000000 --- a/tests/snapshots/execution_spec__caching.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Query { - fieldCache: Type @http(path: "/field-cache") @cache(maxAge: 30000) - fieldCacheList: [Type] @http(path: "/field-cache-list") @cache(maxAge: 30000) - typeCache: TypeCache -} - -type Type { - id: Int -} - -type TypeCache @cache(maxAge: 1000) { - a: Type @http(path: "/type-cache-a") - b: Type @http(path: "/type-cache-b") - list: [Type] @http(path: "/type-cache-list") -} diff --git a/tests/snapshots/execution_spec__call-graphql-datasource.md_assert_0.snap b/tests/snapshots/execution_spec__call-graphql-datasource.md_assert_0.snap deleted file mode 100644 index a225bd7fb9..0000000000 --- a/tests/snapshots/execution_spec__call-graphql-datasource.md_assert_0.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "title": "a", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "b", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "c", - "user": { - "name": "Ervin Howell" - } - }, - { - "title": "d", - "user": { - "name": "Ervin Howell" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-graphql-datasource.md_client.snap b/tests/snapshots/execution_spec__call-graphql-datasource.md_client.snap deleted file mode 100644 index 284c9f66fb..0000000000 --- a/tests/snapshots/execution_spec__call-graphql-datasource.md_client.snap +++ /dev/null @@ -1,41 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String! - id: Int! - title: String! - user(id: Int): User - userId: Int! -} - -type Query { - posts: [Post] - user(id: Int!): User -} - -scalar Url - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__call-graphql-datasource.md_merged.snap b/tests/snapshots/execution_spec__call-graphql-datasource.md_merged.snap deleted file mode 100644 index 5317f0d432..0000000000 --- a/tests/snapshots/execution_spec__call-graphql-datasource.md_merged.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { - query: Query -} - -type Post { - body: String! - id: Int! - title: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts") - user(id: Int!): User @graphQL(args: [{key: "id", value: "{{args.id}}"}], baseURL: "http://upstream/graphql", name: "user") -} - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String -} diff --git a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_assert_0.snap b/tests/snapshots/execution_spec__call-multiple-steps-piping.md_assert_0.snap deleted file mode 100644 index 3303eba69f..0000000000 --- a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "abc_input": 3 - } - } -} diff --git a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_assert_1.snap b/tests/snapshots/execution_spec__call-multiple-steps-piping.md_assert_1.snap deleted file mode 100644 index 5796f20b8a..0000000000 --- a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_assert_1.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "abc": 3 - } - } -} diff --git a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_client.snap b/tests/snapshots/execution_spec__call-multiple-steps-piping.md_client.snap deleted file mode 100644 index 1d35d1781c..0000000000 --- a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_client.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - a(input: JSON): JSON - a_input(input: JSON): JSON - abc(input: JSON): JSON - abc_input(input: JSON): JSON - b(input: JSON): JSON - b_input(input: JSON): JSON - c(input: JSON): JSON - wrap_args: JSON - wrap_input(input: JSON): JSON -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_merged.snap b/tests/snapshots/execution_spec__call-multiple-steps-piping.md_merged.snap deleted file mode 100644 index ece3bee836..0000000000 --- a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_merged.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - a(input: JSON): JSON @expr(body: "{{args.input.a}}") - a_input(input: JSON): JSON @expr(body: {input: "{{args.input.a}}"}) - abc(input: JSON): JSON @call(steps: [{query: "a", args: {input: "{{args.input}}"}}, {query: "wrap_args"}, {query: "b"}, {query: "wrap_args"}, {query: "c"}]) - abc_input(input: JSON): JSON @call(steps: [{query: "wrap_input", args: {input: "{{args.input}}"}}, {query: "a_input"}, {query: "wrap_input"}, {query: "b_input"}, {query: "wrap_input"}, {query: "c"}]) - b(input: JSON): JSON @expr(body: "{{args.input.b}}") - b_input(input: JSON): JSON @expr(body: {input: "{{args.input.b}}"}) - c(input: JSON): JSON @expr(body: "{{args.input.c}}") - wrap_args: JSON @expr(body: {input: "{{args}}"}) - wrap_input(input: JSON): JSON @expr(body: {input: "{{args.input}}"}) -} diff --git a/tests/snapshots/execution_spec__call-mutation.md_assert_0.snap b/tests/snapshots/execution_spec__call-mutation.md_assert_0.snap deleted file mode 100644 index 3d78c855be..0000000000 --- a/tests/snapshots/execution_spec__call-mutation.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "insertPost": { - "body": "post-body" - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-mutation.md_assert_1.snap b/tests/snapshots/execution_spec__call-mutation.md_assert_1.snap deleted file mode 100644 index 3a76bb8893..0000000000 --- a/tests/snapshots/execution_spec__call-mutation.md_assert_1.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "firstUser": { - "posts": [ - { - "title": "post1-title" - }, - { - "title": "post2-title" - }, - { - "title": "post3-title" - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-mutation.md_assert_2.snap b/tests/snapshots/execution_spec__call-mutation.md_assert_2.snap deleted file mode 100644 index d4f83b0a6c..0000000000 --- a/tests/snapshots/execution_spec__call-mutation.md_assert_2.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "attachPostToFirstUser": { - "name": "foo" - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-mutation.md_assert_3.snap b/tests/snapshots/execution_spec__call-mutation.md_assert_3.snap deleted file mode 100644 index 835e659056..0000000000 --- a/tests/snapshots/execution_spec__call-mutation.md_assert_3.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "insertPostToFirstUser": { - "body": "post-body" - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-mutation.md_assert_4.snap b/tests/snapshots/execution_spec__call-mutation.md_assert_4.snap deleted file mode 100644 index 7ca89a4e51..0000000000 --- a/tests/snapshots/execution_spec__call-mutation.md_assert_4.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "insertMockedPost": { - "body": "post-body" - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-mutation.md_client.snap b/tests/snapshots/execution_spec__call-mutation.md_client.snap deleted file mode 100644 index fc2aa7d84a..0000000000 --- a/tests/snapshots/execution_spec__call-mutation.md_client.snap +++ /dev/null @@ -1,59 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type Mutation { - attachPostToFirstUser(postId: Int, userId: Int): User - attachPostToUser(postId: Int!, userId: Int!): User - insertMockedPost(input: PostInput): Post - insertPost(input: PostInput): Post - insertPostToFirstUser(input: PostInputWithoutUserId, userId: Int): Post - insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post -} - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - userId: Int -} - -input PostInput { - body: String - title: String - userId: Int -} - -input PostInputWithoutUserId { - body: String - title: String - userId: Int -} - -type Query { - firstUser: User - postFromUser(userId: Int!): Post -} - -scalar Url - -type User { - id: Int - name: String - posts(userId: Int): [Post] -} - -schema { - query: Query - mutation: Mutation -} diff --git a/tests/snapshots/execution_spec__call-mutation.md_merged.snap b/tests/snapshots/execution_spec__call-mutation.md_merged.snap deleted file mode 100644 index c85f7067b6..0000000000 --- a/tests/snapshots/execution_spec__call-mutation.md_merged.snap +++ /dev/null @@ -1,47 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query - mutation: Mutation -} - -input PostInput { - body: String - title: String - userId: Int -} - -input PostInputWithoutUserId { - body: String - title: String - userId: Int -} - -type Mutation { - attachPostToFirstUser(postId: Int!): User @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{args.postId}}", userId: 1}}]) - attachPostToUser(postId: Int!, userId: Int!): User @http(body: "{\"postId\":{{args.postId}}}", method: "PATCH", path: "/users/{{args.userId}}") - insertMockedPost: Post @call(steps: [{mutation: "insertPost", args: {input: {body: "post-body", title: "post-title", userId: 1}}}]) - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") - insertPostToFirstUser(input: PostInputWithoutUserId): Post @call(steps: [{mutation: "insertPostToUser", args: {input: "{{args.input}}", userId: 1}}]) - insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post @http(body: "{{args.input}}", method: "POST", path: "/users/{{args.userId}}/posts") -} - -type Post { - body: String - id: Int - title: String - userId: Int -} - -type Query { - firstUser: User @http(path: "/users/1") - postFromUser(userId: Int!): Post @http(path: "/posts?userId={{args.userId}}") -} - -type User { - id: Int - name: String - posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{value.id}}"}}]) -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_0.snap b/tests/snapshots/execution_spec__call-operator.md_assert_0.snap deleted file mode 100644 index 1c66149129..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_0.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "user": { - "name": "foo" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_1.snap b/tests/snapshots/execution_spec__call-operator.md_assert_1.snap deleted file mode 100644 index cc3001b654..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_1.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "user1": { - "name": "foo" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_10.snap b/tests/snapshots/execution_spec__call-operator.md_assert_10.snap deleted file mode 100644 index e5000b46b8..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_10.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "news": { - "news": [ - { - "id": 1 - }, - { - "id": 2 - } - ] - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_11.snap b/tests/snapshots/execution_spec__call-operator.md_assert_11.snap deleted file mode 100644 index 4e597f1483..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_11.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "newsWithPortArg": { - "news": [ - { - "id": 1 - }, - { - "id": 2 - } - ] - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_12.snap b/tests/snapshots/execution_spec__call-operator.md_assert_12.snap deleted file mode 100644 index 4efab928b1..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_12.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "newsWithPortArg": { - "news": [ - { - "id": 1 - }, - { - "id": 2 - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_2.snap b/tests/snapshots/execution_spec__call-operator.md_assert_2.snap deleted file mode 100644 index 1847d21126..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_2.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "userFromValue": { - "name": "foo" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_3.snap b/tests/snapshots/execution_spec__call-operator.md_assert_3.snap deleted file mode 100644 index a3d0e94825..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_3.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "userGraphQLHeaders": { - "name": "Leanne Graham" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_4.snap b/tests/snapshots/execution_spec__call-operator.md_assert_4.snap deleted file mode 100644 index a3d0e94825..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_4.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "userGraphQLHeaders": { - "name": "Leanne Graham" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_5.snap b/tests/snapshots/execution_spec__call-operator.md_assert_5.snap deleted file mode 100644 index 7ab7c5fe98..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_5.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "userHttpHeaders": { - "name": "Leanne Graham http headers" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_6.snap b/tests/snapshots/execution_spec__call-operator.md_assert_6.snap deleted file mode 100644 index b5d6ba9f8b..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_6.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "userHttpQuery": { - "name": "Leanne Graham http query" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_7.snap b/tests/snapshots/execution_spec__call-operator.md_assert_7.snap deleted file mode 100644 index fb0e7a0ddc..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_7.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "userPosts": [ - { - "title": "bar" - }, - { - "title": "qux" - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_8.snap b/tests/snapshots/execution_spec__call-operator.md_assert_8.snap deleted file mode 100644 index 2da02e70d2..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_8.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "userWithPosts": { - "posts": [ - { - "title": "bar" - }, - { - "title": "qux" - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_assert_9.snap b/tests/snapshots/execution_spec__call-operator.md_assert_9.snap deleted file mode 100644 index 93c8d4001e..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_assert_9.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "news": { - "news": [ - { - "id": 1 - }, - { - "id": 2 - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__call-operator.md_client.snap b/tests/snapshots/execution_spec__call-operator.md_client.snap deleted file mode 100644 index 013632b707..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_client.snap +++ /dev/null @@ -1,77 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -scalar PhoneNumber - -type Post { - body: String - id: Int - news: NewsData! - newsWithPortArg: NewsData! - title: String - user(id: Int): User - user1: User - userFromValue: User - userGraphQL(id: Int): User - userGraphQLHeaders(id: Int): User - userHttpHeaders(id: ID): User - userHttpQuery(id: ID): User - userId: Int! -} - -type Query { - news: NewsData! - newsWithPortArg(port: Int!): NewsData! - posts: [Post] - user(id: Int!): User - user1: User - userFromValue: User - userGraphQL(id: Int): User - userGraphQLHeaders(id: Int!): User - userHttpHeaders(id: ID!): User - userHttpQuery(id: ID!): User - userId: Int! - userPosts(id: ID!): [Post] - userWithPosts: UserWithPosts -} - -scalar Url - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String -} - -type UserWithPosts { - id: Int! - name: String! - posts(id: ID): [Post] -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__call-operator.md_merged.snap b/tests/snapshots/execution_spec__call-operator.md_merged.snap deleted file mode 100644 index 21fa63dad4..0000000000 --- a/tests/snapshots/execution_spec__call-operator.md_merged.snap +++ /dev/null @@ -1,65 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -type Post { - body: String - id: Int - news: NewsData! @call(steps: [{query: "news"}]) - newsWithPortArg: NewsData! @call(steps: [{query: "news", args: {port: 50051}}]) - title: String - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) - user1: User @call(steps: [{query: "user1"}]) - userFromValue: User @call(steps: [{query: "userFromValue"}]) - userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{value.userId}}"}}]) - userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{value.userId}}"}}]) - userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{value.userId}}"}}]) - userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{value.userId}}"}}]) - userId: Int! -} - -type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") - newsWithPortArg(port: Int!): NewsData! @grpc(baseURL: "http://localhost:{{args.port}}", method: "news.NewsService.GetAllNews") - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") - user1: User @http(path: "/users/1") - userFromValue: User @http(path: "/users/{{value.userId}}") - userGraphQL(id: Int): User @graphQL(args: [{key: "id", value: "{{args.id}}"}], baseURL: "http://upstream/graphql", name: "user") - userGraphQLHeaders(id: Int!): User @graphQL(baseURL: "http://upstream/graphql", headers: [{key: "id", value: "{{args.id}}"}], name: "user") - userHttpHeaders(id: ID!): User @http(headers: [{key: "id", value: "{{args.id}}"}], path: "/users") - userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}]) - userId: Int! @expr(body: 2) - userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{args.id}}"}]) - userWithPosts: UserWithPosts @http(path: "/users/1") -} - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String -} - -type UserWithPosts { - id: Int! - name: String! - posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{value.id}}"}}]) -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-false.md_assert_0.snap b/tests/snapshots/execution_spec__cors-allow-cred-false.md_assert_0.snap deleted file mode 100644 index e08057de7f..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-false.md_assert_0.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "access-control-allow-headers": "Authorization", - "access-control-allow-methods": "POST, OPTIONS", - "access-control-max-age": "23", - "vary": "origin, access-control-request-method, access-control-request-headers" - }, - "body": null -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-false.md_client.snap b/tests/snapshots/execution_spec__cors-allow-cred-false.md_client.snap deleted file mode 100644 index 48b4b87db4..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-false.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - val: Int -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-false.md_merged.snap b/tests/snapshots/execution_spec__cors-allow-cred-false.md_merged.snap deleted file mode 100644 index 9e105b4f23..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-false.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {cors: {allowHeaders: ["Authorization"], allowMethods: ["POST", "OPTIONS"], allowOrigins: ["abc.com", "xyz.com"], allowPrivateNetwork: true, maxAge: 23, vary: ["origin", "access-control-request-method", "access-control-request-headers"]}}) @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Query { - val: Int @expr(body: 1) -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-true.md_assert_0.snap b/tests/snapshots/execution_spec__cors-allow-cred-true.md_assert_0.snap deleted file mode 100644 index 459b7941a2..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-true.md_assert_0.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "access-control-allow-credentials": "true", - "access-control-allow-methods": "OPTIONS, POST, GET", - "access-control-max-age": "23", - "vary": "origin, access-control-request-method, access-control-request-headers" - }, - "body": null -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-true.md_client.snap b/tests/snapshots/execution_spec__cors-allow-cred-true.md_client.snap deleted file mode 100644 index 48b4b87db4..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-true.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - val: Int -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-true.md_merged.snap b/tests/snapshots/execution_spec__cors-allow-cred-true.md_merged.snap deleted file mode 100644 index eaeef0f412..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-true.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {cors: {allowCredentials: true, allowMethods: ["OPTIONS", "POST", "GET"], allowOrigins: ["abc.com", "xyz.com"], exposeHeaders: [""], maxAge: 23, vary: ["origin", "access-control-request-method", "access-control-request-headers"]}}) @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Query { - val: Int @expr(body: 1) -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-vary.md_assert_0.snap b/tests/snapshots/execution_spec__cors-allow-cred-vary.md_assert_0.snap deleted file mode 100644 index e20d306310..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-vary.md_assert_0.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "access-control-allow-credentials": "true", - "access-control-expose-headers": "", - "content-type": "application/json", - "vary": "origin, access-control-request-method, access-control-request-headers" - }, - "body": { - "data": { - "val": 1 - } - } -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-vary.md_client.snap b/tests/snapshots/execution_spec__cors-allow-cred-vary.md_client.snap deleted file mode 100644 index 48b4b87db4..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-vary.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - val: Int -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__cors-allow-cred-vary.md_merged.snap b/tests/snapshots/execution_spec__cors-allow-cred-vary.md_merged.snap deleted file mode 100644 index eaeef0f412..0000000000 --- a/tests/snapshots/execution_spec__cors-allow-cred-vary.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {cors: {allowCredentials: true, allowMethods: ["OPTIONS", "POST", "GET"], allowOrigins: ["abc.com", "xyz.com"], exposeHeaders: [""], maxAge: 23, vary: ["origin", "access-control-request-method", "access-control-request-headers"]}}) @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Query { - val: Int @expr(body: 1) -} diff --git a/tests/snapshots/execution_spec__custom-headers.md_assert_0.snap b/tests/snapshots/execution_spec__custom-headers.md_assert_0.snap deleted file mode 100644 index 235aef02a4..0000000000 --- a/tests/snapshots/execution_spec__custom-headers.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json", - "x-id": "1", - "x-name": "John Doe" - }, - "body": { - "data": { - "greet": "Hello World!" - } - } -} diff --git a/tests/snapshots/execution_spec__custom-headers.md_client.snap b/tests/snapshots/execution_spec__custom-headers.md_client.snap deleted file mode 100644 index 14b224be11..0000000000 --- a/tests/snapshots/execution_spec__custom-headers.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - greet: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__custom-headers.md_merged.snap b/tests/snapshots/execution_spec__custom-headers.md_merged.snap deleted file mode 100644 index 747626e649..0000000000 --- a/tests/snapshots/execution_spec__custom-headers.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {custom: [{key: "x-id", value: "1"}, {key: "x-name", value: "John Doe"}]}) @upstream { - query: Query -} - -type Query { - greet: String @expr(body: "Hello World!") -} diff --git a/tests/snapshots/execution_spec__env-value.md_assert_0.snap b/tests/snapshots/execution_spec__env-value.md_assert_0.snap deleted file mode 100644 index b232cce8f1..0000000000 --- a/tests/snapshots/execution_spec__env-value.md_assert_0.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "post1": { - "id": 1, - "title": "Post 1", - "body": "Post 1 body", - "userId": 1 - }, - "post2": { - "id": 2, - "title": "Post 2", - "body": "Post 2 body", - "userId": 2 - }, - "post3": { - "id": 3, - "title": "Post 3", - "body": "Post 3 body", - "userId": 3 - } - } - } -} diff --git a/tests/snapshots/execution_spec__env-value.md_client.snap b/tests/snapshots/execution_spec__env-value.md_client.snap deleted file mode 100644 index d35d947756..0000000000 --- a/tests/snapshots/execution_spec__env-value.md_client.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - userId: Int! -} - -type Query { - post1: Post - post2: Post - post3: Post -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__env-value.md_merged.snap b/tests/snapshots/execution_spec__env-value.md_merged.snap deleted file mode 100644 index ca15fd8859..0000000000 --- a/tests/snapshots/execution_spec__env-value.md_merged.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Post { - body: String - id: Int - title: String - userId: Int! -} - -type Query { - post1: Post @http(path: "/posts/{{env.ID}}") - post2: Post @http(path: "/posts/{{env.POST_ID}}") - post3: Post @http(path: "/posts/{{env.NESTED_POST_ID}}") -} diff --git a/tests/snapshots/execution_spec__experimental-headers.md_assert_0.snap b/tests/snapshots/execution_spec__experimental-headers.md_assert_0.snap deleted file mode 100644 index 768f30d2d9..0000000000 --- a/tests/snapshots/execution_spec__experimental-headers.md_assert_0.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json", - "x-experimental": "experimental-header", - "x-tailcall": "tailcall-header" - }, - "body": { - "data": { - "users": [ - { - "id": 1, - "name": "Leanne Graham" - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__experimental-headers.md_client.snap b/tests/snapshots/execution_spec__experimental-headers.md_client.snap deleted file mode 100644 index 42fce3979b..0000000000 --- a/tests/snapshots/execution_spec__experimental-headers.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - users: [User] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__experimental-headers.md_merged.snap b/tests/snapshots/execution_spec__experimental-headers.md_merged.snap deleted file mode 100644 index 60411da506..0000000000 --- a/tests/snapshots/execution_spec__experimental-headers.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {experimental: ["X-experimental", "x-tailcall"]}) @upstream { - query: Query -} - -type Query { - users: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_assert_0.snap b/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_assert_0.snap deleted file mode 100644 index a225bd7fb9..0000000000 --- a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_assert_0.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "title": "a", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "b", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "c", - "user": { - "name": "Ervin Howell" - } - }, - { - "title": "d", - "user": { - "name": "Ervin Howell" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_client.snap b/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_client.snap deleted file mode 100644 index 8e25456c09..0000000000 --- a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_client.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int - title: String - user: User - userId: Int -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_merged.snap b/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_merged.snap deleted file mode 100644 index 0233e475c9..0000000000 --- a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { - query: Query -} - -type Post { - id: Int - title: String - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], baseURL: "http://upstream/graphql", batch: true, name: "user") - userId: Int -} - -type Query { - posts: [Post] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_assert_0.snap b/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_assert_0.snap deleted file mode 100644 index a225bd7fb9..0000000000 --- a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_assert_0.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "title": "a", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "b", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "c", - "user": { - "name": "Ervin Howell" - } - }, - { - "title": "d", - "user": { - "name": "Ervin Howell" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_client.snap b/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_client.snap deleted file mode 100644 index 8e25456c09..0000000000 --- a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_client.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int - title: String - user: User - userId: Int -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_merged.snap b/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_merged.snap deleted file mode 100644 index bbb7b14331..0000000000 --- a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { - query: Query -} - -type Post { - id: Int - title: String - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], baseURL: "http://upstream/graphql", name: "user") - userId: Int -} - -type Query { - posts: [Post] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-errors.md_assert_0.snap b/tests/snapshots/execution_spec__graphql-datasource-errors.md_assert_0.snap deleted file mode 100644 index 5e4910e7ab..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-errors.md_assert_0.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": null - } - }, - "errors": [ - { - "message": "Failed to resolve user", - "locations": [ - { - "line": 1, - "column": 9 - } - ], - "path": [ - "user" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-errors.md_assert_1.snap b/tests/snapshots/execution_spec__graphql-datasource-errors.md_assert_1.snap deleted file mode 100644 index d983fdbd76..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-errors.md_assert_1.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": null, - "id": 2 - } - }, - "errors": [ - { - "message": "Failed to resolve name", - "locations": [ - { - "line": 1, - "column": 35 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-errors.md_client.snap b/tests/snapshots/execution_spec__graphql-datasource-errors.md_client.snap deleted file mode 100644 index 89319b393a..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-errors.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int): User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-errors.md_merged.snap b/tests/snapshots/execution_spec__graphql-datasource-errors.md_merged.snap deleted file mode 100644 index abe03e4cc6..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-errors.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - user(id: Int): User @graphQL(args: [{key: "id", value: "{{args.id}}"}], baseURL: "http://upstream/graphql", name: "user") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_assert_0.snap b/tests/snapshots/execution_spec__graphql-datasource-mutation.md_assert_0.snap deleted file mode 100644 index 97ad7a4f99..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "createUser": { - "name": "Test Name" - } - } - } -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_client.snap b/tests/snapshots/execution_spec__graphql-datasource-mutation.md_client.snap deleted file mode 100644 index 3845056745..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_client.snap +++ /dev/null @@ -1,39 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type Mutation { - createUser(user: UserInput!): User -} - -scalar PhoneNumber - -type Query { - users: [User] -} - -scalar Url - -type User { - id: Int - name: String -} - -input UserInput { - email: String! - name: String! - phone: String -} - -schema { - query: Query - mutation: Mutation -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_merged.snap b/tests/snapshots/execution_spec__graphql-datasource-mutation.md_merged.snap deleted file mode 100644 index 53e6c764c7..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_merged.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query - mutation: Mutation -} - -input UserInput { - email: String! - name: String! - phone: String -} - -type Mutation { - createUser(user: UserInput!): User @graphQL(args: [{key: "user", value: "{{args.user}}"}], baseURL: "http://upstream/graphql", name: "createUser") -} - -type Query { - users: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-no-args.md_assert_0.snap b/tests/snapshots/execution_spec__graphql-datasource-no-args.md_assert_0.snap deleted file mode 100644 index 91f1cbd53b..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-no-args.md_assert_0.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "users_list": [ - { - "name": "Leanne Graham" - }, - { - "name": "Ervin Howell" - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-no-args.md_client.snap b/tests/snapshots/execution_spec__graphql-datasource-no-args.md_client.snap deleted file mode 100644 index 98911cf9c6..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-no-args.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - users_list: [User] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-no-args.md_merged.snap b/tests/snapshots/execution_spec__graphql-datasource-no-args.md_merged.snap deleted file mode 100644 index bc23a3c9fb..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-no-args.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - users_list: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_assert_0.snap b/tests/snapshots/execution_spec__graphql-datasource-with-args.md_assert_0.snap deleted file mode 100644 index b438022b0f..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": "Leanne Graham" - } - } - } -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_assert_1.snap b/tests/snapshots/execution_spec__graphql-datasource-with-args.md_assert_1.snap deleted file mode 100644 index 519a90479e..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_assert_1.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "post": { - "id": 1, - "user": { - "name": "Leanne Graham" - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_client.snap b/tests/snapshots/execution_spec__graphql-datasource-with-args.md_client.snap deleted file mode 100644 index 06aac8d40c..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_client.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int - user: User -} - -type Query { - post(id: Int): Post - user(id: Int): User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_merged.snap b/tests/snapshots/execution_spec__graphql-datasource-with-args.md_merged.snap deleted file mode 100644 index 1d09478d9d..0000000000 --- a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Post { - id: Int - user: User -} - -type Query { - post(id: Int): Post @graphQL(args: [{key: "id", value: "{{args.id}}"}], baseURL: "http://upstream/graphql", name: "post") - user(id: Int): User @graphQL(args: [{key: "id", value: "{{args.id}}"}], baseURL: "http://upstream/graphql", name: "user") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__grpc-batch.md_assert_0.snap b/tests/snapshots/execution_spec__grpc-batch.md_assert_0.snap deleted file mode 100644 index eff3d79f5a..0000000000 --- a/tests/snapshots/execution_spec__grpc-batch.md_assert_0.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "newsById2": { - "title": "Note 2" - }, - "newsById3": { - "title": "Note 3" - } - } - } -} diff --git a/tests/snapshots/execution_spec__grpc-batch.md_client.snap b/tests/snapshots/execution_spec__grpc-batch.md_client.snap deleted file mode 100644 index 5d27fe0949..0000000000 --- a/tests/snapshots/execution_spec__grpc-batch.md_client.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -scalar PhoneNumber - -type Query { - news: NewsData! - newsById(news: NewsInput!): News! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__grpc-batch.md_merged.snap b/tests/snapshots/execution_spec__grpc-batch.md_merged.snap deleted file mode 100644 index f8ae25bf7e..0000000000 --- a/tests/snapshots/execution_spec__grpc-batch.md_merged.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream(batch: {delay: 10, headers: [], maxSize: 100}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") -} diff --git a/tests/snapshots/execution_spec__grpc-error.md_assert_0.snap b/tests/snapshots/execution_spec__grpc-error.md_assert_0.snap deleted file mode 100644 index 089e1439d2..0000000000 --- a/tests/snapshots/execution_spec__grpc-error.md_assert_0.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "gRPC Error: status: 3, description: `Client specified an invalid argument`, message: `grpc message`", - "locations": [ - { - "line": 1, - "column": 9 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__grpc-error.md_client.snap b/tests/snapshots/execution_spec__grpc-error.md_client.snap deleted file mode 100644 index 5d27fe0949..0000000000 --- a/tests/snapshots/execution_spec__grpc-error.md_client.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -scalar PhoneNumber - -type Query { - news: NewsData! - newsById(news: NewsInput!): News! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__grpc-error.md_merged.snap b/tests/snapshots/execution_spec__grpc-error.md_merged.snap deleted file mode 100644 index cbe04640ea..0000000000 --- a/tests/snapshots/execution_spec__grpc-error.md_merged.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream(batch: {delay: 10, headers: [], maxSize: 100}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{args.news}}", method: "news.NewsService.GetNews") -} diff --git a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_assert_0.snap b/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_assert_0.snap deleted file mode 100644 index 93c8d4001e..0000000000 --- a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_assert_0.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "news": { - "news": [ - { - "id": 1 - }, - { - "id": 2 - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_client.snap b/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_client.snap deleted file mode 100644 index 5d27fe0949..0000000000 --- a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_client.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -scalar PhoneNumber - -type Query { - news: NewsData! - newsById(news: NewsInput!): News! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_merged.snap b/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_merged.snap deleted file mode 100644 index bae43667cc..0000000000 --- a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_merged.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://not-a-valid-grpc-url.com", batch: {delay: 10, headers: [], maxSize: 100}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{args.news}}", method: "news.NewsService.GetNews") -} diff --git a/tests/snapshots/execution_spec__grpc-simple.md_assert_0.snap b/tests/snapshots/execution_spec__grpc-simple.md_assert_0.snap deleted file mode 100644 index 93c8d4001e..0000000000 --- a/tests/snapshots/execution_spec__grpc-simple.md_assert_0.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "news": { - "news": [ - { - "id": 1 - }, - { - "id": 2 - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__grpc-simple.md_client.snap b/tests/snapshots/execution_spec__grpc-simple.md_client.snap deleted file mode 100644 index 5d27fe0949..0000000000 --- a/tests/snapshots/execution_spec__grpc-simple.md_client.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -scalar PhoneNumber - -type Query { - news: NewsData! - newsById(news: NewsInput!): News! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__grpc-simple.md_merged.snap b/tests/snapshots/execution_spec__grpc-simple.md_merged.snap deleted file mode 100644 index cbe04640ea..0000000000 --- a/tests/snapshots/execution_spec__grpc-simple.md_merged.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream(batch: {delay: 10, headers: [], maxSize: 100}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{args.news}}", method: "news.NewsService.GetNews") -} diff --git a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_assert_0.snap b/tests/snapshots/execution_spec__grpc-url-from-upstream.md_assert_0.snap deleted file mode 100644 index 93c8d4001e..0000000000 --- a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_assert_0.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "news": { - "news": [ - { - "id": 1 - }, - { - "id": 2 - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_client.snap b/tests/snapshots/execution_spec__grpc-url-from-upstream.md_client.snap deleted file mode 100644 index 5d27fe0949..0000000000 --- a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_client.snap +++ /dev/null @@ -1,42 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -scalar PhoneNumber - -type Query { - news: NewsData! - newsById(news: NewsInput!): News! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_merged.snap b/tests/snapshots/execution_spec__grpc-url-from-upstream.md_merged.snap deleted file mode 100644 index aa679b9369..0000000000 --- a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_merged.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 100}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{args.news}}", method: "news.NewsService.GetNews") -} diff --git a/tests/snapshots/execution_spec__https.md_assert_0.snap b/tests/snapshots/execution_spec__https.md_assert_0.snap deleted file mode 100644 index 0204fa30dc..0000000000 --- a/tests/snapshots/execution_spec__https.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "firstUser": { - "name": "Leanne Graham" - } - } - } -} diff --git a/tests/snapshots/execution_spec__https.md_client.snap b/tests/snapshots/execution_spec__https.md_client.snap deleted file mode 100644 index 2ae445a996..0000000000 --- a/tests/snapshots/execution_spec__https.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - firstUser: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__https.md_merged.snap b/tests/snapshots/execution_spec__https.md_merged.snap deleted file mode 100644 index cec4e53890..0000000000 --- a/tests/snapshots/execution_spec__https.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - firstUser: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__inline-field.md_assert_0.snap b/tests/snapshots/execution_spec__inline-field.md_assert_0.snap deleted file mode 100644 index d6c346a175..0000000000 --- a/tests/snapshots/execution_spec__inline-field.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "address": "-37.3159" - } - } - } -} diff --git a/tests/snapshots/execution_spec__inline-field.md_client.snap b/tests/snapshots/execution_spec__inline-field.md_client.snap deleted file mode 100644 index e0ba3147d9..0000000000 --- a/tests/snapshots/execution_spec__inline-field.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - address: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__inline-field.md_merged.snap b/tests/snapshots/execution_spec__inline-field.md_merged.snap deleted file mode 100644 index a4b6f89a4e..0000000000 --- a/tests/snapshots/execution_spec__inline-field.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - geo: Geo -} - -type Geo { - lat: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User @addField(name: "address", path: ["address", "geo", "lat"]) { - address: Address @modify(omit: true) -} diff --git a/tests/snapshots/execution_spec__inline-index-list.md_assert_0.snap b/tests/snapshots/execution_spec__inline-index-list.md_assert_0.snap deleted file mode 100644 index 29d33382cd..0000000000 --- a/tests/snapshots/execution_spec__inline-index-list.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "username": "Leanne Graham" - } - } -} diff --git a/tests/snapshots/execution_spec__inline-index-list.md_client.snap b/tests/snapshots/execution_spec__inline-index-list.md_client.snap deleted file mode 100644 index f36f868741..0000000000 --- a/tests/snapshots/execution_spec__inline-index-list.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - username: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__inline-index-list.md_merged.snap b/tests/snapshots/execution_spec__inline-index-list.md_merged.snap deleted file mode 100644 index 7191b8d138..0000000000 --- a/tests/snapshots/execution_spec__inline-index-list.md_merged.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query @addField(name: "username", path: ["username", "0", "name"]) { - username: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") @modify(omit: true) -} - -type User { - name: String -} diff --git a/tests/snapshots/execution_spec__inline-many-list.md_client.snap b/tests/snapshots/execution_spec__inline-many-list.md_client.snap deleted file mode 100644 index 64b314c987..0000000000 --- a/tests/snapshots/execution_spec__inline-many-list.md_client.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - u: U -} - -type U { - b: [String] - c: String - d: String - e: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__inline-many-list.md_merged.snap b/tests/snapshots/execution_spec__inline-many-list.md_merged.snap deleted file mode 100644 index 54bba824b0..0000000000 --- a/tests/snapshots/execution_spec__inline-many-list.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type A { - b: [String] - c: String - d: String -} - -type Query { - u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") -} - -type U @addField(name: "b", path: ["a", "b"]) @addField(name: "c", path: ["a", "c"]) @addField(name: "d", path: ["a", "d"]) { - a: A @modify(omit: true) - e: String -} diff --git a/tests/snapshots/execution_spec__inline-many.md_client.snap b/tests/snapshots/execution_spec__inline-many.md_client.snap deleted file mode 100644 index 9ea4260639..0000000000 --- a/tests/snapshots/execution_spec__inline-many.md_client.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - city: String - name: String - street: String - zipcode: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__inline-many.md_merged.snap b/tests/snapshots/execution_spec__inline-many.md_merged.snap deleted file mode 100644 index 43058f4640..0000000000 --- a/tests/snapshots/execution_spec__inline-many.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - city: String - street: String - zipcode: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User @addField(name: "city", path: ["address", "city"]) @addField(name: "street", path: ["address", "street"]) @addField(name: "zipcode", path: ["address", "zipcode"]) { - address: Address @modify(omit: true) - name: String -} diff --git a/tests/snapshots/execution_spec__io-cache.md_assert_0.snap b/tests/snapshots/execution_spec__io-cache.md_assert_0.snap deleted file mode 100644 index de60e84792..0000000000 --- a/tests/snapshots/execution_spec__io-cache.md_assert_0.snap +++ /dev/null @@ -1,52 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "title": "a", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "b", - "user": { - "name": "Leanne Graham" - } - }, - { - "title": "c", - "user": { - "name": "Ervin Howell" - } - }, - { - "title": "d", - "user": { - "name": "Ervin Howell" - } - }, - { - "title": "e", - "user": { - "name": "Ervin Howell" - } - }, - { - "title": "f", - "user": { - "name": "Ervin Howell" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__io-cache.md_client.snap b/tests/snapshots/execution_spec__io-cache.md_client.snap deleted file mode 100644 index 5572c8f8f5..0000000000 --- a/tests/snapshots/execution_spec__io-cache.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String! - id: Int! - title: String! - user: User - userId: Int! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int! - name: String! -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__io-cache.md_merged.snap b/tests/snapshots/execution_spec__io-cache.md_merged.snap deleted file mode 100644 index 4688153cc2..0000000000 --- a/tests/snapshots/execution_spec__io-cache.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { - query: Query -} - -type Post { - body: String! - id: Int! - title: String! - user: User @http(path: "/users/{{value.userId}}") - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts") -} - -type User { - id: Int! - name: String! -} diff --git a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_assert_0.snap b/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_assert_0.snap deleted file mode 100644 index 6d55adcbc2..0000000000 --- a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_assert_0.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "title": "title1", - "user": { - "name": "Leanne Graham" - } - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_client.snap b/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_client.snap deleted file mode 100644 index 71337782f0..0000000000 --- a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_client.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int! - title: String! - user(id: Int): User - userId: Int! -} - -type Query { - posts: [Post] - user(id: Int!): User - users: [User] -} - -scalar Url - -type User { - id: Int! - name: String! -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_merged.snap b/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_merged.snap deleted file mode 100644 index 1e450d7a8c..0000000000 --- a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_merged.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: [], maxSize: 100}, httpCache: true) { - query: Query -} - -type Post { - id: Int! - title: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") - users: [User] @http(path: "/users") -} - -type User { - id: Int! - name: String! -} diff --git a/tests/snapshots/execution_spec__modified-field.md_assert_0.snap b/tests/snapshots/execution_spec__modified-field.md_assert_0.snap deleted file mode 100644 index d5de6f93fe..0000000000 --- a/tests/snapshots/execution_spec__modified-field.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "fullname": "Leanne Graham" - } - } - } -} diff --git a/tests/snapshots/execution_spec__modified-field.md_client.snap b/tests/snapshots/execution_spec__modified-field.md_client.snap deleted file mode 100644 index 44d5e21293..0000000000 --- a/tests/snapshots/execution_spec__modified-field.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - fullname: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__modified-field.md_merged.snap b/tests/snapshots/execution_spec__modified-field.md_merged.snap deleted file mode 100644 index 0398a0e420..0000000000 --- a/tests/snapshots/execution_spec__modified-field.md_merged.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - name: String @modify(name: "fullname") -} diff --git a/tests/snapshots/execution_spec__mutation-put.md_assert_0.snap b/tests/snapshots/execution_spec__mutation-put.md_assert_0.snap deleted file mode 100644 index a6295cacfd..0000000000 --- a/tests/snapshots/execution_spec__mutation-put.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "insertPost": { - "body": "abc" - } - } - } -} diff --git a/tests/snapshots/execution_spec__mutation-put.md_client.snap b/tests/snapshots/execution_spec__mutation-put.md_client.snap deleted file mode 100644 index 0578daf7b9..0000000000 --- a/tests/snapshots/execution_spec__mutation-put.md_client.snap +++ /dev/null @@ -1,47 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type Mutation { - insertPost(input: PostInput!): Post -} - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - userId: Int -} - -input PostInput { - body: String - id: Int - title: String - userId: Int -} - -type Query { - firstUser: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query - mutation: Mutation -} diff --git a/tests/snapshots/execution_spec__mutation-put.md_merged.snap b/tests/snapshots/execution_spec__mutation-put.md_merged.snap deleted file mode 100644 index 3061fe7b2a..0000000000 --- a/tests/snapshots/execution_spec__mutation-put.md_merged.snap +++ /dev/null @@ -1,35 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query - mutation: Mutation -} - -input PostInput { - body: String - id: Int - title: String - userId: Int -} - -type Mutation { - insertPost(input: PostInput!): Post @http(body: "{{args.input}}", method: "PUT", path: "/posts/{{args.input.id}}") -} - -type Post { - body: String - id: Int - title: String - userId: Int -} - -type Query { - firstUser: User @http(path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__mutation.md_assert_0.snap b/tests/snapshots/execution_spec__mutation.md_assert_0.snap deleted file mode 100644 index 3d78c855be..0000000000 --- a/tests/snapshots/execution_spec__mutation.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "insertPost": { - "body": "post-body" - } - } - } -} diff --git a/tests/snapshots/execution_spec__mutation.md_client.snap b/tests/snapshots/execution_spec__mutation.md_client.snap deleted file mode 100644 index ae0e38b646..0000000000 --- a/tests/snapshots/execution_spec__mutation.md_client.snap +++ /dev/null @@ -1,46 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type Mutation { - insertPost(input: PostInput): Post -} - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - userId: Int -} - -input PostInput { - body: String - title: String - userId: Int -} - -type Query { - firstUser: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query - mutation: Mutation -} diff --git a/tests/snapshots/execution_spec__mutation.md_merged.snap b/tests/snapshots/execution_spec__mutation.md_merged.snap deleted file mode 100644 index 488a313c2f..0000000000 --- a/tests/snapshots/execution_spec__mutation.md_merged.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query - mutation: Mutation -} - -input PostInput { - body: String - title: String - userId: Int -} - -type Mutation { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") -} - -type Post { - body: String - id: Int - title: String - userId: Int -} - -type Query { - firstUser: User @http(path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__n-plus-one-list.md_assert_0.snap b/tests/snapshots/execution_spec__n-plus-one-list.md_assert_0.snap deleted file mode 100644 index 65c5d2bcca..0000000000 --- a/tests/snapshots/execution_spec__n-plus-one-list.md_assert_0.snap +++ /dev/null @@ -1,52 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "bars": [ - { - "foo": [ - { - "id": 1 - } - ], - "fooId": 1, - "id": 1 - }, - { - "foo": [ - { - "id": 1 - } - ], - "fooId": 1, - "id": 2 - }, - { - "foo": [ - { - "id": 2 - } - ], - "fooId": 2, - "id": 3 - }, - { - "foo": [ - { - "id": 2 - } - ], - "fooId": 2, - "id": 4 - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__n-plus-one-list.md_client.snap b/tests/snapshots/execution_spec__n-plus-one-list.md_client.snap deleted file mode 100644 index 2c8578f544..0000000000 --- a/tests/snapshots/execution_spec__n-plus-one-list.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Bar { - foo: [Foo] - fooId: Int! - id: Int! -} - -scalar Date - -scalar Email - -scalar Empty - -type Foo { - bar: Bar - id: Int! - name: String! -} - -scalar JSON - -scalar PhoneNumber - -type Query { - bars: [Bar] - foos: [Foo] -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__n-plus-one-list.md_merged.snap b/tests/snapshots/execution_spec__n-plus-one-list.md_merged.snap deleted file mode 100644 index 3c74034cd3..0000000000 --- a/tests/snapshots/execution_spec__n-plus-one-list.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Bar { - foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}]) - fooId: Int! - id: Int! -} - -type Foo { - bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}]) - id: Int! - name: String! -} - -type Query { - bars: [Bar] @http(path: "/bars") - foos: [Foo] @http(path: "/foos") -} diff --git a/tests/snapshots/execution_spec__n-plus-one.md_assert_0.snap b/tests/snapshots/execution_spec__n-plus-one.md_assert_0.snap deleted file mode 100644 index a55ce69948..0000000000 --- a/tests/snapshots/execution_spec__n-plus-one.md_assert_0.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "foos": [ - { - "bar": { - "fooId": "1", - "id": 1 - }, - "id": 1, - "name": "foo1" - }, - { - "bar": { - "fooId": "2", - "id": 2 - }, - "id": 2, - "name": "foo2" - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__n-plus-one.md_client.snap b/tests/snapshots/execution_spec__n-plus-one.md_client.snap deleted file mode 100644 index 2c8578f544..0000000000 --- a/tests/snapshots/execution_spec__n-plus-one.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Bar { - foo: [Foo] - fooId: Int! - id: Int! -} - -scalar Date - -scalar Email - -scalar Empty - -type Foo { - bar: Bar - id: Int! - name: String! -} - -scalar JSON - -scalar PhoneNumber - -type Query { - bars: [Bar] - foos: [Foo] -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__n-plus-one.md_merged.snap b/tests/snapshots/execution_spec__n-plus-one.md_merged.snap deleted file mode 100644 index 3c74034cd3..0000000000 --- a/tests/snapshots/execution_spec__n-plus-one.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Bar { - foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}]) - fooId: Int! - id: Int! -} - -type Foo { - bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}]) - id: Int! - name: String! -} - -type Query { - bars: [Bar] @http(path: "/bars") - foos: [Foo] @http(path: "/foos") -} diff --git a/tests/snapshots/execution_spec__nested-objects.md_assert_0.snap b/tests/snapshots/execution_spec__nested-objects.md_assert_0.snap deleted file mode 100644 index dd63e5c9e4..0000000000 --- a/tests/snapshots/execution_spec__nested-objects.md_assert_0.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "address": { - "geo": { - "lat": "-37.3159" - } - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__nested-objects.md_client.snap b/tests/snapshots/execution_spec__nested-objects.md_client.snap deleted file mode 100644 index 4669dee5d6..0000000000 --- a/tests/snapshots/execution_spec__nested-objects.md_client.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Address { - geo: Geo - street: String -} - -scalar Date - -scalar Email - -scalar Empty - -type Geo { - lat: String - lng: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - address: Address -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__nested-objects.md_merged.snap b/tests/snapshots/execution_spec__nested-objects.md_merged.snap deleted file mode 100644 index b8aceb5041..0000000000 --- a/tests/snapshots/execution_spec__nested-objects.md_merged.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - geo: Geo - street: String -} - -type Geo { - lat: String - lng: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - address: Address -} diff --git a/tests/snapshots/execution_spec__nesting-level3.md_assert_0.snap b/tests/snapshots/execution_spec__nesting-level3.md_assert_0.snap deleted file mode 100644 index ece7a634dc..0000000000 --- a/tests/snapshots/execution_spec__nesting-level3.md_assert_0.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "post": { - "user": { - "todos": [ - { - "completed": false - }, - { - "completed": false - }, - { - "completed": false - }, - { - "completed": true - }, - { - "completed": false - }, - { - "completed": false - } - ] - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__nesting-level3.md_client.snap b/tests/snapshots/execution_spec__nesting-level3.md_client.snap deleted file mode 100644 index 13a4d21006..0000000000 --- a/tests/snapshots/execution_spec__nesting-level3.md_client.snap +++ /dev/null @@ -1,45 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - user: User - userId: Int! -} - -type Query { - post: Post -} - -type Todo { - completed: Boolean -} - -scalar Url - -type User { - email: String! - id: Int! - name: String! - phone: String - todos: [Todo] - username: String! - website: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__nesting-level3.md_merged.snap b/tests/snapshots/execution_spec__nesting-level3.md_merged.snap deleted file mode 100644 index 2fa45e9cbc..0000000000 --- a/tests/snapshots/execution_spec__nesting-level3.md_merged.snap +++ /dev/null @@ -1,33 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Post { - body: String - id: Int - title: String - user: User @http(path: "/users/{{value.userId}}") - userId: Int! -} - -type Query { - post: Post @http(path: "/posts/1") -} - -type Todo { - completed: Boolean -} - -type User { - email: String! - id: Int! - name: String! - phone: String - todos: [Todo] @http(path: "/users/{{value.id}}/todos") - username: String! - website: String -} diff --git a/tests/snapshots/execution_spec__nullable-arg-query.md_assert_0.snap b/tests/snapshots/execution_spec__nullable-arg-query.md_assert_0.snap deleted file mode 100644 index fd978fb9e7..0000000000 --- a/tests/snapshots/execution_spec__nullable-arg-query.md_assert_0.snap +++ /dev/null @@ -1,46 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "users": [ - { - "id": 1 - }, - { - "id": 2 - }, - { - "id": 3 - }, - { - "id": 4 - }, - { - "id": 5 - }, - { - "id": 6 - }, - { - "id": 7 - }, - { - "id": 8 - }, - { - "id": 9 - }, - { - "id": 10 - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__nullable-arg-query.md_assert_1.snap b/tests/snapshots/execution_spec__nullable-arg-query.md_assert_1.snap deleted file mode 100644 index 529312c684..0000000000 --- a/tests/snapshots/execution_spec__nullable-arg-query.md_assert_1.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "users": [ - { - "id": 1 - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__nullable-arg-query.md_client.snap b/tests/snapshots/execution_spec__nullable-arg-query.md_client.snap deleted file mode 100644 index 525afe50fa..0000000000 --- a/tests/snapshots/execution_spec__nullable-arg-query.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - users(id: ID): [User] -} - -scalar Url - -type User { - id: ID! - name: String! -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__nullable-arg-query.md_merged.snap b/tests/snapshots/execution_spec__nullable-arg-query.md_merged.snap deleted file mode 100644 index 7093385843..0000000000 --- a/tests/snapshots/execution_spec__nullable-arg-query.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - users(id: ID): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{args.id}}"}]) -} - -type User { - id: ID! - name: String! -} diff --git a/tests/snapshots/execution_spec__omit-index-list.md_assert_0.snap b/tests/snapshots/execution_spec__omit-index-list.md_assert_0.snap deleted file mode 100644 index 29d33382cd..0000000000 --- a/tests/snapshots/execution_spec__omit-index-list.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "username": "Leanne Graham" - } - } -} diff --git a/tests/snapshots/execution_spec__omit-index-list.md_client.snap b/tests/snapshots/execution_spec__omit-index-list.md_client.snap deleted file mode 100644 index f36f868741..0000000000 --- a/tests/snapshots/execution_spec__omit-index-list.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - username: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__omit-index-list.md_merged.snap b/tests/snapshots/execution_spec__omit-index-list.md_merged.snap deleted file mode 100644 index 7191b8d138..0000000000 --- a/tests/snapshots/execution_spec__omit-index-list.md_merged.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query @addField(name: "username", path: ["username", "0", "name"]) { - username: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") @modify(omit: true) -} - -type User { - name: String -} diff --git a/tests/snapshots/execution_spec__omit-many.md_client.snap b/tests/snapshots/execution_spec__omit-many.md_client.snap deleted file mode 100644 index 45c10a3331..0000000000 --- a/tests/snapshots/execution_spec__omit-many.md_client.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - complements: [String] - name: String - zipcode: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__omit-many.md_merged.snap b/tests/snapshots/execution_spec__omit-many.md_merged.snap deleted file mode 100644 index 65cc21941b..0000000000 --- a/tests/snapshots/execution_spec__omit-many.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - city: String - complements: [String] - street: String - zipcode: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User @addField(name: "zipcode", path: ["address", "zipcode"]) @addField(name: "complements", path: ["address", "complements"]) { - address: Address @omit - name: String -} diff --git a/tests/snapshots/execution_spec__omit-resolved-by-parent.md_assert_0.snap b/tests/snapshots/execution_spec__omit-resolved-by-parent.md_assert_0.snap deleted file mode 100644 index 83acf38a17..0000000000 --- a/tests/snapshots/execution_spec__omit-resolved-by-parent.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "address": "Kulas Light" - } - } - } -} diff --git a/tests/snapshots/execution_spec__omit-resolved-by-parent.md_client.snap b/tests/snapshots/execution_spec__omit-resolved-by-parent.md_client.snap deleted file mode 100644 index e0ba3147d9..0000000000 --- a/tests/snapshots/execution_spec__omit-resolved-by-parent.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - address: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__omit-resolved-by-parent.md_merged.snap b/tests/snapshots/execution_spec__omit-resolved-by-parent.md_merged.snap deleted file mode 100644 index e44b9d28da..0000000000 --- a/tests/snapshots/execution_spec__omit-resolved-by-parent.md_merged.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - street: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User @addField(name: "address", path: ["address", "street"]) { - address: Address @modify(omit: true) -} diff --git a/tests/snapshots/execution_spec__recursive-type-json.md_assert_0.snap b/tests/snapshots/execution_spec__recursive-type-json.md_assert_0.snap deleted file mode 100644 index bc1aea6a46..0000000000 --- a/tests/snapshots/execution_spec__recursive-type-json.md_assert_0.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": "User1", - "id": 1, - "friend": { - "name": "User2", - "id": 2, - "friend": { - "name": "User2", - "id": 2 - } - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__recursive-type-json.md_client.snap b/tests/snapshots/execution_spec__recursive-type-json.md_client.snap deleted file mode 100644 index b1fff57326..0000000000 --- a/tests/snapshots/execution_spec__recursive-type-json.md_client.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - friend: User - id: Int! - name: String! -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__recursive-type-json.md_merged.snap b/tests/snapshots/execution_spec__recursive-type-json.md_merged.snap deleted file mode 100644 index 530f94d61d..0000000000 --- a/tests/snapshots/execution_spec__recursive-type-json.md_merged.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com", httpCache: true) { - query: Query -} - -type Query { - user(id: Int!): User @http(path: "/users/1") -} - -type User { - friend: User @http(path: "/friends/1") - id: Int! - name: String! -} diff --git a/tests/snapshots/execution_spec__recursive-types.md_assert_0.snap b/tests/snapshots/execution_spec__recursive-types.md_assert_0.snap deleted file mode 100644 index bc1aea6a46..0000000000 --- a/tests/snapshots/execution_spec__recursive-types.md_assert_0.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": "User1", - "id": 1, - "friend": { - "name": "User2", - "id": 2, - "friend": { - "name": "User2", - "id": 2 - } - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__recursive-types.md_client.snap b/tests/snapshots/execution_spec__recursive-types.md_client.snap deleted file mode 100644 index 51246a10f0..0000000000 --- a/tests/snapshots/execution_spec__recursive-types.md_client.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - friend: User - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__recursive-types.md_merged.snap b/tests/snapshots/execution_spec__recursive-types.md_merged.snap deleted file mode 100644 index a18ea152d0..0000000000 --- a/tests/snapshots/execution_spec__recursive-types.md_merged.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - user: User @http(path: "/users/1") -} - -type User { - friend: User @http(path: "/friends/1") - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__ref-other-nested.md_assert_0.snap b/tests/snapshots/execution_spec__ref-other-nested.md_assert_0.snap deleted file mode 100644 index a0257a5d85..0000000000 --- a/tests/snapshots/execution_spec__ref-other-nested.md_assert_0.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "firstUser": { - "user1": { - "user2": { - "name": "Leanne Graham" - } - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__ref-other-nested.md_client.snap b/tests/snapshots/execution_spec__ref-other-nested.md_client.snap deleted file mode 100644 index 372a3a0aa5..0000000000 --- a/tests/snapshots/execution_spec__ref-other-nested.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - firstUser: User1 -} - -scalar Url - -type User { - id: Int - name: String -} - -type User1 { - user1: User2 -} - -type User2 { - user2: User -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__ref-other-nested.md_merged.snap b/tests/snapshots/execution_spec__ref-other-nested.md_merged.snap deleted file mode 100644 index 6b55f012b0..0000000000 --- a/tests/snapshots/execution_spec__ref-other-nested.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - firstUser: User1 @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - id: Int - name: String -} - -type User1 { - user1: User2 -} - -type User2 { - user2: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") -} diff --git a/tests/snapshots/execution_spec__ref-other.md_assert_0.snap b/tests/snapshots/execution_spec__ref-other.md_assert_0.snap deleted file mode 100644 index e1803e092c..0000000000 --- a/tests/snapshots/execution_spec__ref-other.md_assert_0.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "firstUser": { - "user1": { - "name": "Leanne Graham" - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__ref-other.md_client.snap b/tests/snapshots/execution_spec__ref-other.md_client.snap deleted file mode 100644 index f43d59fc36..0000000000 --- a/tests/snapshots/execution_spec__ref-other.md_client.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - firstUser: User1 -} - -scalar Url - -type User { - id: Int - name: String -} - -type User1 { - user1: User -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__ref-other.md_merged.snap b/tests/snapshots/execution_spec__ref-other.md_merged.snap deleted file mode 100644 index 36e2544bb7..0000000000 --- a/tests/snapshots/execution_spec__ref-other.md_merged.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - firstUser: User1 -} - -type User { - id: Int - name: String -} - -type User1 { - user1: User @http(path: "/users/1") -} diff --git a/tests/snapshots/execution_spec__rename-field.md_assert_0.snap b/tests/snapshots/execution_spec__rename-field.md_assert_0.snap deleted file mode 100644 index 2a1942ca5c..0000000000 --- a/tests/snapshots/execution_spec__rename-field.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user1": { - "name": "Leanne Graham" - } - } - } -} diff --git a/tests/snapshots/execution_spec__rename-field.md_assert_1.snap b/tests/snapshots/execution_spec__rename-field.md_assert_1.snap deleted file mode 100644 index 4543945b2e..0000000000 --- a/tests/snapshots/execution_spec__rename-field.md_assert_1.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user2": { - "name": "Ervin Howell" - } - } - } -} diff --git a/tests/snapshots/execution_spec__rename-field.md_client.snap b/tests/snapshots/execution_spec__rename-field.md_client.snap deleted file mode 100644 index 24798b8ae8..0000000000 --- a/tests/snapshots/execution_spec__rename-field.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user1: User - user2: User -} - -scalar Url - -type User { - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__rename-field.md_merged.snap b/tests/snapshots/execution_spec__rename-field.md_merged.snap deleted file mode 100644 index c8f3ec81bf..0000000000 --- a/tests/snapshots/execution_spec__rename-field.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - person1: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") @modify(name: "user1") - person2: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/2") @modify(name: "user2") -} - -type User { - name: String -} diff --git a/tests/snapshots/execution_spec__request-to-upstream-batching.md_assert_0.snap b/tests/snapshots/execution_spec__request-to-upstream-batching.md_assert_0.snap deleted file mode 100644 index ae3cd214fb..0000000000 --- a/tests/snapshots/execution_spec__request-to-upstream-batching.md_assert_0.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": [ - { - "data": { - "user": { - "id": 1, - "name": "foo" - } - } - }, - { - "data": { - "user": { - "id": 2, - "name": "bar" - } - } - } - ] -} diff --git a/tests/snapshots/execution_spec__request-to-upstream-batching.md_client.snap b/tests/snapshots/execution_spec__request-to-upstream-batching.md_client.snap deleted file mode 100644 index 33012a438b..0000000000 --- a/tests/snapshots/execution_spec__request-to-upstream-batching.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__request-to-upstream-batching.md_merged.snap b/tests/snapshots/execution_spec__request-to-upstream-batching.md_merged.snap deleted file mode 100644 index 0c8e929999..0000000000 --- a/tests/snapshots/execution_spec__request-to-upstream-batching.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(batchRequests: true) @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { - query: Query -} - -type Query { - user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{args.id}}"}]) -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__resolve-with-headers.md_assert_0.snap b/tests/snapshots/execution_spec__resolve-with-headers.md_assert_0.snap deleted file mode 100644 index 194dde9025..0000000000 --- a/tests/snapshots/execution_spec__resolve-with-headers.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "post1": { - "title": "post title" - } - } - } -} diff --git a/tests/snapshots/execution_spec__resolve-with-headers.md_client.snap b/tests/snapshots/execution_spec__resolve-with-headers.md_client.snap deleted file mode 100644 index e5a89fac93..0000000000 --- a/tests/snapshots/execution_spec__resolve-with-headers.md_client.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String! - id: ID! - title: String! - userId: ID! -} - -type Query { - post1: Post -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__resolve-with-headers.md_merged.snap b/tests/snapshots/execution_spec__resolve-with-headers.md_merged.snap deleted file mode 100644 index e4bebb84dd..0000000000 --- a/tests/snapshots/execution_spec__resolve-with-headers.md_merged.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(allowedHeaders: ["authorization"]) { - query: Query -} - -type Post { - body: String! - id: ID! - title: String! - userId: ID! -} - -type Query { - post1: Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{headers.authorization}}") -} diff --git a/tests/snapshots/execution_spec__resolve-with-vars.md_assert_0.snap b/tests/snapshots/execution_spec__resolve-with-vars.md_assert_0.snap deleted file mode 100644 index 9e1032ec3c..0000000000 --- a/tests/snapshots/execution_spec__resolve-with-vars.md_assert_0.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": [ - { - "name": "Leanne Graham" - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__resolve-with-vars.md_client.snap b/tests/snapshots/execution_spec__resolve-with-vars.md_client.snap deleted file mode 100644 index f8f18cc475..0000000000 --- a/tests/snapshots/execution_spec__resolve-with-vars.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: [User] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__resolve-with-vars.md_merged.snap b/tests/snapshots/execution_spec__resolve-with-vars.md_merged.snap deleted file mode 100644 index fc0b2852de..0000000000 --- a/tests/snapshots/execution_spec__resolve-with-vars.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(vars: [{key: "id", value: "1"}]) @upstream { - query: Query -} - -type Query { - user: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{vars.id}}"}]) -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__resolved-by-parent.md_assert_0.snap b/tests/snapshots/execution_spec__resolved-by-parent.md_assert_0.snap deleted file mode 100644 index 83acf38a17..0000000000 --- a/tests/snapshots/execution_spec__resolved-by-parent.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "address": "Kulas Light" - } - } - } -} diff --git a/tests/snapshots/execution_spec__resolved-by-parent.md_client.snap b/tests/snapshots/execution_spec__resolved-by-parent.md_client.snap deleted file mode 100644 index e0ba3147d9..0000000000 --- a/tests/snapshots/execution_spec__resolved-by-parent.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - address: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__resolved-by-parent.md_merged.snap b/tests/snapshots/execution_spec__resolved-by-parent.md_merged.snap deleted file mode 100644 index e44b9d28da..0000000000 --- a/tests/snapshots/execution_spec__resolved-by-parent.md_merged.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Address { - street: String -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User @addField(name: "address", path: ["address", "street"]) { - address: Address @modify(omit: true) -} diff --git a/tests/snapshots/execution_spec__rest-api-error.md_assert_0.snap b/tests/snapshots/execution_spec__rest-api-error.md_assert_0.snap deleted file mode 100644 index dce9c4ce8d..0000000000 --- a/tests/snapshots/execution_spec__rest-api-error.md_assert_0.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 500, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "internal: non-null types require a return value", - "locations": [ - { - "line": 3, - "column": 5 - } - ], - "path": [ - "user", - "id" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__rest-api-error.md_client.snap b/tests/snapshots/execution_spec__rest-api-error.md_client.snap deleted file mode 100644 index b2c75a55b8..0000000000 --- a/tests/snapshots/execution_spec__rest-api-error.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - id: Int! - name: String! -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__rest-api-error.md_merged.snap b/tests/snapshots/execution_spec__rest-api-error.md_merged.snap deleted file mode 100644 index f44325ce69..0000000000 --- a/tests/snapshots/execution_spec__rest-api-error.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(src: "operation-user.graphql", type: Operation) { - query: Query -} - -type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") -} - -type User { - id: Int! - name: String! -} diff --git a/tests/snapshots/execution_spec__rest-api-post.md_assert_0.snap b/tests/snapshots/execution_spec__rest-api-post.md_assert_0.snap deleted file mode 100644 index 3bb91ee518..0000000000 --- a/tests/snapshots/execution_spec__rest-api-post.md_assert_0.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "id": 1, - "name": "foo" - } -} diff --git a/tests/snapshots/execution_spec__rest-api-post.md_client.snap b/tests/snapshots/execution_spec__rest-api-post.md_client.snap deleted file mode 100644 index b2c75a55b8..0000000000 --- a/tests/snapshots/execution_spec__rest-api-post.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - id: Int! - name: String! -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__rest-api-post.md_merged.snap b/tests/snapshots/execution_spec__rest-api-post.md_merged.snap deleted file mode 100644 index f44325ce69..0000000000 --- a/tests/snapshots/execution_spec__rest-api-post.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(src: "operation-user.graphql", type: Operation) { - query: Query -} - -type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") -} - -type User { - id: Int! - name: String! -} diff --git a/tests/snapshots/execution_spec__rest-api.md_assert_0.snap b/tests/snapshots/execution_spec__rest-api.md_assert_0.snap deleted file mode 100644 index 3bb91ee518..0000000000 --- a/tests/snapshots/execution_spec__rest-api.md_assert_0.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "id": 1, - "name": "foo" - } -} diff --git a/tests/snapshots/execution_spec__rest-api.md_client.snap b/tests/snapshots/execution_spec__rest-api.md_client.snap deleted file mode 100644 index b2c75a55b8..0000000000 --- a/tests/snapshots/execution_spec__rest-api.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - id: Int! - name: String! -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__rest-api.md_merged.snap b/tests/snapshots/execution_spec__rest-api.md_merged.snap deleted file mode 100644 index f44325ce69..0000000000 --- a/tests/snapshots/execution_spec__rest-api.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(src: "operation-user.graphql", type: Operation) { - query: Query -} - -type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") -} - -type User { - id: Int! - name: String! -} diff --git a/tests/snapshots/execution_spec__showcase.md_assert_0.snap b/tests/snapshots/execution_spec__showcase.md_assert_0.snap deleted file mode 100644 index c1d6f66212..0000000000 --- a/tests/snapshots/execution_spec__showcase.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": "foo" - } - } - } -} diff --git a/tests/snapshots/execution_spec__showcase.md_assert_1.snap b/tests/snapshots/execution_spec__showcase.md_assert_1.snap deleted file mode 100644 index b8e6363028..0000000000 --- a/tests/snapshots/execution_spec__showcase.md_assert_1.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "No Config URL specified" - } - ] - } -} diff --git a/tests/snapshots/execution_spec__showcase.md_assert_2.snap b/tests/snapshots/execution_spec__showcase.md_assert_2.snap deleted file mode 100644 index 33505dda26..0000000000 --- a/tests/snapshots/execution_spec__showcase.md_assert_2.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Invalid Config URL specified" - } - ] - } -} diff --git a/tests/snapshots/execution_spec__showcase.md_assert_3.snap b/tests/snapshots/execution_spec__showcase.md_assert_3.snap deleted file mode 100644 index 645d519413..0000000000 --- a/tests/snapshots/execution_spec__showcase.md_assert_3.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Failed to read config: Validation Error\n• --> 1:1\n |\n1 | \"dsjfsjdfjdsfjkdskjfjkds\"\n | ^---\n |\n = expected type_system_definition\n" - } - ] - } -} diff --git a/tests/snapshots/execution_spec__showcase.md_assert_4.snap b/tests/snapshots/execution_spec__showcase.md_assert_4.snap deleted file mode 100644 index 1b88aa8980..0000000000 --- a/tests/snapshots/execution_spec__showcase.md_assert_4.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Unexpected GraphQL Request: invalid type: map, expected a string at line 1 column 9" - } - ] - } -} diff --git a/tests/snapshots/execution_spec__showcase.md_client.snap b/tests/snapshots/execution_spec__showcase.md_client.snap deleted file mode 100644 index 9f20789b0a..0000000000 --- a/tests/snapshots/execution_spec__showcase.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - not_user: User -} - -scalar Url - -type User { - not_id: Int - not_name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__showcase.md_merged.snap b/tests/snapshots/execution_spec__showcase.md_merged.snap deleted file mode 100644 index 403c78fe18..0000000000 --- a/tests/snapshots/execution_spec__showcase.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(showcase: true) @upstream { - query: Query -} - -type Query { - not_user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - not_id: Int - not_name: String -} diff --git a/tests/snapshots/execution_spec__simple-graphql.md_assert_0.snap b/tests/snapshots/execution_spec__simple-graphql.md_assert_0.snap deleted file mode 100644 index c1d6f66212..0000000000 --- a/tests/snapshots/execution_spec__simple-graphql.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": "foo" - } - } - } -} diff --git a/tests/snapshots/execution_spec__simple-graphql.md_assert_1.snap b/tests/snapshots/execution_spec__simple-graphql.md_assert_1.snap deleted file mode 100644 index 1b88aa8980..0000000000 --- a/tests/snapshots/execution_spec__simple-graphql.md_assert_1.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "Unexpected GraphQL Request: invalid type: map, expected a string at line 1 column 9" - } - ] - } -} diff --git a/tests/snapshots/execution_spec__simple-graphql.md_client.snap b/tests/snapshots/execution_spec__simple-graphql.md_client.snap deleted file mode 100644 index 84d2907e22..0000000000 --- a/tests/snapshots/execution_spec__simple-graphql.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__simple-graphql.md_merged.snap b/tests/snapshots/execution_spec__simple-graphql.md_merged.snap deleted file mode 100644 index 822924f58f..0000000000 --- a/tests/snapshots/execution_spec__simple-graphql.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__simple-query.md_assert_0.snap b/tests/snapshots/execution_spec__simple-query.md_assert_0.snap deleted file mode 100644 index fd37d2e038..0000000000 --- a/tests/snapshots/execution_spec__simple-query.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "firstUser": { - "name": "foo" - } - } - } -} diff --git a/tests/snapshots/execution_spec__simple-query.md_client.snap b/tests/snapshots/execution_spec__simple-query.md_client.snap deleted file mode 100644 index 2ae445a996..0000000000 --- a/tests/snapshots/execution_spec__simple-query.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - firstUser: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__simple-query.md_merged.snap b/tests/snapshots/execution_spec__simple-query.md_merged.snap deleted file mode 100644 index e68b264eed..0000000000 --- a/tests/snapshots/execution_spec__simple-query.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - firstUser: User @http(path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-add-field-list.md_client.snap b/tests/snapshots/execution_spec__test-add-field-list.md_client.snap deleted file mode 100644 index e61e1d995e..0000000000 --- a/tests/snapshots/execution_spec__test-add-field-list.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type A { - b: B -} - -type B { - c: String -} - -scalar Date - -scalar Email - -scalar Empty - -type Foo { - a: A -} - -scalar JSON - -scalar PhoneNumber - -type Query { - b: B - foo: [Foo] -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-add-field-list.md_merged.snap b/tests/snapshots/execution_spec__test-add-field-list.md_merged.snap deleted file mode 100644 index 41c71c9237..0000000000 --- a/tests/snapshots/execution_spec__test-add-field-list.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type A { - b: B -} - -type B { - c: String -} - -type Foo { - a: A -} - -type Query @addField(name: "b", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-add-field.md_client.snap b/tests/snapshots/execution_spec__test-add-field.md_client.snap deleted file mode 100644 index a0399c6f79..0000000000 --- a/tests/snapshots/execution_spec__test-add-field.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type A { - b: B -} - -type B { - c: String -} - -scalar Date - -scalar Email - -scalar Empty - -type Foo { - a: A -} - -scalar JSON - -scalar PhoneNumber - -type Query { - b: B - foo: Foo -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-add-field.md_merged.snap b/tests/snapshots/execution_spec__test-add-field.md_merged.snap deleted file mode 100644 index 3b67cb64aa..0000000000 --- a/tests/snapshots/execution_spec__test-add-field.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type A { - b: B -} - -type B { - c: String -} - -type Foo { - a: A -} - -type Query @addField(name: "b", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-add-link-to-empty-config.md_client.snap b/tests/snapshots/execution_spec__test-add-link-to-empty-config.md_client.snap deleted file mode 100644 index f88af82b65..0000000000 --- a/tests/snapshots/execution_spec__test-add-link-to-empty-config.md_client.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -enum Foo { - BAR - BAZ -} - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: Foo - hello: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-add-link-to-empty-config.md_merged.snap b/tests/snapshots/execution_spec__test-add-link-to-empty-config.md_merged.snap deleted file mode 100644 index b4caf4570a..0000000000 --- a/tests/snapshots/execution_spec__test-add-link-to-empty-config.md_merged.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream @link(src: "link-expr.graphql", type: Config) @link(src: "link-enum.graphql", type: Config) { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-batching-group-by.md_client.snap b/tests/snapshots/execution_spec__test-batching-group-by.md_client.snap deleted file mode 100644 index f8e5c29910..0000000000 --- a/tests/snapshots/execution_spec__test-batching-group-by.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - user: User - userId: Int! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-batching-group-by.md_merged.snap b/tests/snapshots/execution_spec__test-batching-group-by.md_merged.snap deleted file mode 100644 index b726378054..0000000000 --- a/tests/snapshots/execution_spec__test-batching-group-by.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(port: 4000) @upstream(baseURL: "http://abc.com", batch: {delay: 1, headers: [], maxSize: 1000}) { - query: Query -} - -type Post { - body: String - id: Int - title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts?id=1&id=11") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-cache.md_client.snap b/tests/snapshots/execution_spec__test-cache.md_client.snap deleted file mode 100644 index 84d2907e22..0000000000 --- a/tests/snapshots/execution_spec__test-cache.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-cache.md_merged.snap b/tests/snapshots/execution_spec__test-cache.md_merged.snap deleted file mode 100644 index 769c557d4d..0000000000 --- a/tests/snapshots/execution_spec__test-cache.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Query { - user: User @http(path: "/foo") @cache(maxAge: 300) -} - -type User @cache(maxAge: 900) { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-conflict-allowed-headers.md_merged.snap b/tests/snapshots/execution_spec__test-conflict-allowed-headers.md_merged.snap deleted file mode 100644 index 264403bbf5..0000000000 --- a/tests/snapshots/execution_spec__test-conflict-allowed-headers.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(allowedHeaders: ["a", "b", "c", "d"]) { - query: Query -} - -type Query { - hello: String @expr(body: "world") -} diff --git a/tests/snapshots/execution_spec__test-conflict-vars.md_merged.snap b/tests/snapshots/execution_spec__test-conflict-vars.md_merged.snap deleted file mode 100644 index 58fe751643..0000000000 --- a/tests/snapshots/execution_spec__test-conflict-vars.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(vars: [{key: "a", value: "b"}, {key: "c", value: "d"}, {key: "p", value: "q"}]) @upstream { - query: Query -} - -type Query { - hello: String @expr(body: "world") -} diff --git a/tests/snapshots/execution_spec__test-custom-scalar.md_client.snap b/tests/snapshots/execution_spec__test-custom-scalar.md_client.snap deleted file mode 100644 index 2e238aa2c0..0000000000 --- a/tests/snapshots/execution_spec__test-custom-scalar.md_client.snap +++ /dev/null @@ -1,25 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar Json - -scalar PhoneNumber - -type Query { - foo: [Json] -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-custom-scalar.md_merged.snap b/tests/snapshots/execution_spec__test-custom-scalar.md_merged.snap deleted file mode 100644 index 4ef1b123aa..0000000000 --- a/tests/snapshots/execution_spec__test-custom-scalar.md_merged.snap +++ /dev/null @@ -1,13 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -scalar Json - -type Query { - foo: [Json] @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-custom-types.md_client.snap b/tests/snapshots/execution_spec__test-custom-types.md_client.snap deleted file mode 100644 index f0d4ac3e87..0000000000 --- a/tests/snapshots/execution_spec__test-custom-types.md_client.snap +++ /dev/null @@ -1,41 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type Mut { - insertPost(input: PostInput): Post -} - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - userId: Int -} - -input PostInput { - body: String - title: String - userId: Int -} - -type Que { - posts: [Post] -} - -scalar Url - -schema { - query: Que - mutation: Mut -} diff --git a/tests/snapshots/execution_spec__test-custom-types.md_merged.snap b/tests/snapshots/execution_spec__test-custom-types.md_merged.snap deleted file mode 100644 index c4e8b04f55..0000000000 --- a/tests/snapshots/execution_spec__test-custom-types.md_merged.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Que - mutation: Mut -} - -input PostInput { - body: String - title: String - userId: Int -} - -type Mut { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") -} - -type Post { - body: String - id: Int - title: String - userId: Int -} - -type Que { - posts: [Post] @expr(body: [{id: 1}]) -} diff --git a/tests/snapshots/execution_spec__test-description-many.md_client.snap b/tests/snapshots/execution_spec__test-description-many.md_client.snap deleted file mode 100644 index 4df606385d..0000000000 --- a/tests/snapshots/execution_spec__test-description-many.md_client.snap +++ /dev/null @@ -1,33 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Bar { - """ - This is test2 - """ - baz: String -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - """ - This is test - """ - foo: Bar -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-description-many.md_merged.snap b/tests/snapshots/execution_spec__test-description-many.md_merged.snap deleted file mode 100644 index bea9751ea9..0000000000 --- a/tests/snapshots/execution_spec__test-description-many.md_merged.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Bar { - """ - This is test2 - """ - baz: String -} - -type Query { - """ - This is test - """ - foo: Bar @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-enum-default.md_assert_0.snap b/tests/snapshots/execution_spec__test-enum-default.md_assert_0.snap deleted file mode 100644 index 6a14caece7..0000000000 --- a/tests/snapshots/execution_spec__test-enum-default.md_assert_0.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "news": { - "news": [ - { - "id": 1, - "foo": "PUBLISHED" - }, - { - "id": 2, - "foo": "DRAFT" - }, - { - "id": 3, - "foo": "ND" - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__test-enum-default.md_client.snap b/tests/snapshots/execution_spec__test-enum-default.md_client.snap deleted file mode 100644 index 3bf9fcb1dc..0000000000 --- a/tests/snapshots/execution_spec__test-enum-default.md_client.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - foo: Status - id: Int -} - -type NewsData { - news: [News]! -} - -scalar PhoneNumber - -type Query { - news: NewsData! -} - -enum Status { - DRAFT - ND - PUBLISHED -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-enum-default.md_merged.snap b/tests/snapshots/execution_spec__test-enum-default.md_merged.snap deleted file mode 100644 index f74739ebd4..0000000000 --- a/tests/snapshots/execution_spec__test-enum-default.md_merged.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8080) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 100}, httpCache: true) @link(id: "news", src: "./service.proto", type: Protobuf) { - query: Query -} - -enum Status { - DRAFT - ND - PUBLISHED -} - -type News { - foo: Status - id: Int -} - -type NewsData { - news: [News]! -} - -type NewsInput { - id: Int -} - -type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") -} diff --git a/tests/snapshots/execution_spec__test-enum-merge.md_merged.snap b/tests/snapshots/execution_spec__test-enum-merge.md_merged.snap deleted file mode 100644 index 99d8747536..0000000000 --- a/tests/snapshots/execution_spec__test-enum-merge.md_merged.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -enum Foo { - BAR - BAZ - BOOM -} - -type Query { - foo: Foo @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-enum.md_assert_0.snap b/tests/snapshots/execution_spec__test-enum.md_assert_0.snap deleted file mode 100644 index 1faa1c2e5e..0000000000 --- a/tests/snapshots/execution_spec__test-enum.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "foo": "BAR" - } - } -} diff --git a/tests/snapshots/execution_spec__test-enum.md_assert_1.snap b/tests/snapshots/execution_spec__test-enum.md_assert_1.snap deleted file mode 100644 index 7c41e7a967..0000000000 --- a/tests/snapshots/execution_spec__test-enum.md_assert_1.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "foo": "BAZ" - } - } -} diff --git a/tests/snapshots/execution_spec__test-enum.md_assert_2.snap b/tests/snapshots/execution_spec__test-enum.md_assert_2.snap deleted file mode 100644 index a2ba8f23dc..0000000000 --- a/tests/snapshots/execution_spec__test-enum.md_assert_2.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "internal: invalid item for enum \"Foo\"", - "locations": [ - { - "line": 1, - "column": 9 - } - ], - "path": [ - "foo" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__test-enum.md_client.snap b/tests/snapshots/execution_spec__test-enum.md_client.snap deleted file mode 100644 index c4809642b5..0000000000 --- a/tests/snapshots/execution_spec__test-enum.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -enum Foo { - BAR - BAZ -} - -scalar JSON - -scalar PhoneNumber - -type Query { - foo(val: String!): Foo -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-enum.md_merged.snap b/tests/snapshots/execution_spec__test-enum.md_merged.snap deleted file mode 100644 index 32c044fffc..0000000000 --- a/tests/snapshots/execution_spec__test-enum.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://localhost:8080") { - query: Query -} - -enum Foo { - BAR - BAZ -} - -type Query { - foo(val: String!): Foo @expr(body: "{{args.val}}") -} diff --git a/tests/snapshots/execution_spec__test-expr-with-mustache.md_assert_0.snap b/tests/snapshots/execution_spec__test-expr-with-mustache.md_assert_0.snap deleted file mode 100644 index 6968e94c17..0000000000 --- a/tests/snapshots/execution_spec__test-expr-with-mustache.md_assert_0.snap +++ /dev/null @@ -1,29 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "a": { - "bc": { - "b": [ - 1, - 2, - 3 - ], - "c": "test", - "d": 1, - "f": { - "e": 1 - }, - "g": true - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__test-expr-with-mustache.md_client.snap b/tests/snapshots/execution_spec__test-expr-with-mustache.md_client.snap deleted file mode 100644 index c35daebf5a..0000000000 --- a/tests/snapshots/execution_spec__test-expr-with-mustache.md_client.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type A { - a: Int - bc: BC -} - -type BC { - b: [Int] - c: String - d: Int - f: D - g: Boolean -} - -type D { - e: Int -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - a: A -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-expr-with-mustache.md_merged.snap b/tests/snapshots/execution_spec__test-expr-with-mustache.md_merged.snap deleted file mode 100644 index 0f3f2892c9..0000000000 --- a/tests/snapshots/execution_spec__test-expr-with-mustache.md_merged.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type A { - a: Int - b: [Int] @modify(omit: true) - bc: BC @expr(body: {b: "{{value.b}}", c: "{{value.c}}", d: "{{value.d.e}}", f: "{{value.d}}", g: "{{value.g}}"}) - c: String @modify(omit: true) - d: D @modify(omit: true) - g: Boolean @modify(omit: true) -} - -type BC { - b: [Int] - c: String - d: Int - f: D - g: Boolean -} - -type D { - e: Int -} - -type Query { - a: A @expr(body: {a: 0, b: [1, 2, 3], c: "test", d: {e: 1}, g: true}) -} diff --git a/tests/snapshots/execution_spec__test-expr.md_client.snap b/tests/snapshots/execution_spec__test-expr.md_client.snap deleted file mode 100644 index 60f26910ce..0000000000 --- a/tests/snapshots/execution_spec__test-expr.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - hello: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-expr.md_merged.snap b/tests/snapshots/execution_spec__test-expr.md_merged.snap deleted file mode 100644 index d62956f25c..0000000000 --- a/tests/snapshots/execution_spec__test-expr.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - hello: String @expr(body: "Hello from server") -} diff --git a/tests/snapshots/execution_spec__test-graphqlsource.md_client.snap b/tests/snapshots/execution_spec__test-graphqlsource.md_client.snap deleted file mode 100644 index 4672cc580f..0000000000 --- a/tests/snapshots/execution_spec__test-graphqlsource.md_client.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int! - user: User - userId: Int! -} - -type Query { - post(id: Int!): Post -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-graphqlsource.md_merged.snap b/tests/snapshots/execution_spec__test-graphqlsource.md_merged.snap deleted file mode 100644 index 62b80c8bae..0000000000 --- a/tests/snapshots/execution_spec__test-graphqlsource.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://localhost:8000/graphql") { - query: Query -} - -type Post { - id: Int! - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], name: "user") - userId: Int! -} - -type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{args.id}}") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-grpc-invalid-proto-id.md_errors.snap b/tests/snapshots/execution_spec__test-grpc-invalid-proto-id.md_errors.snap deleted file mode 100644 index 80c9a4c08f..0000000000 --- a/tests/snapshots/execution_spec__test-grpc-invalid-proto-id.md_errors.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: errors ---- -[ - { - "message": "File descriptor not found for method: abc.NewsService.GetAllNews", - "trace": [ - "Query", - "news", - "@grpc" - ], - "description": null - } -] diff --git a/tests/snapshots/execution_spec__test-grpc-service.md_errors.snap b/tests/snapshots/execution_spec__test-grpc-service.md_errors.snap deleted file mode 100644 index c08d1c5a76..0000000000 --- a/tests/snapshots/execution_spec__test-grpc-service.md_errors.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: errors ---- -[ - { - "message": "Couldn't find definitions for service YourServiceName", - "trace": [ - "Query", - "news", - "@grpc" - ], - "description": null - } -] diff --git a/tests/snapshots/execution_spec__test-grpc.md_client.snap b/tests/snapshots/execution_spec__test-grpc.md_client.snap deleted file mode 100644 index d439ec7a60..0000000000 --- a/tests/snapshots/execution_spec__test-grpc.md_client.snap +++ /dev/null @@ -1,43 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -scalar PhoneNumber - -type Query { - news: NewsData! - newsById(news: NewsInput!): News! - newsByIdBatch(news: NewsInput!): News! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-grpc.md_merged.snap b/tests/snapshots/execution_spec__test-grpc.md_merged.snap deleted file mode 100644 index 32aafcea20..0000000000 --- a/tests/snapshots/execution_spec__test-grpc.md_merged.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(port: 8000) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 1000}) @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News]! -} - -type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{args.news}}", method: "news.NewsService.GetNews") - newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") -} diff --git a/tests/snapshots/execution_spec__test-http-baseurl.md_client.snap b/tests/snapshots/execution_spec__test-http-baseurl.md_client.snap deleted file mode 100644 index c00421d8f4..0000000000 --- a/tests/snapshots/execution_spec__test-http-baseurl.md_client.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - bar: String - foo: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-http-baseurl.md_merged.snap b/tests/snapshots/execution_spec__test-http-baseurl.md_merged.snap deleted file mode 100644 index 65cf378264..0000000000 --- a/tests/snapshots/execution_spec__test-http-baseurl.md_merged.snap +++ /dev/null @@ -1,12 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://abc.com") { - query: Query -} - -type Query { - bar: String @http(path: "/bar") - foo: String @http(baseURL: "http://foo.com", path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-http-headers.md_client.snap b/tests/snapshots/execution_spec__test-http-headers.md_client.snap deleted file mode 100644 index 98032c71c4..0000000000 --- a/tests/snapshots/execution_spec__test-http-headers.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-http-headers.md_merged.snap b/tests/snapshots/execution_spec__test-http-headers.md_merged.snap deleted file mode 100644 index 8f082a2028..0000000000 --- a/tests/snapshots/execution_spec__test-http-headers.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://localhost:4000") { - query: Query -} - -type Query { - foo: String @http(headers: [{key: "foo", value: "bar"}], path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-http-tmpl.md_client.snap b/tests/snapshots/execution_spec__test-http-tmpl.md_client.snap deleted file mode 100644 index c0736cc312..0000000000 --- a/tests/snapshots/execution_spec__test-http-tmpl.md_client.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int - user: User - userId: Int! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-http-tmpl.md_merged.snap b/tests/snapshots/execution_spec__test-http-tmpl.md_merged.snap deleted file mode 100644 index 0467ee6e47..0000000000 --- a/tests/snapshots/execution_spec__test-http-tmpl.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Post { - id: Int - user: User @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) - userId: Int! -} - -type Query { - posts: [Post] @http(path: "/posts") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_assert_0.snap b/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_assert_0.snap deleted file mode 100644 index 299eae2a4d..0000000000 --- a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_assert_0.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "a": { - "bc": { - "d": { - "e": 1 - }, - "f": true - } - } - } - } -} diff --git a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_client.snap b/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_client.snap deleted file mode 100644 index c8498e4143..0000000000 --- a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_client.snap +++ /dev/null @@ -1,37 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type A { - a: Int - bc: BC -} - -type BC { - d: D - f: Boolean -} - -type D { - e: Int -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - a: A -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_merged.snap b/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_merged.snap deleted file mode 100644 index 95962747c2..0000000000 --- a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_merged.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type A { - a: Int - bc: BC @expr(body: {d: "{{value.d}}", f: "{{value.f}}"}) - d: D @modify(omit: true) -} - -type BC { - d: D - f: Boolean -} - -type D { - e: Int -} - -type Query { - a: A @http(baseURL: "http://localhost:3000", path: "/a") -} diff --git a/tests/snapshots/execution_spec__test-http.md_client.snap b/tests/snapshots/execution_spec__test-http.md_client.snap deleted file mode 100644 index c1d625a8c9..0000000000 --- a/tests/snapshots/execution_spec__test-http.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: [User] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-http.md_merged.snap b/tests/snapshots/execution_spec__test-http.md_merged.snap deleted file mode 100644 index 7e75c573bb..0000000000 --- a/tests/snapshots/execution_spec__test-http.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Query { - foo: [User] @http(path: "/users") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-inline-list.md_client.snap b/tests/snapshots/execution_spec__test-inline-list.md_client.snap deleted file mode 100644 index 01443ed483..0000000000 --- a/tests/snapshots/execution_spec__test-inline-list.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type B { - c: String -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: B -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-inline-list.md_merged.snap b/tests/snapshots/execution_spec__test-inline-list.md_merged.snap deleted file mode 100644 index edfd9e8fcd..0000000000 --- a/tests/snapshots/execution_spec__test-inline-list.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type A { - b: B -} - -type B { - c: String -} - -type Foo { - a: A -} - -type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") @modify(omit: true) -} diff --git a/tests/snapshots/execution_spec__test-inline.md_client.snap b/tests/snapshots/execution_spec__test-inline.md_client.snap deleted file mode 100644 index 01443ed483..0000000000 --- a/tests/snapshots/execution_spec__test-inline.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type B { - c: String -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: B -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-inline.md_merged.snap b/tests/snapshots/execution_spec__test-inline.md_merged.snap deleted file mode 100644 index 358851e6ca..0000000000 --- a/tests/snapshots/execution_spec__test-inline.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type A { - b: B -} - -type B { - c: String -} - -type Foo { - a: A -} - -type Query @addField(name: "foo", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") @modify(omit: true) -} diff --git a/tests/snapshots/execution_spec__test-interface-result.md_client.snap b/tests/snapshots/execution_spec__test-interface-result.md_client.snap deleted file mode 100644 index bb4dfdd777..0000000000 --- a/tests/snapshots/execution_spec__test-interface-result.md_client.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type B implements IA { - a: String - b: String -} - -scalar Date - -scalar Email - -scalar Empty - -interface IA { - a: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - bar: IA -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-interface-result.md_merged.snap b/tests/snapshots/execution_spec__test-interface-result.md_merged.snap deleted file mode 100644 index 3412106bcb..0000000000 --- a/tests/snapshots/execution_spec__test-interface-result.md_merged.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -interface IA { - a: String -} - -type B implements IA { - a: String - b: String -} - -type Query { - bar: IA @http(path: "/user") -} diff --git a/tests/snapshots/execution_spec__test-interface.md_client.snap b/tests/snapshots/execution_spec__test-interface.md_client.snap deleted file mode 100644 index cda634864d..0000000000 --- a/tests/snapshots/execution_spec__test-interface.md_client.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type B implements IA { - a: String - b: String -} - -scalar Date - -scalar Email - -scalar Empty - -interface IA { - a: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - bar: B -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-interface.md_merged.snap b/tests/snapshots/execution_spec__test-interface.md_merged.snap deleted file mode 100644 index 062f7daea9..0000000000 --- a/tests/snapshots/execution_spec__test-interface.md_merged.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -interface IA { - a: String -} - -type B implements IA { - a: String - b: String -} - -type Query { - bar: B @http(path: "/user") -} diff --git a/tests/snapshots/execution_spec__test-js-request-reponse.md_assert_0.snap b/tests/snapshots/execution_spec__test-js-request-reponse.md_assert_0.snap deleted file mode 100644 index 8c91ac6997..0000000000 --- a/tests/snapshots/execution_spec__test-js-request-reponse.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "hi": "hello world" - } - } -} diff --git a/tests/snapshots/execution_spec__test-js-request-reponse.md_client.snap b/tests/snapshots/execution_spec__test-js-request-reponse.md_client.snap deleted file mode 100644 index 1d9cea2dc3..0000000000 --- a/tests/snapshots/execution_spec__test-js-request-reponse.md_client.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - hello: String - hi: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-js-request-reponse.md_merged.snap b/tests/snapshots/execution_spec__test-js-request-reponse.md_merged.snap deleted file mode 100644 index 3102d752cb..0000000000 --- a/tests/snapshots/execution_spec__test-js-request-reponse.md_merged.snap +++ /dev/null @@ -1,12 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream @link(src: "test.js", type: Script) { - query: Query -} - -type Query { - hello: String @http(baseURL: "http://localhost:3000", path: "/hello") - hi: String @http(baseURL: "http://localhost:3000", path: "/hi") -} diff --git a/tests/snapshots/execution_spec__test-merge-batch.md_merged.snap b/tests/snapshots/execution_spec__test-merge-batch.md_merged.snap deleted file mode 100644 index e1884682b8..0000000000 --- a/tests/snapshots/execution_spec__test-merge-batch.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(batch: {delay: 5, headers: ["a", "b", "c"], maxSize: 100}) { - query: Query -} - -type Query { - hello: String @expr(body: "world") -} diff --git a/tests/snapshots/execution_spec__test-merge-nested.md_merged.snap b/tests/snapshots/execution_spec__test-merge-nested.md_merged.snap deleted file mode 100644 index 781472cc03..0000000000 --- a/tests/snapshots/execution_spec__test-merge-nested.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://abc.com") { - query: Query -} - -type Foo { - """ - test2 - """ - a: String - """ - test1 - """ - b: String -} - -type Query { - hi: Foo @expr(body: {a: "world"}) -} diff --git a/tests/snapshots/execution_spec__test-merge-query.md_merged.snap b/tests/snapshots/execution_spec__test-merge-query.md_merged.snap deleted file mode 100644 index 9e2dc2990a..0000000000 --- a/tests/snapshots/execution_spec__test-merge-query.md_merged.snap +++ /dev/null @@ -1,12 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(port: 8000) @upstream(baseURL: "http://abc.com", proxy: {url: "http://localhost:3000"}) { - query: Query -} - -type Query { - hello: String @expr(body: "world") - hi: String @expr(body: "world") -} diff --git a/tests/snapshots/execution_spec__test-merge-right-with-link-config.md_client.snap b/tests/snapshots/execution_spec__test-merge-right-with-link-config.md_client.snap deleted file mode 100644 index ca6c4ff3a0..0000000000 --- a/tests/snapshots/execution_spec__test-merge-right-with-link-config.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -type Foo { - bar: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: Foo -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-merge-right-with-link-config.md_merged.snap b/tests/snapshots/execution_spec__test-merge-right-with-link-config.md_merged.snap deleted file mode 100644 index 095502b241..0000000000 --- a/tests/snapshots/execution_spec__test-merge-right-with-link-config.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(allowedHeaders: ["Authorization"]) @link(src: "stripe-types.graphql", type: Config) { - query: Query -} - -type Query { - foo: Foo @expr(body: {bar: "foo"}) -} diff --git a/tests/snapshots/execution_spec__test-merge-server-sdl.md_client.snap b/tests/snapshots/execution_spec__test-merge-server-sdl.md_client.snap deleted file mode 100644 index c1d625a8c9..0000000000 --- a/tests/snapshots/execution_spec__test-merge-server-sdl.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: [User] -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-merge-server-sdl.md_merged.snap b/tests/snapshots/execution_spec__test-merge-server-sdl.md_merged.snap deleted file mode 100644 index 7e75c573bb..0000000000 --- a/tests/snapshots/execution_spec__test-merge-server-sdl.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Query { - foo: [User] @http(path: "/users") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-merge-union.md_merged.snap b/tests/snapshots/execution_spec__test-merge-union.md_merged.snap deleted file mode 100644 index 38474eedf0..0000000000 --- a/tests/snapshots/execution_spec__test-merge-union.md_merged.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -union FooBar = Bar | Baz | Foo - -type Bar { - bar: String -} - -type Baz { - baz: String -} - -type Foo { - a: String - foo: String -} - -type Query { - foo: FooBar @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-modify.md_client.snap b/tests/snapshots/execution_spec__test-modify.md_client.snap deleted file mode 100644 index b97d9f3764..0000000000 --- a/tests/snapshots/execution_spec__test-modify.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -input Foo { - bar: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - data(input: Foo): String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-modify.md_merged.snap b/tests/snapshots/execution_spec__test-modify.md_merged.snap deleted file mode 100644 index 501b1177ad..0000000000 --- a/tests/snapshots/execution_spec__test-modify.md_merged.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -input Foo { - bar: String -} - -type Query { - foo(input: Foo): String @http(path: "/foo") @modify(name: "data") -} diff --git a/tests/snapshots/execution_spec__test-multi-interface.md_client.snap b/tests/snapshots/execution_spec__test-multi-interface.md_client.snap deleted file mode 100644 index 213b5f84eb..0000000000 --- a/tests/snapshots/execution_spec__test-multi-interface.md_client.snap +++ /dev/null @@ -1,36 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type B implements IA & IB { - a: String - b: String -} - -scalar Date - -scalar Email - -scalar Empty - -interface IA { - a: String -} - -interface IB { - b: String -} - -scalar JSON - -scalar PhoneNumber - -type Query { - bar: B -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-multi-interface.md_merged.snap b/tests/snapshots/execution_spec__test-multi-interface.md_merged.snap deleted file mode 100644 index fe90985a1c..0000000000 --- a/tests/snapshots/execution_spec__test-multi-interface.md_merged.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -interface IA { - a: String -} - -interface IB { - b: String -} - -type B implements IA & IB { - a: String - b: String -} - -type Query { - bar: B @http(path: "/user") -} diff --git a/tests/snapshots/execution_spec__test-nested-input.md_client.snap b/tests/snapshots/execution_spec__test-nested-input.md_client.snap deleted file mode 100644 index 32cdd95884..0000000000 --- a/tests/snapshots/execution_spec__test-nested-input.md_client.snap +++ /dev/null @@ -1,43 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -input A { - b: B -} - -input B { - c: C -} - -input C { - d: D -} - -input D { - e: Int -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - a(a: A!): X -} - -scalar Url - -type X { - a: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-nested-input.md_merged.snap b/tests/snapshots/execution_spec__test-nested-input.md_merged.snap deleted file mode 100644 index 83a238a9cf..0000000000 --- a/tests/snapshots/execution_spec__test-nested-input.md_merged.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -input A { - b: B -} - -input B { - c: C -} - -input C { - d: D -} - -input D { - e: Int -} - -type Query { - a(a: A!): X @expr(body: {a: "hello"}) -} - -type X { - a: String -} diff --git a/tests/snapshots/execution_spec__test-nested-link.md_client.snap b/tests/snapshots/execution_spec__test-nested-link.md_client.snap deleted file mode 100644 index 6ecb97cbf0..0000000000 --- a/tests/snapshots/execution_spec__test-nested-link.md_client.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -enum Foo { - BAR - BAZ -} - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int! - user: User - userId: Int! -} - -type Query { - foo: Foo - post(id: Int!): Post -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-nested-link.md_merged.snap b/tests/snapshots/execution_spec__test-nested-link.md_merged.snap deleted file mode 100644 index b7fd3efe85..0000000000 --- a/tests/snapshots/execution_spec__test-nested-link.md_merged.snap +++ /dev/null @@ -1,7 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream @link(src: "graphql-with-link.graphql", type: Config) { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-nested-value.md_client.snap b/tests/snapshots/execution_spec__test-nested-value.md_client.snap deleted file mode 100644 index e7c1878cbe..0000000000 --- a/tests/snapshots/execution_spec__test-nested-value.md_client.snap +++ /dev/null @@ -1,33 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int - user: User! -} - -type Query { - posts: [Post] -} - -scalar Url - -type User { - id: Int! - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-nested-value.md_merged.snap b/tests/snapshots/execution_spec__test-nested-value.md_merged.snap deleted file mode 100644 index 3d2ff5dcbc..0000000000 --- a/tests/snapshots/execution_spec__test-nested-value.md_merged.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Post { - id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.id}}"}]) -} - -type Query { - posts: [Post] @http(path: "/posts") -} - -type User { - id: Int! - name: String -} diff --git a/tests/snapshots/execution_spec__test-omit-list.md_client.snap b/tests/snapshots/execution_spec__test-omit-list.md_client.snap deleted file mode 100644 index 01443ed483..0000000000 --- a/tests/snapshots/execution_spec__test-omit-list.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type B { - c: String -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: B -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-omit-list.md_merged.snap b/tests/snapshots/execution_spec__test-omit-list.md_merged.snap deleted file mode 100644 index 7ba329d6e4..0000000000 --- a/tests/snapshots/execution_spec__test-omit-list.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type A { - b: B -} - -type B { - c: String -} - -type Foo { - a: A -} - -type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") @omit -} diff --git a/tests/snapshots/execution_spec__test-omit.md_client.snap b/tests/snapshots/execution_spec__test-omit.md_client.snap deleted file mode 100644 index 01443ed483..0000000000 --- a/tests/snapshots/execution_spec__test-omit.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type B { - c: String -} - -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: B -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-omit.md_merged.snap b/tests/snapshots/execution_spec__test-omit.md_merged.snap deleted file mode 100644 index f15e34f235..0000000000 --- a/tests/snapshots/execution_spec__test-omit.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type A { - b: B -} - -type B { - c: String -} - -type Foo { - a: A -} - -type Query @addField(name: "foo", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") @omit -} diff --git a/tests/snapshots/execution_spec__test-params-as-body.md_assert_0.snap b/tests/snapshots/execution_spec__test-params-as-body.md_assert_0.snap deleted file mode 100644 index 2a22411572..0000000000 --- a/tests/snapshots/execution_spec__test-params-as-body.md_assert_0.snap +++ /dev/null @@ -1,18 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "firstUser": { - "id": 1, - "name": "foo" - } - } - } -} diff --git a/tests/snapshots/execution_spec__test-params-as-body.md_client.snap b/tests/snapshots/execution_spec__test-params-as-body.md_client.snap deleted file mode 100644 index c1991a68eb..0000000000 --- a/tests/snapshots/execution_spec__test-params-as-body.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - firstUser(id: Int, name: String): User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-params-as-body.md_merged.snap b/tests/snapshots/execution_spec__test-params-as-body.md_merged.snap deleted file mode 100644 index 43208953b7..0000000000 --- a/tests/snapshots/execution_spec__test-params-as-body.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - firstUser(id: Int, name: String): User @http(body: "{{args}}", method: "POST", path: "/users") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-query-documentation.md_client.snap b/tests/snapshots/execution_spec__test-query-documentation.md_client.snap deleted file mode 100644 index 1516100009..0000000000 --- a/tests/snapshots/execution_spec__test-query-documentation.md_client.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - """ - This is test - """ - foo: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-query-documentation.md_merged.snap b/tests/snapshots/execution_spec__test-query-documentation.md_merged.snap deleted file mode 100644 index ecbc0275e9..0000000000 --- a/tests/snapshots/execution_spec__test-query-documentation.md_merged.snap +++ /dev/null @@ -1,14 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Query { - """ - This is test - """ - foo: String @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-query.md_client.snap b/tests/snapshots/execution_spec__test-query.md_client.snap deleted file mode 100644 index 98032c71c4..0000000000 --- a/tests/snapshots/execution_spec__test-query.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-query.md_merged.snap b/tests/snapshots/execution_spec__test-query.md_merged.snap deleted file mode 100644 index a6285a3b09..0000000000 --- a/tests/snapshots/execution_spec__test-query.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Query { - foo: String @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-ref-other.md_client.snap b/tests/snapshots/execution_spec__test-ref-other.md_client.snap deleted file mode 100644 index 848d82384b..0000000000 --- a/tests/snapshots/execution_spec__test-ref-other.md_client.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -type InPost { - get: [Post] -} - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int! - userId: Int! -} - -type Query { - posts: InPost -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-ref-other.md_merged.snap b/tests/snapshots/execution_spec__test-ref-other.md_merged.snap deleted file mode 100644 index 6ae6460ed4..0000000000 --- a/tests/snapshots/execution_spec__test-ref-other.md_merged.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type InPost { - get: [Post] @http(path: "/posts") -} - -type Post { - id: Int! - userId: Int! -} - -type Query { - posts: InPost -} diff --git a/tests/snapshots/execution_spec__test-response-header-merge.md_merged.snap b/tests/snapshots/execution_spec__test-response-header-merge.md_merged.snap deleted file mode 100644 index 7645fea9ce..0000000000 --- a/tests/snapshots/execution_spec__test-response-header-merge.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {custom: [{key: "a", value: "a"}, {key: "a", value: "b"}]}) @upstream { - query: Query -} - -type Query { - user: User @expr(body: {name: "John"}) -} - -type User { - age: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_0.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_0.snap deleted file mode 100644 index 2b6b008df5..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_0.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "email": "alo@valid.com" - } - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_1.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_1.snap deleted file mode 100644 index b1a613afcf..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_1.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "phone": "+1 (614) 1234567" - } - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_2.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_2.snap deleted file mode 100644 index e4afce338b..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_2.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "date": "2023-03-08T12:45:26-05:00" - } - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_3.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_3.snap deleted file mode 100644 index 372f6a74b0..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_3.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "url": "https://tailcall.run/" - } - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_4.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_4.snap deleted file mode 100644 index a59ad47ddc..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_4.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "internal: invalid value for scalar \"Email\", expected \"FieldValue::Value\"", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "email" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_5.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_5.snap deleted file mode 100644 index b8191a4710..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_5.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "internal: invalid value for scalar \"PhoneNumber\", expected \"FieldValue::Value\"", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "phone" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_6.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_6.snap deleted file mode 100644 index b8191a4710..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_6.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "internal: invalid value for scalar \"PhoneNumber\", expected \"FieldValue::Value\"", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "phone" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_7.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_7.snap deleted file mode 100644 index 63f505d5ad..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_7.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "internal: invalid value for scalar \"Date\", expected \"FieldValue::Value\"", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "date" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_assert_8.snap b/tests/snapshots/execution_spec__test-scalars.md_assert_8.snap deleted file mode 100644 index 064486f525..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_assert_8.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "internal: invalid value for scalar \"Url\", expected \"FieldValue::Value\"", - "locations": [ - { - "line": 1, - "column": 3 - } - ], - "path": [ - "url" - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_client.snap b/tests/snapshots/execution_spec__test-scalars.md_client.snap deleted file mode 100644 index 8e71d5cb24..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_client.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - date(value: Date!): Date! - email(value: Email!): Email! - phone(value: PhoneNumber!): PhoneNumber! - url(value: Url!): Url! -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-scalars.md_merged.snap b/tests/snapshots/execution_spec__test-scalars.md_merged.snap deleted file mode 100644 index aaad5c76cd..0000000000 --- a/tests/snapshots/execution_spec__test-scalars.md_merged.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(graphiql: true, hostname: "localhost", port: 8000) @upstream { - query: Query -} - -scalar Date - -scalar Email - -scalar PhoneNumber - -scalar Url - -type Query { - date(value: Date!): Date! @expr(body: "{{args.value}}") - email(value: Email!): Email! @expr(body: "{{args.value}}") - phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{args.value}}") - url(value: Url!): Url! @expr(body: "{{args.value}}") -} diff --git a/tests/snapshots/execution_spec__test-server-base-types.md_merged.snap b/tests/snapshots/execution_spec__test-server-base-types.md_merged.snap deleted file mode 100644 index bf786889b4..0000000000 --- a/tests/snapshots/execution_spec__test-server-base-types.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(port: 8000) @upstream(baseURL: "http://abc.com", proxy: {url: "http://localhost:3000"}) { - query: Query -} - -type Query { - hello: String @expr(body: "world") -} diff --git a/tests/snapshots/execution_spec__test-server-vars.md_client.snap b/tests/snapshots/execution_spec__test-server-vars.md_client.snap deleted file mode 100644 index 98032c71c4..0000000000 --- a/tests/snapshots/execution_spec__test-server-vars.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-server-vars.md_merged.snap b/tests/snapshots/execution_spec__test-server-vars.md_merged.snap deleted file mode 100644 index cc35cd7bd6..0000000000 --- a/tests/snapshots/execution_spec__test-server-vars.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(vars: [{key: "foo", value: "bar"}]) @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type Query { - foo: String @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-set-cookie-headers.md_assert_0.snap b/tests/snapshots/execution_spec__test-set-cookie-headers.md_assert_0.snap deleted file mode 100644 index 9d0f9afeec..0000000000 --- a/tests/snapshots/execution_spec__test-set-cookie-headers.md_assert_0.snap +++ /dev/null @@ -1,21 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json", - "set-cookie": "user=1; user=2" - }, - "body": { - "data": { - "u1": { - "name": "foo" - }, - "u2": { - "name": "bar" - } - } - } -} diff --git a/tests/snapshots/execution_spec__test-set-cookie-headers.md_client.snap b/tests/snapshots/execution_spec__test-set-cookie-headers.md_client.snap deleted file mode 100644 index ea1bbf5089..0000000000 --- a/tests/snapshots/execution_spec__test-set-cookie-headers.md_client.snap +++ /dev/null @@ -1,32 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-set-cookie-headers.md_merged.snap b/tests/snapshots/execution_spec__test-set-cookie-headers.md_merged.snap deleted file mode 100644 index e85a406976..0000000000 --- a/tests/snapshots/execution_spec__test-set-cookie-headers.md_merged.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server(headers: {setCookies: true}, graphiql: true, hostname: "0.0.0.0", port: 8080) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") -} - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String -} diff --git a/tests/snapshots/execution_spec__test-static-value.md_assert_0.snap b/tests/snapshots/execution_spec__test-static-value.md_assert_0.snap deleted file mode 100644 index 0204fa30dc..0000000000 --- a/tests/snapshots/execution_spec__test-static-value.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "firstUser": { - "name": "Leanne Graham" - } - } - } -} diff --git a/tests/snapshots/execution_spec__test-static-value.md_client.snap b/tests/snapshots/execution_spec__test-static-value.md_client.snap deleted file mode 100644 index 2ae445a996..0000000000 --- a/tests/snapshots/execution_spec__test-static-value.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - firstUser: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-static-value.md_merged.snap b/tests/snapshots/execution_spec__test-static-value.md_merged.snap deleted file mode 100644 index 3ff90146b1..0000000000 --- a/tests/snapshots/execution_spec__test-static-value.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - firstUser: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__test-tag.md_client.snap b/tests/snapshots/execution_spec__test-tag.md_client.snap deleted file mode 100644 index c2704ce434..0000000000 --- a/tests/snapshots/execution_spec__test-tag.md_client.snap +++ /dev/null @@ -1,38 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -type NEWS { - getAllNews: News__NewsList! -} - -type News__News { - body: String - id: Int - postImage: String - title: String -} - -type News__NewsList { - news: [News__News] -} - -scalar PhoneNumber - -type Query { - news: NEWS -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-tag.md_merged.snap b/tests/snapshots/execution_spec__test-tag.md_merged.snap deleted file mode 100644 index 6cd46d4019..0000000000 --- a/tests/snapshots/execution_spec__test-tag.md_merged.snap +++ /dev/null @@ -1,26 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -type NEWS { - getAllNews: News__NewsList! -} - -type News__News @tag(id: "news.News") { - body: String @expr(body: "This is a news body") - id: Int @expr(body: 1) - postImage: String @expr(body: "http://example.com/image.jpg") - title: String @expr(body: "This is a news title") -} - -type News__NewsList @tag(id: "news.NewsList") { - news: [News__News] -} - -type Query { - news: NEWS -} diff --git a/tests/snapshots/execution_spec__test-union.md_client.snap b/tests/snapshots/execution_spec__test-union.md_client.snap deleted file mode 100644 index e9e1e630b0..0000000000 --- a/tests/snapshots/execution_spec__test-union.md_client.snap +++ /dev/null @@ -1,33 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -type Bar { - bar: String -} - -scalar Date - -scalar Email - -scalar Empty - -type Foo { - foo: String -} - -union FooBar = Bar | Foo - -scalar JSON - -scalar PhoneNumber - -type Query { - foo: FooBar -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-union.md_merged.snap b/tests/snapshots/execution_spec__test-union.md_merged.snap deleted file mode 100644 index 2973f0c44f..0000000000 --- a/tests/snapshots/execution_spec__test-union.md_merged.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { - query: Query -} - -scalar Baz - -union FooBar = Bar | Foo - -type Bar { - bar: String -} - -type Foo { - foo: String -} - -type Query { - foo: FooBar @http(path: "/foo") -} diff --git a/tests/snapshots/execution_spec__test-upstream-headers.md_assert_0.snap b/tests/snapshots/execution_spec__test-upstream-headers.md_assert_0.snap deleted file mode 100644 index 3042345c09..0000000000 --- a/tests/snapshots/execution_spec__test-upstream-headers.md_assert_0.snap +++ /dev/null @@ -1,22 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "posts": [ - { - "id": 11 - }, - { - "id": 3 - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__test-upstream-headers.md_client.snap b/tests/snapshots/execution_spec__test-upstream-headers.md_client.snap deleted file mode 100644 index ef9095a633..0000000000 --- a/tests/snapshots/execution_spec__test-upstream-headers.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - id: Int -} - -type Query { - posts: [Post] -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-upstream-headers.md_merged.snap b/tests/snapshots/execution_spec__test-upstream-headers.md_merged.snap deleted file mode 100644 index 41a9495bfe..0000000000 --- a/tests/snapshots/execution_spec__test-upstream-headers.md_merged.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(allowedHeaders: ["X-bar", "x-foo"], baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Post { - id: Int -} - -type Query { - posts: [Post] @http(path: "/posts") -} diff --git a/tests/snapshots/execution_spec__test-upstream.md_client.snap b/tests/snapshots/execution_spec__test-upstream.md_client.snap deleted file mode 100644 index 60f26910ce..0000000000 --- a/tests/snapshots/execution_spec__test-upstream.md_client.snap +++ /dev/null @@ -1,23 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - hello: String -} - -scalar Url - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__test-upstream.md_merged.snap b/tests/snapshots/execution_spec__test-upstream.md_merged.snap deleted file mode 100644 index e4413038b9..0000000000 --- a/tests/snapshots/execution_spec__test-upstream.md_merged.snap +++ /dev/null @@ -1,11 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(proxy: {url: "http://localhost:8085"}) { - query: Query -} - -type Query { - hello: String @http(baseURL: "http://localhost:8000", path: "/hello") -} diff --git a/tests/snapshots/execution_spec__upstream-batching.md_assert_0.snap b/tests/snapshots/execution_spec__upstream-batching.md_assert_0.snap deleted file mode 100644 index c1db4d440d..0000000000 --- a/tests/snapshots/execution_spec__upstream-batching.md_assert_0.snap +++ /dev/null @@ -1,20 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "u1": { - "id": 1 - }, - "u2": { - "id": 2 - } - } - } -} diff --git a/tests/snapshots/execution_spec__upstream-batching.md_client.snap b/tests/snapshots/execution_spec__upstream-batching.md_client.snap deleted file mode 100644 index 89319b393a..0000000000 --- a/tests/snapshots/execution_spec__upstream-batching.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int): User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__upstream-batching.md_merged.snap b/tests/snapshots/execution_spec__upstream-batching.md_merged.snap deleted file mode 100644 index 8e89795dc2..0000000000 --- a/tests/snapshots/execution_spec__upstream-batching.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { - query: Query -} - -type Query { - user(id: Int): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{args.id}}"}]) -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__upstream-fail-request.md_assert_0.snap b/tests/snapshots/execution_spec__upstream-fail-request.md_assert_0.snap deleted file mode 100644 index 0973768ee0..0000000000 --- a/tests/snapshots/execution_spec__upstream-fail-request.md_assert_0.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": null, - "errors": [ - { - "message": "IOException: Status code error", - "locations": [ - { - "line": 1, - "column": 9 - } - ] - } - ] - } -} diff --git a/tests/snapshots/execution_spec__upstream-fail-request.md_client.snap b/tests/snapshots/execution_spec__upstream-fail-request.md_client.snap deleted file mode 100644 index 84d2907e22..0000000000 --- a/tests/snapshots/execution_spec__upstream-fail-request.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user: User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__upstream-fail-request.md_merged.snap b/tests/snapshots/execution_spec__upstream-fail-request.md_merged.snap deleted file mode 100644 index 822924f58f..0000000000 --- a/tests/snapshots/execution_spec__upstream-fail-request.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__with-args-url.md_assert_0.snap b/tests/snapshots/execution_spec__with-args-url.md_assert_0.snap deleted file mode 100644 index c1d6f66212..0000000000 --- a/tests/snapshots/execution_spec__with-args-url.md_assert_0.snap +++ /dev/null @@ -1,17 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "name": "foo" - } - } - } -} diff --git a/tests/snapshots/execution_spec__with-args-url.md_client.snap b/tests/snapshots/execution_spec__with-args-url.md_client.snap deleted file mode 100644 index 33012a438b..0000000000 --- a/tests/snapshots/execution_spec__with-args-url.md_client.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): User -} - -scalar Url - -type User { - id: Int - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__with-args-url.md_merged.snap b/tests/snapshots/execution_spec__with-args-url.md_merged.snap deleted file mode 100644 index 3fadbfe68f..0000000000 --- a/tests/snapshots/execution_spec__with-args-url.md_merged.snap +++ /dev/null @@ -1,16 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Query { - user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/{{args.id}}") -} - -type User { - id: Int - name: String -} diff --git a/tests/snapshots/execution_spec__with-args.md_assert_0.snap b/tests/snapshots/execution_spec__with-args.md_assert_0.snap deleted file mode 100644 index 9e1032ec3c..0000000000 --- a/tests/snapshots/execution_spec__with-args.md_assert_0.snap +++ /dev/null @@ -1,19 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": [ - { - "name": "Leanne Graham" - } - ] - } - } -} diff --git a/tests/snapshots/execution_spec__with-args.md_client.snap b/tests/snapshots/execution_spec__with-args.md_client.snap deleted file mode 100644 index 3842039749..0000000000 --- a/tests/snapshots/execution_spec__with-args.md_client.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Query { - user(id: Int!): [User] -} - -scalar Url - -type User { - name: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__with-args.md_merged.snap b/tests/snapshots/execution_spec__with-args.md_merged.snap deleted file mode 100644 index b91da6e13a..0000000000 --- a/tests/snapshots/execution_spec__with-args.md_merged.snap +++ /dev/null @@ -1,15 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream { - query: Query -} - -type Query { - user(id: Int!): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{args.id}}"}]) -} - -type User { - name: String -} diff --git a/tests/snapshots/execution_spec__with-nesting.md_assert_0.snap b/tests/snapshots/execution_spec__with-nesting.md_assert_0.snap deleted file mode 100644 index e99fb28e7e..0000000000 --- a/tests/snapshots/execution_spec__with-nesting.md_assert_0.snap +++ /dev/null @@ -1,27 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: response ---- -{ - "status": 200, - "headers": { - "content-type": "application/json" - }, - "body": { - "data": { - "user": { - "posts": [ - { - "title": "title1" - }, - { - "title": "title2" - }, - { - "title": "title3" - } - ] - } - } - } -} diff --git a/tests/snapshots/execution_spec__with-nesting.md_client.snap b/tests/snapshots/execution_spec__with-nesting.md_client.snap deleted file mode 100644 index b7c8c5e8bc..0000000000 --- a/tests/snapshots/execution_spec__with-nesting.md_client.snap +++ /dev/null @@ -1,40 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: client ---- -scalar Date - -scalar Email - -scalar Empty - -scalar JSON - -scalar PhoneNumber - -type Post { - body: String - id: Int - title: String - userId: Int -} - -type Query { - user: User -} - -scalar Url - -type User { - email: String! - id: Int! - name: String! - phone: String - posts: [Post] - username: String! - website: String -} - -schema { - query: Query -} diff --git a/tests/snapshots/execution_spec__with-nesting.md_merged.snap b/tests/snapshots/execution_spec__with-nesting.md_merged.snap deleted file mode 100644 index ce41127c54..0000000000 --- a/tests/snapshots/execution_spec__with-nesting.md_merged.snap +++ /dev/null @@ -1,28 +0,0 @@ ---- -source: tests/execution_spec.rs -expression: merged ---- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { - query: Query -} - -type Post { - body: String - id: Int - title: String - userId: Int -} - -type Query { - user: User @http(path: "/users/1") -} - -type User { - email: String! - id: Int! - name: String! - phone: String - posts: [Post] @http(path: "/users/{{value.id}}/posts") - username: String! - website: String -}