diff --git a/Cargo.lock b/Cargo.lock index c0bc88167d..d08cf15af9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3582,9 +3582,9 @@ checksum = "17359afc20d7ab31fdb42bb844c8b3bb1dabd7dcf7e68428492da7f16966fcef" [[package]] name = "pathdiff" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8835116a5c179084a830efb3adc117ab007512b535bc1a21c991d3b32a6b44dd" +checksum = "d61c5ce1153ab5b689d0c074c4e7fc613e942dfb7dd9eea5ab202d2ad91fe361" [[package]] name = "pem" diff --git a/src/core/http/query_encoder.rs b/src/core/http/query_encoder.rs index af6ca4f310..208c7a9cc4 100644 --- a/src/core/http/query_encoder.rs +++ b/src/core/http/query_encoder.rs @@ -64,6 +64,7 @@ pub fn convert_value(value: &async_graphql::Value) -> Option { async_graphql::Value::String(s) => Some(s.to_string()), async_graphql::Value::Number(n) => Some(n.to_string()), async_graphql::Value::Boolean(b) => Some(b.to_string()), + async_graphql::Value::Enum(e) => Some(e.to_string()), _ => None, } } diff --git a/tailcall-cloudflare/package-lock.json b/tailcall-cloudflare/package-lock.json index b162bf101e..b2d7d95d16 100644 --- a/tailcall-cloudflare/package-lock.json +++ b/tailcall-cloudflare/package-lock.json @@ -27,9 +27,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240925.0.tgz", - "integrity": "sha512-KdLnSXuzB65CbqZPm+qYzk+zkQ1tUNPaaRGYVd/jPYAxwwtfTUQdQ+ahDPwVVs2tmQELKy7ZjQjf2apqSWUfjw==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241004.0.tgz", + "integrity": "sha512-c2afR486NXDRcPm7RaTSRDnffFklPCXde/IeNVhEhBJ8O+pQhBOdDcGIy8zXPwMu0CYga0iHNZmpbsl+ZcHttA==", "cpu": [ "x64" ], @@ -43,9 +43,9 @@ } }, "node_modules/@cloudflare/workerd-darwin-arm64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240925.0.tgz", - "integrity": "sha512-MiQ6uUmCXjsXgWNV+Ock2tp2/tYqNJGzjuaH6jFioeRF+//mz7Tv7J7EczOL4zq+TH8QFOh0/PUsLyazIWVGng==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241004.0.tgz", + "integrity": "sha512-siD9fexv5lr2IpBczWV7OPgJvHj8/fJUrRAYCMcBURkfiwssK91coQeZlN1NdQ85aYELVgxDFoG+p86OS+ZzLw==", "cpu": [ "arm64" ], @@ -59,9 +59,9 @@ } }, "node_modules/@cloudflare/workerd-linux-64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240925.0.tgz", - "integrity": "sha512-Rjix8jsJMfsInmq3Hm3fmiRQ+rwzuWRPV1pg/OWhMSfNP7Qp2RCU+RGkhgeR9Z5eNAje0Sn2BMrFq4RvF9/yRA==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241004.0.tgz", + "integrity": "sha512-EtKGXO5fzRgX6UhDDLhjjEsB1QtliHb12zavZ/S0C8hKPz76II7MQ3Lls9kfB62fbdMP8L6vcqWPObEUcw6GSw==", "cpu": [ "x64" ], @@ -75,9 +75,9 @@ } }, "node_modules/@cloudflare/workerd-linux-arm64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240925.0.tgz", - "integrity": "sha512-VYIPeMHQRtbwQoIjUwS/zULlywPxyDvo46XkTpIW5MScEChfqHvAYviQ7TzYGx6Q+gmZmN+DUB2KOMx+MEpCxA==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241004.0.tgz", + "integrity": "sha512-XO7VBE1YaFf/o9tKO1PqDqaxkU2eAR2DLX7R0+R8p+q92sUDXyoxo48T3yJDfxWndnKJ6hSJfvKanw3Mq9Tisw==", "cpu": [ "arm64" ], @@ -91,9 +91,9 @@ } }, "node_modules/@cloudflare/workerd-windows-64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240925.0.tgz", - "integrity": "sha512-C8peGvaU5R51bIySi1VbyfRgwNSSRknqoFSnSbSBI3uTN3THTB3UnmRKy7GXJDmyjgXuT9Pcs1IgaWNubLtNtw==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241004.0.tgz", + "integrity": "sha512-o+TmCYGq58jNUDbG73xOvd648XvJ2TicI++2BBoySklJXG6f4But5AwA8TxQgmeujR3vpBjPZKexEzcZSUOTtA==", "cpu": [ "x64" ], @@ -107,9 +107,9 @@ } }, "node_modules/@cloudflare/workers-shared": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.5.4.tgz", - "integrity": "sha512-PNL/0TjKRdUHa1kwgVdqUNJVZ9ez4kacsi8omz+gv859EvJmsVuGiMAClY2YfJnC9LVKhKCcjqmFgKNXG9/IXA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.6.0.tgz", + "integrity": "sha512-rfUCvb3hx4AsvdUZsxgk9lmgEnQehqV3jdtXLP/Xr0+P56n11T/0nXNMzmn7Nnv+IJFOV6X9NmFhuMz4sBPw7w==", "dev": true, "dependencies": { "mime": "^3.0.0", @@ -120,9 +120,9 @@ } }, "node_modules/@cloudflare/workers-types": { - "version": "4.20241004.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241004.0.tgz", - "integrity": "sha512-3LrPvtecs4umknOF1bTPNLHUG/ZjeSE6PYBQ/tbO7lwaVhjZTaTugiaCny2byrZupBlVNuubQVktcAgMfw0C1A==", + "version": "4.20241011.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241011.0.tgz", + "integrity": "sha512-emwBnuFB/2lS1z6NXAeBqrSL8Xwnr7YpgdLuchOmgu/igqBsLLNPBb4Qmgh3neFWUe9wbzQyx030836YF3c3Xw==", "dev": true }, "node_modules/@cspotcode/source-map-support": { @@ -1324,9 +1324,9 @@ } }, "node_modules/miniflare": { - "version": "3.20240925.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240925.1.tgz", - "integrity": "sha512-odavnAwWLevMWOi/efIdAI9AVlg8C8NfXe2YLoAeG+Fj5BDHPDxCoY7AjZvBj3CJ7bszkoYyhoPEH60X+Vk+7g==", + "version": "3.20241004.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241004.0.tgz", + "integrity": "sha512-QSSmCR2V1AJnnpYwlyLXobKLSGiY1FlAiZYULMdGgOUThV7HJeSysDxsmPmrH+D4GQbmUERnmDdB6M6Rrz7uPg==", "dev": true, "dependencies": { "@cspotcode/source-map-support": "0.8.1", @@ -1337,7 +1337,7 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.4", - "workerd": "1.20240925.0", + "workerd": "1.20241004.0", "ws": "^8.17.1", "youch": "^3.2.2", "zod": "^3.22.3" @@ -1947,9 +1947,9 @@ } }, "node_modules/workerd": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240925.0.tgz", - "integrity": "sha512-/Jj6+yLwfieZGEt3Kx4+5MoufuC3g/8iFaIh4MPBNGJOGYmdSKXvgCqz09m2+tVCYnysRfbq2zcbVxJRBfOCqQ==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241004.0.tgz", + "integrity": "sha512-TCFJ7Zw7svR3adg1fnlPWj/yXhjBnQloLEIJqdu57hli/GsgwlbomwrbM3mdMgbS+K9zYeaYqknXiBN0EXk3QQ==", "dev": true, "hasInstallScript": true, "bin": { @@ -1959,27 +1959,27 @@ "node": ">=16" }, "optionalDependencies": { - "@cloudflare/workerd-darwin-64": "1.20240925.0", - "@cloudflare/workerd-darwin-arm64": "1.20240925.0", - "@cloudflare/workerd-linux-64": "1.20240925.0", - "@cloudflare/workerd-linux-arm64": "1.20240925.0", - "@cloudflare/workerd-windows-64": "1.20240925.0" + "@cloudflare/workerd-darwin-64": "1.20241004.0", + "@cloudflare/workerd-darwin-arm64": "1.20241004.0", + "@cloudflare/workerd-linux-64": "1.20241004.0", + "@cloudflare/workerd-linux-arm64": "1.20241004.0", + "@cloudflare/workerd-windows-64": "1.20241004.0" } }, "node_modules/wrangler": { - "version": "3.80.3", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.80.3.tgz", - "integrity": "sha512-Qe/7Sp8Vf7LYrdLPVsQFznac/1FweLI4aRgHmdCr6SCP5V81PP5ArogQX6BcuZ1tHvtNLNk4B4JC39awJdZvUg==", + "version": "3.80.4", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.80.4.tgz", + "integrity": "sha512-DyNvShtVH3k7ZyBndlIiwyRDXqtHr3g01hxwn4FfwKlAaT6EL0wb3KL3UGbsdpeM/xbJiUQxFQ4WuFBWgZS18Q==", "dev": true, "dependencies": { "@cloudflare/kv-asset-handler": "0.3.4", - "@cloudflare/workers-shared": "0.5.4", + "@cloudflare/workers-shared": "0.6.0", "@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.20240925.1", + "miniflare": "3.20241004.0", "nanoid": "^3.3.3", "path-to-regexp": "^6.3.0", "resolve": "^1.22.8", @@ -1987,7 +1987,7 @@ "selfsigned": "^2.0.1", "source-map": "^0.6.1", "unenv": "npm:unenv-nightly@2.0.0-20241009-125958-e8ea22f", - "workerd": "1.20240925.0", + "workerd": "1.20241004.0", "xxhash-wasm": "^1.0.1" }, "bin": { @@ -2001,7 +2001,7 @@ "fsevents": "~2.3.2" }, "peerDependencies": { - "@cloudflare/workers-types": "^4.20240925.0" + "@cloudflare/workers-types": "^4.20241004.0" }, "peerDependenciesMeta": { "@cloudflare/workers-types": { @@ -2457,44 +2457,44 @@ } }, "@cloudflare/workerd-darwin-64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20240925.0.tgz", - "integrity": "sha512-KdLnSXuzB65CbqZPm+qYzk+zkQ1tUNPaaRGYVd/jPYAxwwtfTUQdQ+ahDPwVVs2tmQELKy7ZjQjf2apqSWUfjw==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-64/-/workerd-darwin-64-1.20241004.0.tgz", + "integrity": "sha512-c2afR486NXDRcPm7RaTSRDnffFklPCXde/IeNVhEhBJ8O+pQhBOdDcGIy8zXPwMu0CYga0iHNZmpbsl+ZcHttA==", "dev": true, "optional": true }, "@cloudflare/workerd-darwin-arm64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20240925.0.tgz", - "integrity": "sha512-MiQ6uUmCXjsXgWNV+Ock2tp2/tYqNJGzjuaH6jFioeRF+//mz7Tv7J7EczOL4zq+TH8QFOh0/PUsLyazIWVGng==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-darwin-arm64/-/workerd-darwin-arm64-1.20241004.0.tgz", + "integrity": "sha512-siD9fexv5lr2IpBczWV7OPgJvHj8/fJUrRAYCMcBURkfiwssK91coQeZlN1NdQ85aYELVgxDFoG+p86OS+ZzLw==", "dev": true, "optional": true }, "@cloudflare/workerd-linux-64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20240925.0.tgz", - "integrity": "sha512-Rjix8jsJMfsInmq3Hm3fmiRQ+rwzuWRPV1pg/OWhMSfNP7Qp2RCU+RGkhgeR9Z5eNAje0Sn2BMrFq4RvF9/yRA==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-64/-/workerd-linux-64-1.20241004.0.tgz", + "integrity": "sha512-EtKGXO5fzRgX6UhDDLhjjEsB1QtliHb12zavZ/S0C8hKPz76II7MQ3Lls9kfB62fbdMP8L6vcqWPObEUcw6GSw==", "dev": true, "optional": true }, "@cloudflare/workerd-linux-arm64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20240925.0.tgz", - "integrity": "sha512-VYIPeMHQRtbwQoIjUwS/zULlywPxyDvo46XkTpIW5MScEChfqHvAYviQ7TzYGx6Q+gmZmN+DUB2KOMx+MEpCxA==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-linux-arm64/-/workerd-linux-arm64-1.20241004.0.tgz", + "integrity": "sha512-XO7VBE1YaFf/o9tKO1PqDqaxkU2eAR2DLX7R0+R8p+q92sUDXyoxo48T3yJDfxWndnKJ6hSJfvKanw3Mq9Tisw==", "dev": true, "optional": true }, "@cloudflare/workerd-windows-64": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20240925.0.tgz", - "integrity": "sha512-C8peGvaU5R51bIySi1VbyfRgwNSSRknqoFSnSbSBI3uTN3THTB3UnmRKy7GXJDmyjgXuT9Pcs1IgaWNubLtNtw==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workerd-windows-64/-/workerd-windows-64-1.20241004.0.tgz", + "integrity": "sha512-o+TmCYGq58jNUDbG73xOvd648XvJ2TicI++2BBoySklJXG6f4But5AwA8TxQgmeujR3vpBjPZKexEzcZSUOTtA==", "dev": true, "optional": true }, "@cloudflare/workers-shared": { - "version": "0.5.4", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.5.4.tgz", - "integrity": "sha512-PNL/0TjKRdUHa1kwgVdqUNJVZ9ez4kacsi8omz+gv859EvJmsVuGiMAClY2YfJnC9LVKhKCcjqmFgKNXG9/IXA==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-shared/-/workers-shared-0.6.0.tgz", + "integrity": "sha512-rfUCvb3hx4AsvdUZsxgk9lmgEnQehqV3jdtXLP/Xr0+P56n11T/0nXNMzmn7Nnv+IJFOV6X9NmFhuMz4sBPw7w==", "dev": true, "requires": { "mime": "^3.0.0", @@ -2502,9 +2502,9 @@ } }, "@cloudflare/workers-types": { - "version": "4.20241004.0", - "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241004.0.tgz", - "integrity": "sha512-3LrPvtecs4umknOF1bTPNLHUG/ZjeSE6PYBQ/tbO7lwaVhjZTaTugiaCny2byrZupBlVNuubQVktcAgMfw0C1A==", + "version": "4.20241011.0", + "resolved": "https://registry.npmjs.org/@cloudflare/workers-types/-/workers-types-4.20241011.0.tgz", + "integrity": "sha512-emwBnuFB/2lS1z6NXAeBqrSL8Xwnr7YpgdLuchOmgu/igqBsLLNPBb4Qmgh3neFWUe9wbzQyx030836YF3c3Xw==", "dev": true }, "@cspotcode/source-map-support": { @@ -3244,9 +3244,9 @@ "dev": true }, "miniflare": { - "version": "3.20240925.1", - "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20240925.1.tgz", - "integrity": "sha512-odavnAwWLevMWOi/efIdAI9AVlg8C8NfXe2YLoAeG+Fj5BDHPDxCoY7AjZvBj3CJ7bszkoYyhoPEH60X+Vk+7g==", + "version": "3.20241004.0", + "resolved": "https://registry.npmjs.org/miniflare/-/miniflare-3.20241004.0.tgz", + "integrity": "sha512-QSSmCR2V1AJnnpYwlyLXobKLSGiY1FlAiZYULMdGgOUThV7HJeSysDxsmPmrH+D4GQbmUERnmDdB6M6Rrz7uPg==", "dev": true, "requires": { "@cspotcode/source-map-support": "0.8.1", @@ -3257,7 +3257,7 @@ "glob-to-regexp": "^0.4.1", "stoppable": "^1.1.0", "undici": "^5.28.4", - "workerd": "1.20240925.0", + "workerd": "1.20241004.0", "ws": "^8.17.1", "youch": "^3.2.2", "zod": "^3.22.3" @@ -3665,33 +3665,33 @@ } }, "workerd": { - "version": "1.20240925.0", - "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20240925.0.tgz", - "integrity": "sha512-/Jj6+yLwfieZGEt3Kx4+5MoufuC3g/8iFaIh4MPBNGJOGYmdSKXvgCqz09m2+tVCYnysRfbq2zcbVxJRBfOCqQ==", + "version": "1.20241004.0", + "resolved": "https://registry.npmjs.org/workerd/-/workerd-1.20241004.0.tgz", + "integrity": "sha512-TCFJ7Zw7svR3adg1fnlPWj/yXhjBnQloLEIJqdu57hli/GsgwlbomwrbM3mdMgbS+K9zYeaYqknXiBN0EXk3QQ==", "dev": true, "requires": { - "@cloudflare/workerd-darwin-64": "1.20240925.0", - "@cloudflare/workerd-darwin-arm64": "1.20240925.0", - "@cloudflare/workerd-linux-64": "1.20240925.0", - "@cloudflare/workerd-linux-arm64": "1.20240925.0", - "@cloudflare/workerd-windows-64": "1.20240925.0" + "@cloudflare/workerd-darwin-64": "1.20241004.0", + "@cloudflare/workerd-darwin-arm64": "1.20241004.0", + "@cloudflare/workerd-linux-64": "1.20241004.0", + "@cloudflare/workerd-linux-arm64": "1.20241004.0", + "@cloudflare/workerd-windows-64": "1.20241004.0" } }, "wrangler": { - "version": "3.80.3", - "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.80.3.tgz", - "integrity": "sha512-Qe/7Sp8Vf7LYrdLPVsQFznac/1FweLI4aRgHmdCr6SCP5V81PP5ArogQX6BcuZ1tHvtNLNk4B4JC39awJdZvUg==", + "version": "3.80.4", + "resolved": "https://registry.npmjs.org/wrangler/-/wrangler-3.80.4.tgz", + "integrity": "sha512-DyNvShtVH3k7ZyBndlIiwyRDXqtHr3g01hxwn4FfwKlAaT6EL0wb3KL3UGbsdpeM/xbJiUQxFQ4WuFBWgZS18Q==", "dev": true, "requires": { "@cloudflare/kv-asset-handler": "0.3.4", - "@cloudflare/workers-shared": "0.5.4", + "@cloudflare/workers-shared": "0.6.0", "@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.20240925.1", + "miniflare": "3.20241004.0", "nanoid": "^3.3.3", "path-to-regexp": "^6.3.0", "resolve": "^1.22.8", @@ -3699,7 +3699,7 @@ "selfsigned": "^2.0.1", "source-map": "^0.6.1", "unenv": "npm:unenv-nightly@2.0.0-20241009-125958-e8ea22f", - "workerd": "1.20240925.0", + "workerd": "1.20241004.0", "xxhash-wasm": "^1.0.1" }, "dependencies": { diff --git a/tests/core/snapshots/test-enum-as-argument.md_0.snap b/tests/core/snapshots/test-enum-as-argument.md_0.snap new file mode 100644 index 0000000000..65b72721d6 --- /dev/null +++ b/tests/core/snapshots/test-enum-as-argument.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": "Json Schema" + } + } + } +} diff --git a/tests/core/snapshots/test-enum-as-argument.md_client.snap b/tests/core/snapshots/test-enum-as-argument.md_client.snap new file mode 100644 index 0000000000..bbeebabcdc --- /dev/null +++ b/tests/core/snapshots/test-enum-as-argument.md_client.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: formatted +--- +type Query { + user(id: Int!, test: Test): User +} + +enum Test { + A + B +} + +type User { + id: Int! + name: String! +} + +schema { + query: Query +} diff --git a/tests/core/snapshots/test-enum-as-argument.md_merged.snap b/tests/core/snapshots/test-enum-as-argument.md_merged.snap new file mode 100644 index 0000000000..79a95bb7c4 --- /dev/null +++ b/tests/core/snapshots/test-enum-as-argument.md_merged.snap @@ -0,0 +1,21 @@ +--- +source: tests/core/spec.rs +expression: formatter +--- +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +enum Test { + A + B +} + +type Query { + user(id: Int!, test: Test): User @http(path: "/users/{{.args.id}}", query: [{key: "enum", value: "{{.args.test}}"}]) +} + +type User { + id: Int! + name: String! +} diff --git a/tests/execution/test-enum-as-argument.md b/tests/execution/test-enum-as-argument.md new file mode 100644 index 0000000000..917b0a7e4b --- /dev/null +++ b/tests/execution/test-enum-as-argument.md @@ -0,0 +1,39 @@ +# test enum as argument + +```graphql @config +schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + query: Query +} + +type Query { + user(id: Int!, test: Test): User @http(path: "/users/{{.args.id}}", query: [{key: "enum", value: "{{.args.test}}"}]) +} + +enum Test { + A + B +} + +type User { + id: Int! + name: String! +} +``` + +```yml @mock +- request: + method: GET + url: http://jsonplaceholder.typicode.com/users/1?enum=A + response: + status: 200 + body: + id: 1 + name: Json Schema +``` + +```yml @test +- method: POST + url: http://localhost:8080/graphql + body: + query: "query { user(id: 1, test: A) { name } }" +```