diff --git a/Cargo.lock b/Cargo.lock index c7fc27e956..0c324a0693 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -820,12 +820,6 @@ version = "1.0.94" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17f6e324229dc011159fcc089755d1e2e216a90d43a7dea6853ca740b84f35e7" -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - [[package]] name = "cfg-if" version = "1.0.0" @@ -948,16 +942,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "combine" -version = "4.6.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba5a308b75df32fe02788e748662718f03fde005016435c444eea572398219fd" -dependencies = [ - "bytes", - "memchr", -] - [[package]] name = "concurrent-queue" version = "2.4.0" @@ -2624,28 +2608,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - [[package]] name = "js-sys" version = "0.3.69" @@ -2999,15 +2961,6 @@ dependencies = [ "linked-hash-map", ] -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - [[package]] name = "maplit" version = "1.0.2" @@ -3197,12 +3150,6 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "defc4c55412d89136f966bbb339008b474350e5e6e78d2714439c386b3137a03" -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - [[package]] name = "new_debug_unreachable" version = "1.0.6" @@ -3316,15 +3263,6 @@ dependencies = [ "libloading", ] -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", -] - [[package]] name = "object" version = "0.32.2" @@ -4202,12 +4140,6 @@ dependencies = [ "bitflags 2.5.0", ] -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - [[package]] name = "rayon" version = "1.10.0" @@ -5257,7 +5189,6 @@ dependencies = [ "ttl_cache", "update-informer", "url", - "webbrowser", "which 6.0.1", ] @@ -6224,23 +6155,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "webbrowser" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b6f804e41d0852e16d2eaee61c7e4f7d3e8ffdb7b8ed85886aeb0791fe9fcd" -dependencies = [ - "core-foundation", - "home", - "jni", - "log", - "ndk-context", - "objc", - "raw-window-handle", - "url", - "web-sys", -] - [[package]] name = "webpki-roots" version = "0.25.4" @@ -6324,15 +6238,6 @@ dependencies = [ "windows-targets 0.52.5", ] -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - [[package]] name = "windows-sys" version = "0.48.0" @@ -6351,21 +6256,6 @@ dependencies = [ "windows-targets 0.52.5", ] -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-targets" version = "0.48.5" @@ -6397,12 +6287,6 @@ dependencies = [ "windows_x86_64_msvc 0.52.5", ] -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -6415,12 +6299,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -6433,12 +6311,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -6457,12 +6329,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -6475,12 +6341,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -6493,12 +6353,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -6511,12 +6365,6 @@ version = "0.52.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - [[package]] name = "windows_x86_64_msvc" version = "0.48.5" diff --git a/Cargo.toml b/Cargo.toml index c35564aaaf..f0f401d1fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -79,7 +79,6 @@ 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 = "1.0.0", features = ["hardened", "disable-wsl"] } async-std = { version = "1.12.0", features = [ "wasm-bindgen-futures", "unstable", diff --git a/README.md b/README.md index 646291f793..e11bd0c634 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ The below file is a standard `.graphQL` file, with a few additions such as `@ser ```graphql schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { query: Query } diff --git a/ci-benchmark/benchmark.graphql b/ci-benchmark/benchmark.graphql index aac44a69ad..56d3a5e041 100644 --- a/ci-benchmark/benchmark.graphql +++ b/ci-benchmark/benchmark.graphql @@ -1,6 +1,4 @@ -schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com") { query: Query } diff --git a/examples/apollo-tracing.graphql b/examples/apollo-tracing.graphql index d1718b676d..550a174bae 100644 --- a/examples/apollo-tracing.graphql +++ b/examples/apollo-tracing.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com") @telemetry(export: {apollo: {apiKey: "1234", graphRef: "abc@123"}}) { query: Query diff --git a/examples/auth.graphql b/examples/auth.graphql index f8d50d242e..07b69ea0a0 100644 --- a/examples/auth.graphql +++ b/examples/auth.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(id: "auth-basic", type: Htpasswd, src: ".htpasswd") @link(id: "auth-jwt", type: Jwks, src: ".jwks") { diff --git a/examples/call.graphql b/examples/call.graphql index 76da11d1d0..f0af6d6a51 100644 --- a/examples/call.graphql +++ b/examples/call.graphql @@ -1,4 +1,4 @@ -schema @server(graphiql: true) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @upstream(baseURL: "http://jsonplaceholder.typicode.com") { query: Query } diff --git a/examples/cors.graphql b/examples/cors.graphql index 3d4c4af23a..7e1a78a34b 100644 --- a/examples/cors.graphql +++ b/examples/cors.graphql @@ -1,7 +1,6 @@ schema @server( port: 8000 - graphiql: true hostname: "0.0.0.0" headers: {cors: {allowOrigins: ["*"], allowHeaders: ["*"], allowMethods: [POST, GET, OPTIONS]}} ) diff --git a/examples/graphql-composition.graphql b/examples/graphql-composition.graphql index e7079e1250..4666a2af82 100644 --- a/examples/graphql-composition.graphql +++ b/examples/graphql-composition.graphql @@ -3,7 +3,7 @@ # and then you can run this example and test it on 8001 port schema - @server(port: 8001, graphiql: true, queryValidation: false, hostname: "0.0.0.0") + @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(baseURL: "http://localhost:8000/graphql", httpCache: true, batch: {delay: 1}) { query: Query } diff --git a/examples/grpc-reflection.graphql b/examples/grpc-reflection.graphql index 1d96f10149..b2099d7876 100644 --- a/examples/grpc-reflection.graphql +++ b/examples/grpc-reflection.graphql @@ -1,6 +1,6 @@ # for test upstream server see [repo](https://github.com/tailcallhq/tailcall/tree/main/tailcall-upstream-grpc) schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(baseURL: "http://localhost:50051", httpCache: true, batch: {delay: 10}) @link(src: "http://localhost:50051", type: Grpc) { query: Query diff --git a/examples/grpc.graphql b/examples/grpc.graphql index e358218d71..2828b82d22 100644 --- a/examples/grpc.graphql +++ b/examples/grpc.graphql @@ -1,6 +1,6 @@ # for test upstream server see [repo](https://github.com/tailcallhq/rust-grpc) schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(baseURL: "http://localhost:50051", httpCache: true, batch: {delay: 10}) @link(id: "news", src: "../tailcall-fixtures/fixtures/protobuf/news.proto", type: Protobuf) { query: Query diff --git a/examples/jsonplaceholder.json b/examples/jsonplaceholder.json index e50eb02ed2..f38a74e343 100644 --- a/examples/jsonplaceholder.json +++ b/examples/jsonplaceholder.json @@ -1,7 +1,6 @@ { "$schema": "./.tailcallrc.schema.json", "server": { - "graphiql": true, "hostname": "0.0.0.0", "port": 8000 }, diff --git a/examples/jsonplaceholder.yml b/examples/jsonplaceholder.yml index c6224182f2..17bdbb7e8e 100644 --- a/examples/jsonplaceholder.yml +++ b/examples/jsonplaceholder.yml @@ -1,5 +1,4 @@ server: - graphiql: true hostname: 0.0.0.0 port: 8000 upstream: diff --git a/examples/jsonplaceholder_batch.graphql b/examples/jsonplaceholder_batch.graphql index 4c5eb45081..bb54487aab 100644 --- a/examples/jsonplaceholder_batch.graphql +++ b/examples/jsonplaceholder_batch.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true, batch: {delay: 1, maxSize: 1000}) { query: Query } diff --git a/examples/jsonplaceholder_batch.json b/examples/jsonplaceholder_batch.json index 9d2c754e4a..9b46cafcf6 100644 --- a/examples/jsonplaceholder_batch.json +++ b/examples/jsonplaceholder_batch.json @@ -1,7 +1,6 @@ { "server": { - "port": 8000, - "graphiql": true + "port": 8000 }, "upstream": { "baseURL": "http://jsonplaceholder.typicode.com", diff --git a/examples/jsonplaceholder_batch.yml b/examples/jsonplaceholder_batch.yml index d1f1c9fb7b..1a280b638e 100644 --- a/examples/jsonplaceholder_batch.yml +++ b/examples/jsonplaceholder_batch.yml @@ -1,6 +1,5 @@ server: port: 8000 - graphiql: true upstream: baseURL: http://jsonplaceholder.typicode.com httpCache: true diff --git a/examples/jsonplaceholder_http_2.graphql b/examples/jsonplaceholder_http_2.graphql index 5ac363643f..f09c2d33d1 100644 --- a/examples/jsonplaceholder_http_2.graphql +++ b/examples/jsonplaceholder_http_2.graphql @@ -1,5 +1,5 @@ schema - @server(port: 3000, graphiql: true, queryValidation: false, hostname: "0.0.0.0", version: HTTP2) + @server(port: 3000, queryValidation: false, hostname: "0.0.0.0", version: HTTP2) @link(type: Cert, src: "./example.crt") @link(type: Key, src: "./example.key") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { diff --git a/examples/jsonplaceholder_script.graphql b/examples/jsonplaceholder_script.graphql index ab23e05e47..0cfab82800 100644 --- a/examples/jsonplaceholder_script.graphql +++ b/examples/jsonplaceholder_script.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(type: Script, src: "scripts/echo.js") { query: Query diff --git a/examples/rest-api.graphql b/examples/rest-api.graphql index 11191d3586..59d39e8601 100644 --- a/examples/rest-api.graphql +++ b/examples/rest-api.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(type: Operation, src: "operations/routes.graphql") { query: Query diff --git a/examples/telemetry-otlp.graphql b/examples/telemetry-otlp.graphql index e256dfd79a..a6775f6c5e 100644 --- a/examples/telemetry-otlp.graphql +++ b/examples/telemetry-otlp.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(type: Operation, src: "operations/routes.graphql") @link(id: "news", src: "../tailcall-fixtures/fixtures/protobuf/news.proto", type: Protobuf) diff --git a/examples/telemetry-prometheus.graphql b/examples/telemetry-prometheus.graphql index 0fe17bd38d..e0ff49f1fb 100644 --- a/examples/telemetry-prometheus.graphql +++ b/examples/telemetry-prometheus.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @telemetry(export: {prometheus: {path: "/metrics"}}) { query: Query diff --git a/examples/telemetry-stdout.graphql b/examples/telemetry-stdout.graphql index 572d980a1e..1907d6e2b4 100644 --- a/examples/telemetry-stdout.graphql +++ b/examples/telemetry-stdout.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @telemetry(export: {stdout: {pretty: true}}) { query: Query diff --git a/generated/.tailcallrc.graphql b/generated/.tailcallrc.graphql index cbba820756..74378d082f 100644 --- a/generated/.tailcallrc.graphql +++ b/generated/.tailcallrc.graphql @@ -237,11 +237,6 @@ directive @server( """ globalResponseTimeout: Int """ - `graphiql` activates the GraphiQL IDE at the root path within Tailcall, a tool for - query development and testing. @default `false`. - """ - graphiql: Boolean - """ `headers` contains key-value pairs that are included as default headers in server responses, allowing for consistent header management across all responses. """ diff --git a/generated/.tailcallrc.schema.json b/generated/.tailcallrc.schema.json index 265020e9f4..d79fd4ec1a 100644 --- a/generated/.tailcallrc.schema.json +++ b/generated/.tailcallrc.schema.json @@ -961,13 +961,6 @@ ], "format": "int64" }, - "graphiql": { - "description": "`graphiql` activates the GraphiQL IDE at the root path within Tailcall, a tool for query development and testing. @default `false`.", - "type": [ - "boolean", - "null" - ] - }, "headers": { "description": "`headers` contains key-value pairs that are included as default headers in server responses, allowing for consistent header management across all responses.", "anyOf": [ diff --git a/src/blueprint/server.rs b/src/blueprint/server.rs index b62f8e63eb..5caaad887f 100644 --- a/src/blueprint/server.rs +++ b/src/blueprint/server.rs @@ -19,7 +19,6 @@ pub struct Server { pub enable_apollo_tracing: bool, pub enable_cache_control_header: bool, pub enable_set_cookie_header: bool, - pub enable_graphiql: bool, pub enable_introspection: bool, pub enable_query_validation: bool, pub enable_response_validation: bool, @@ -134,7 +133,6 @@ impl TryFrom for Server { enable_apollo_tracing: (config_server).enable_apollo_tracing(), enable_cache_control_header: (config_server).enable_cache_control(), enable_set_cookie_header: (config_server).enable_set_cookies(), - enable_graphiql: (config_server).enable_graphiql(), enable_introspection: (config_server).enable_introspection(), enable_query_validation: (config_server).enable_query_validation(), enable_response_validation: (config_server).enable_http_validation(), diff --git a/src/cli/server/http_1.rs b/src/cli/server/http_1.rs index 6d725483cd..2fa86de2b0 100644 --- a/src/cli/server/http_1.rs +++ b/src/cli/server/http_1.rs @@ -33,7 +33,7 @@ pub async fn start_http_1( let builder = hyper::Server::try_bind(&addr) .map_err(CLIError::from)? .http1_pipeline_flush(sc.app_ctx.blueprint.server.pipeline_flush); - super::log_launch_and_open_browser(sc.as_ref()); + super::log_launch(sc.as_ref()); if let Some(sender) = server_up_sender { sender diff --git a/src/cli/server/http_2.rs b/src/cli/server/http_2.rs index 0066d8bdbf..97ebe8df22 100644 --- a/src/cli/server/http_2.rs +++ b/src/cli/server/http_2.rs @@ -45,7 +45,7 @@ pub async fn start_http_2( let builder = Server::builder(acceptor).http2_only(true); - super::log_launch_and_open_browser(sc.as_ref()); + super::log_launch(sc.as_ref()); if let Some(sender) = server_up_sender { sender diff --git a/src/cli/server/mod.rs b/src/cli/server/mod.rs index efce6d98c6..c547c774e3 100644 --- a/src/cli/server/mod.rs +++ b/src/cli/server/mod.rs @@ -7,17 +7,15 @@ pub use server::Server; use self::server_config::ServerConfig; -fn log_launch_and_open_browser(sc: &ServerConfig) { +fn log_launch(sc: &ServerConfig) { let addr = sc.addr().to_string(); tracing::info!( "🚀 Tailcall launched at [{}] over {}", addr, sc.http_version() ); - if sc.graphiql() { - let url = sc.graphiql_url(); - tracing::info!("🌍 Playground: {}", url); - let _ = webbrowser::open(url.as_str()); - } + let url = sc.graphiql_url(); + let url = format!("https://tailcall.run/playground/?u={}/graphql", url); + tracing::info!("🌍 Playground: {}", url); } diff --git a/src/cli/server/server_config.rs b/src/cli/server/server_config.rs index 7538633f05..e1b60bc0e1 100644 --- a/src/cli/server/server_config.rs +++ b/src/cli/server/server_config.rs @@ -66,8 +66,4 @@ impl ServerConfig { format!("{}://{}", protocol, addr) } - - pub fn graphiql(&self) -> bool { - self.blueprint.server.enable_graphiql - } } diff --git a/src/config/server.rs b/src/config/server.rs index f83e88f88a..f8e7e60969 100644 --- a/src/config/server.rs +++ b/src/config/server.rs @@ -40,11 +40,6 @@ pub struct Server { /// termination, acting as a safeguard against long-running queries. pub global_response_timeout: Option, - #[serde(default, skip_serializing_if = "is_default")] - /// `graphiql` activates the GraphiQL IDE at the root path within Tailcall, - /// a tool for query development and testing. @default `false`. - pub graphiql: Option, - #[serde(default, skip_serializing_if = "is_default")] /// `hostname` sets the server hostname. pub hostname: Option, @@ -134,9 +129,7 @@ impl Server { pub fn enable_apollo_tracing(&self) -> bool { self.apollo_tracing.unwrap_or(false) } - pub fn enable_graphiql(&self) -> bool { - self.graphiql.unwrap_or(false) - } + pub fn get_global_response_timeout(&self) -> i64 { self.global_response_timeout.unwrap_or(0) } diff --git a/src/data_loader/cache.rs b/src/data_loader/cache.rs index 085818d8c7..3c4ed82d60 100644 --- a/src/data_loader/cache.rs +++ b/src/data_loader/cache.rs @@ -45,6 +45,7 @@ where fn insert(&mut self, _key: Cow<'_, Self::Key>, _val: Cow<'_, Self::Value>) {} #[inline] + #[allow(dead_code)] fn remove(&mut self, _key: &K) {} #[inline] diff --git a/src/data_loader/storage.rs b/src/data_loader/storage.rs index ea36c74f83..1d35837224 100644 --- a/src/data_loader/storage.rs +++ b/src/data_loader/storage.rs @@ -17,6 +17,7 @@ pub trait CacheStorage: Send + Sync + 'static { /// cache, then it updates the key's value. fn insert(&mut self, key: Cow<'_, Self::Key>, val: Cow<'_, Self::Value>); + #[allow(dead_code)] /// Removes the value corresponding to the key from the cache. fn remove(&mut self, key: &Self::Key); diff --git a/src/http/mod.rs b/src/http/mod.rs index ba8c00d7fd..d4705e45f8 100644 --- a/src/http/mod.rs +++ b/src/http/mod.rs @@ -1,3 +1,15 @@ +pub use cache::*; +pub use data_loader::*; +pub use data_loader_request::*; +use headers::HeaderValue; +pub use method::Method; +pub use request_context::RequestContext; +pub use request_handler::{handle_request, API_URL_PREFIX}; +pub use request_template::RequestTemplate; +pub use response::*; + +pub use crate::app_context::AppContext; + mod data_loader; mod cache; @@ -10,13 +22,5 @@ mod response; pub mod showcase; mod telemetry; -pub use cache::*; -pub use data_loader::*; -pub use data_loader_request::*; -pub use method::Method; -pub use request_context::RequestContext; -pub use request_handler::{graphiql, handle_request, API_URL_PREFIX}; -pub use request_template::RequestTemplate; -pub use response::*; - -pub use crate::app_context::AppContext; +pub static TAILCALL_HTTPS_ORIGIN: HeaderValue = HeaderValue::from_static("https://tailcall.run"); +pub static TAILCALL_HTTP_ORIGIN: HeaderValue = HeaderValue::from_static("http://tailcall.run"); diff --git a/src/http/request_handler.rs b/src/http/request_handler.rs index 36e6ce078c..c7a0e1a719 100644 --- a/src/http/request_handler.rs +++ b/src/http/request_handler.rs @@ -1,48 +1,28 @@ -use std::borrow::Cow; use std::collections::BTreeSet; use std::ops::Deref; use std::sync::Arc; use anyhow::Result; -use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; use async_graphql::ServerError; -use hyper::header::{self, CONTENT_TYPE}; +use hyper::header::{self, HeaderValue, CONTENT_TYPE}; use hyper::http::Method; use hyper::{Body, HeaderMap, Request, Response, StatusCode}; use opentelemetry::trace::SpanKind; use opentelemetry_semantic_conventions::trace::{HTTP_REQUEST_METHOD, HTTP_ROUTE}; -use prometheus::{Encoder, ProtobufEncoder, TextEncoder, PROTOBUF_FORMAT, TEXT_FORMAT}; +use prometheus::{Encoder, ProtobufEncoder, TextEncoder, TEXT_FORMAT}; use serde::de::DeserializeOwned; use tracing::Instrument; use tracing_opentelemetry::OpenTelemetrySpanExt; use super::request_context::RequestContext; use super::telemetry::{get_response_status_code, RequestCounter}; -use super::{showcase, telemetry, AppContext}; +use super::{showcase, telemetry, AppContext, TAILCALL_HTTPS_ORIGIN, TAILCALL_HTTP_ORIGIN}; use crate::async_graphql_hyper::{GraphQLRequestLike, GraphQLResponse}; use crate::blueprint::telemetry::TelemetryExporter; use crate::config::{PrometheusExporter, PrometheusFormat}; pub const API_URL_PREFIX: &str = "/api"; -pub fn graphiql(req: &Request) -> Result> { - let query = req.uri().query(); - let endpoint = "/graphql"; - let endpoint = if let Some(query) = query { - if query.is_empty() { - Cow::Borrowed(endpoint) - } else { - Cow::Owned(format!("{}?{}", endpoint, query)) - } - } else { - Cow::Borrowed(endpoint) - }; - - Ok(Response::new(Body::from(playground_source( - GraphQLPlaygroundConfig::new(&endpoint).title("Tailcall - GraphQL IDE"), - )))) -} - fn prometheus_metrics(prometheus_exporter: &PrometheusExporter) -> Result> { let metric_families = prometheus::default_registry().gather(); let mut buffer = vec![]; @@ -56,7 +36,7 @@ fn prometheus_metrics(prometheus_exporter: &PrometheusExporter) -> Result TEXT_FORMAT, - PrometheusFormat::Protobuf => PROTOBUF_FORMAT, + PrometheusFormat::Protobuf => prometheus::PROTOBUF_FORMAT, }; Ok(Response::builder() @@ -162,6 +142,38 @@ fn create_allowed_headers(headers: &HeaderMap, allowed: &BTreeSet) -> He new_headers } +async fn handle_origin_tailcall( + req: Request, + app_ctx: Arc, + request_counter: &mut RequestCounter, +) -> Result> { + let method = req.method(); + if method == Method::OPTIONS { + let mut res = Response::new(Body::default()); + res.headers_mut().insert( + header::ACCESS_CONTROL_ALLOW_ORIGIN, + HeaderValue::from_static("https://tailcall.run"), + ); + res.headers_mut().insert( + header::ACCESS_CONTROL_ALLOW_METHODS, + HeaderValue::from_static("GET, POST, OPTIONS"), + ); + res.headers_mut().insert( + header::ACCESS_CONTROL_ALLOW_HEADERS, + HeaderValue::from_static("*"), + ); + Ok(res) + } else { + let mut res = handle_request_inner::(req, app_ctx, request_counter).await?; + res.headers_mut().insert( + header::ACCESS_CONTROL_ALLOW_ORIGIN, + HeaderValue::from_static("https://tailcall.run"), + ); + + Ok(res) + } +} + async fn handle_request_with_cors( req: Request, app_ctx: Arc, @@ -288,10 +300,6 @@ async fn handle_request_inner( } }; - if app_ctx.blueprint.server.enable_graphiql { - return graphiql(&req); - } - not_found() } _ => not_found(), @@ -317,6 +325,12 @@ pub async fn handle_request( let response = if app_ctx.blueprint.server.cors.is_some() { handle_request_with_cors::(req, app_ctx, &mut req_counter).await + } else if let Some(origin) = req.headers().get(&header::ORIGIN) { + if origin == TAILCALL_HTTPS_ORIGIN || origin == TAILCALL_HTTP_ORIGIN { + handle_origin_tailcall::(req, app_ctx, &mut req_counter).await + } else { + handle_request_inner::(req, app_ctx, &mut req_counter).await + } } else { handle_request_inner::(req, app_ctx, &mut req_counter).await }; diff --git a/tailcall-cloudflare/src/handle.rs b/tailcall-cloudflare/src/handle.rs index 36fb31b525..4dd2123d22 100644 --- a/tailcall-cloudflare/src/handle.rs +++ b/tailcall-cloudflare/src/handle.rs @@ -3,10 +3,10 @@ use std::collections::HashMap; use std::rc::Rc; use std::sync::{Arc, RwLock}; -use hyper::{Body, Method, Request, Response}; +use hyper::{Body, Request, Response}; use lazy_static::lazy_static; use tailcall::async_graphql_hyper::GraphQLRequest; -use tailcall::http::{graphiql, handle_request, showcase, AppContext}; +use tailcall::http::{handle_request, showcase, AppContext}; use crate::http::{to_request, to_response}; use crate::runtime; @@ -28,14 +28,6 @@ pub async fn fetch( ); let req = to_request(req).await?; - // Quick exit to GraphiQL - // - // Has to be done here, since when using GraphiQL, a config query parameter is - // not specified, and get_app_ctx will fail without it. - if req.method() == Method::GET { - return to_response(graphiql(&req)?).await; - } - let env = Rc::new(env); let app_ctx = match get_app_ctx(env, &req).await? { Ok(app_ctx) => app_ctx, diff --git a/tailcall-cloudflare/tests/cf_tests.spec.ts b/tailcall-cloudflare/tests/cf_tests.spec.ts index 8ea562bbbb..879f8303f2 100644 --- a/tailcall-cloudflare/tests/cf_tests.spec.ts +++ b/tailcall-cloudflare/tests/cf_tests.spec.ts @@ -1,4 +1,4 @@ -import {describe, test, expect} from "vitest" +import {describe, expect, test} from "vitest" import {readFile} from "fs/promises" import {mf} from "./mf" @@ -17,15 +17,6 @@ describe("fetch", () => { await bucket.put("examples/jsonplaceholder_batch.graphql", placeholder_batch) }) - test("ide", async () => { - let resp = await mf.dispatchFetch("https://fake.host/", { - method: "GET", - }) - let body = await resp.text() - expect(body.includes("Tailcall - GraphQL IDE")).toBe(true) - expect(resp.status).toBe(200) - }) - test("sample_resp", async () => { let resp = await mf.dispatchFetch("https://fake.host/graphql?config=examples/jsonplaceholder.graphql", { method: "POST", diff --git a/tailcall-fixtures/fixtures/configs/user-posts.graphql b/tailcall-fixtures/fixtures/configs/user-posts.graphql index 079c492893..e45f9aa569 100644 --- a/tailcall-fixtures/fixtures/configs/user-posts.graphql +++ b/tailcall-fixtures/fixtures/configs/user-posts.graphql @@ -1,5 +1,5 @@ schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { query: Query } diff --git a/tests/core/snapshots/apollo-tracing.md_merged.snap b/tests/core/snapshots/apollo-tracing.md_merged.snap index c65bafe30d..655fb0c12e 100644 --- a/tests/core/snapshots/apollo-tracing.md_merged.snap +++ b/tests/core/snapshots/apollo-tracing.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: merged --- -schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream { query: Query } diff --git a/tests/core/snapshots/auth-basic.md_merged.snap b/tests/core/snapshots/auth-basic.md_merged.snap index 4e174cdbc4..990292607f 100644 --- a/tests/core/snapshots/auth-basic.md_merged.snap +++ b/tests/core/snapshots/auth-basic.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: merged --- -schema @server(graphiql: true, port: 8000) @upstream @link(id: "htpasswd", src: ".htpasswd", type: Htpasswd) { +schema @server(port: 8000) @upstream @link(id: "htpasswd", src: ".htpasswd", type: Htpasswd) { query: Query mutation: Mutation } diff --git a/tests/core/snapshots/auth-jwt.md_merged.snap b/tests/core/snapshots/auth-jwt.md_merged.snap index 9ea0b077da..69bf7be283 100644 --- a/tests/core/snapshots/auth-jwt.md_merged.snap +++ b/tests/core/snapshots/auth-jwt.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: merged --- -schema @server(graphiql: true, port: 8000) @upstream @link(id: "jwks", src: "jwks.json", type: Jwks) { +schema @server(port: 8000) @upstream @link(id: "jwks", src: "jwks.json", type: Jwks) { query: Query mutation: Mutation } diff --git a/tests/core/snapshots/call-graphql-datasource.md_merged.snap b/tests/core/snapshots/call-graphql-datasource.md_merged.snap index ec344567c4..12db968e5d 100644 --- a/tests/core/snapshots/call-graphql-datasource.md_merged.snap +++ b/tests/core/snapshots/call-graphql-datasource.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { query: Query } diff --git a/tests/core/snapshots/call-operator.md_merged.snap b/tests/core/snapshots/call-operator.md_merged.snap index ad316db56f..dc9d89aabc 100644 --- a/tests/core/snapshots/call-operator.md_merged.snap +++ b/tests/core/snapshots/call-operator.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(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 } diff --git a/tests/core/snapshots/grpc-batch.md_merged.snap b/tests/core/snapshots/grpc-batch.md_merged.snap index 14626ab137..26d6e41803 100644 --- a/tests/core/snapshots/grpc-batch.md_merged.snap +++ b/tests/core/snapshots/grpc-batch.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(port: 8000) @upstream(batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } diff --git a/tests/core/snapshots/grpc-error.md_merged.snap b/tests/core/snapshots/grpc-error.md_merged.snap index 54e5f0b144..385aa86cce 100644 --- a/tests/core/snapshots/grpc-error.md_merged.snap +++ b/tests/core/snapshots/grpc-error.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(port: 8000) @upstream(batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { 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 index a42f6b7991..b4310be979 100644 --- a/tests/core/snapshots/grpc-override-url-from-upstream.md_merged.snap +++ b/tests/core/snapshots/grpc-override-url-from-upstream.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(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 } 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 index 885b23f062..627c602738 100644 --- a/tests/core/snapshots/grpc-proto-with-same-package.md_merged.snap +++ b/tests/core/snapshots/grpc-proto-with-same-package.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(port: 8000) @upstream(baseURL: "http://localhost:50051") @link(src: "foo.proto", type: Protobuf) @link(src: "bar.proto", type: Protobuf) { query: Query } diff --git a/tests/core/snapshots/grpc-reflection.md_merged.snap b/tests/core/snapshots/grpc-reflection.md_merged.snap index ef18012e5e..3588897f4b 100644 --- a/tests/core/snapshots/grpc-reflection.md_merged.snap +++ b/tests/core/snapshots/grpc-reflection.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(port: 8000) @upstream(baseURL: "http://localhost:50051", httpCache: true) @link(src: "http://localhost:50051", type: Grpc) { query: Query } diff --git a/tests/core/snapshots/grpc-simple.md_merged.snap b/tests/core/snapshots/grpc-simple.md_merged.snap index 54e5f0b144..385aa86cce 100644 --- a/tests/core/snapshots/grpc-simple.md_merged.snap +++ b/tests/core/snapshots/grpc-simple.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(port: 8000) @upstream(batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { 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 index 0ad2090a9f..ccab578907 100644 --- a/tests/core/snapshots/grpc-url-from-upstream.md_merged.snap +++ b/tests/core/snapshots/grpc-url-from-upstream.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(port: 8000) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } diff --git a/tests/core/snapshots/io-cache.md_merged.snap b/tests/core/snapshots/io-cache.md_merged.snap index 7669ff0baa..87b91f625b 100644 --- a/tests/core/snapshots/io-cache.md_merged.snap +++ b/tests/core/snapshots/io-cache.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { query: Query } diff --git a/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap b/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap index a5a42cbbac..e49ac9d01a 100644 --- a/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap +++ b/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: true) { query: Query } diff --git a/tests/core/snapshots/test-enum-default.md_merged.snap b/tests/core/snapshots/test-enum-default.md_merged.snap index fedfe3b663..0225e1e26a 100644 --- a/tests/core/snapshots/test-enum-default.md_merged.snap +++ b/tests/core/snapshots/test-enum-default.md_merged.snap @@ -2,7 +2,7 @@ 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) { +schema @server(port: 8080) @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: true) @link(id: "news", src: "./service.proto", type: Protobuf) { 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 index 8d9f37e2a6..321ec2ce72 100644 --- a/tests/core/snapshots/test-params-as-body.md_merged.snap +++ b/tests/core/snapshots/test-params-as-body.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: merged --- -schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { query: Query } diff --git a/tests/core/snapshots/test-scalars.md_merged.snap b/tests/core/snapshots/test-scalars.md_merged.snap index 69c62c196e..5fd1d6df74 100644 --- a/tests/core/snapshots/test-scalars.md_merged.snap +++ b/tests/core/snapshots/test-scalars.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: merged --- -schema @server(graphiql: true, hostname: "localhost", port: 8000) @upstream { +schema @server(hostname: "localhost", port: 8000) @upstream { 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 index 8660783954..d3da154ead 100644 --- a/tests/core/snapshots/test-set-cookie-headers.md_merged.snap +++ b/tests/core/snapshots/test-set-cookie-headers.md_merged.snap @@ -2,7 +2,7 @@ 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") { +schema @server(headers: {setCookies: true}, hostname: "0.0.0.0", port: 8080) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { query: Query } diff --git a/tests/execution/apollo-tracing.md b/tests/execution/apollo-tracing.md index e534dc0780..72ffd9b01b 100644 --- a/tests/execution/apollo-tracing.md +++ b/tests/execution/apollo-tracing.md @@ -2,7 +2,7 @@ ```graphql @server schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @telemetry(export: {apollo: {apiKey: "", graphRef: "tailcall-demo-3@current"}}) { query: Query } diff --git a/tests/execution/auth-basic.md b/tests/execution/auth-basic.md index 95f413e2aa..b8af3de0b0 100644 --- a/tests/execution/auth-basic.md +++ b/tests/execution/auth-basic.md @@ -1,7 +1,7 @@ # Auth with BasicAuth ```graphql @server -schema @server(port: 8000, graphiql: true) @link(id: "htpasswd", type: Htpasswd, src: ".htpasswd") { +schema @server(port: 8000) @link(id: "htpasswd", type: Htpasswd, src: ".htpasswd") { query: Query mutation: Mutation } diff --git a/tests/execution/auth-jwt.md b/tests/execution/auth-jwt.md index d91aeb4f22..64f3b53ad8 100644 --- a/tests/execution/auth-jwt.md +++ b/tests/execution/auth-jwt.md @@ -1,7 +1,7 @@ # Auth with JWT loaded from expr ```graphql @server -schema @server(port: 8000, graphiql: true) @link(id: "jwks", type: Jwks, src: "jwks.json") { +schema @server(port: 8000) @link(id: "jwks", type: Jwks, src: "jwks.json") { query: Query mutation: Mutation } diff --git a/tests/execution/call-graphql-datasource.md b/tests/execution/call-graphql-datasource.md index df32c6d7ad..f58d1aac9c 100644 --- a/tests/execution/call-graphql-datasource.md +++ b/tests/execution/call-graphql-datasource.md @@ -2,7 +2,7 @@ ```graphql @server schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { query: Query } diff --git a/tests/execution/call-operator.md b/tests/execution/call-operator.md index cfff8e49ce..404ad97a04 100644 --- a/tests/execution/call-operator.md +++ b/tests/execution/call-operator.md @@ -38,7 +38,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/grpc-batch.md b/tests/execution/grpc-batch.md index 61072baec6..f49eab5a35 100644 --- a/tests/execution/grpc-batch.md +++ b/tests/execution/grpc-batch.md @@ -38,7 +38,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, batch: {delay: 10}) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/grpc-error.md b/tests/execution/grpc-error.md index 2d0ebe2661..270ddbb4d0 100644 --- a/tests/execution/grpc-error.md +++ b/tests/execution/grpc-error.md @@ -38,7 +38,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, batch: {delay: 10}) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/grpc-override-url-from-upstream.md b/tests/execution/grpc-override-url-from-upstream.md index 718d5a04de..d8ba7b17dc 100644 --- a/tests/execution/grpc-override-url-from-upstream.md +++ b/tests/execution/grpc-override-url-from-upstream.md @@ -38,7 +38,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, batch: {delay: 10}, baseURL: "http://not-a-valid-grpc-url.com") @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/grpc-proto-with-same-package.md b/tests/execution/grpc-proto-with-same-package.md index 67925aa28e..708864cae0 100644 --- a/tests/execution/grpc-proto-with-same-package.md +++ b/tests/execution/grpc-proto-with-same-package.md @@ -35,7 +35,7 @@ service BarService { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(baseURL: "http://localhost:50051") @link(src: "foo.proto", type: Protobuf) @link(src: "bar.proto", type: Protobuf) { diff --git a/tests/execution/grpc-reflection.md b/tests/execution/grpc-reflection.md index d054bd8399..219432f345 100644 --- a/tests/execution/grpc-reflection.md +++ b/tests/execution/grpc-reflection.md @@ -2,7 +2,7 @@ ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, baseURL: "http://localhost:50051") @link(src: "http://localhost:50051", type: Grpc) { query: Query diff --git a/tests/execution/grpc-simple.md b/tests/execution/grpc-simple.md index c38344903e..7954c246db 100644 --- a/tests/execution/grpc-simple.md +++ b/tests/execution/grpc-simple.md @@ -38,7 +38,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, batch: {delay: 10}) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/grpc-url-from-upstream.md b/tests/execution/grpc-url-from-upstream.md index db2c8ac4af..9437271ca5 100644 --- a/tests/execution/grpc-url-from-upstream.md +++ b/tests/execution/grpc-url-from-upstream.md @@ -38,7 +38,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, batch: {delay: 10}, baseURL: "http://localhost:50051") @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/io-cache.md b/tests/execution/io-cache.md index 16f3161e15..412468cd4b 100644 --- a/tests/execution/io-cache.md +++ b/tests/execution/io-cache.md @@ -2,7 +2,7 @@ ```graphql @server schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true) { query: Query } diff --git a/tests/execution/jsonplaceholder-call-post.md b/tests/execution/jsonplaceholder-call-post.md index 0b4674de28..55156b6bd7 100644 --- a/tests/execution/jsonplaceholder-call-post.md +++ b/tests/execution/jsonplaceholder-call-post.md @@ -2,7 +2,7 @@ ```graphql @server schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true, batch: {delay: 100}) { query: Query } diff --git a/tests/execution/test-duplicated-link.md b/tests/execution/test-duplicated-link.md index 82440af786..858db7a67b 100644 --- a/tests/execution/test-duplicated-link.md +++ b/tests/execution/test-duplicated-link.md @@ -6,7 +6,7 @@ expect_validation_error: true ```graphql @file:jsonplaceholder.graphql schema - @server(port: 8000, graphiql: true, hostname: "0.0.0.0") + @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: true, batch: {delay: 100}) { query: Query } diff --git a/tests/execution/test-enum-default.md b/tests/execution/test-enum-default.md index 37c163fc68..68f059b55f 100644 --- a/tests/execution/test-enum-default.md +++ b/tests/execution/test-enum-default.md @@ -31,7 +31,7 @@ message NewsList { ```graphql @server # for test upstream server see [repo](https://github.com/tailcallhq/rust-grpc) schema - @server(port: 8080, graphiql: true) + @server(port: 8080) @upstream(baseURL: "http://localhost:50051", httpCache: true, batch: {delay: 10}) @link(id: "news", src: "./service.proto", type: Protobuf) { query: Query diff --git a/tests/execution/test-grpc-group-by.md b/tests/execution/test-grpc-group-by.md index 368808f3b8..f9f95ac2d8 100644 --- a/tests/execution/test-grpc-group-by.md +++ b/tests/execution/test-grpc-group-by.md @@ -42,7 +42,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, batch: {delay: 10}) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/test-grpc-nested-data.md b/tests/execution/test-grpc-nested-data.md index 6a601f3e14..82ff8ee9ad 100644 --- a/tests/execution/test-grpc-nested-data.md +++ b/tests/execution/test-grpc-nested-data.md @@ -42,7 +42,7 @@ message NewsList { ```graphql @server schema - @server(port: 8000, graphiql: true) + @server(port: 8000) @upstream(httpCache: true, batch: {delay: 10}) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query diff --git a/tests/execution/test-params-as-body.md b/tests/execution/test-params-as-body.md index f9d2c346b3..98aa8a661f 100644 --- a/tests/execution/test-params-as-body.md +++ b/tests/execution/test-params-as-body.md @@ -1,7 +1,7 @@ # Http with args as body ```graphql @server -schema @server(port: 8000, graphiql: true) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { query: Query } diff --git a/tests/execution/test-scalars.md b/tests/execution/test-scalars.md index ec54cd9ca5..86d16e2a13 100644 --- a/tests/execution/test-scalars.md +++ b/tests/execution/test-scalars.md @@ -6,7 +6,7 @@ scalar PhoneNumber scalar Date scalar Url -schema @server(port: 8000, graphiql: true, hostname: "localhost") { +schema @server(port: 8000, hostname: "localhost") { query: Query } diff --git a/tests/execution/test-set-cookie-headers.md b/tests/execution/test-set-cookie-headers.md index bd5a1e7344..7a0740a62b 100644 --- a/tests/execution/test-set-cookie-headers.md +++ b/tests/execution/test-set-cookie-headers.md @@ -2,7 +2,7 @@ ```graphql @server schema - @server(port: 8080, graphiql: true, hostname: "0.0.0.0", headers: {setCookies: true}) + @server(port: 8080, hostname: "0.0.0.0", headers: {setCookies: true}) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { query: Query }