diff --git a/Cargo.lock b/Cargo.lock index 4a43d6f5bc..8f9aa94bdc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5493,6 +5493,7 @@ dependencies = [ "ttl_cache", "update-informer", "url", + "urlencoding", "which 6.0.3", ] @@ -6390,6 +6391,12 @@ dependencies = [ "serde", ] +[[package]] +name = "urlencoding" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" + [[package]] name = "utf8parse" version = "0.2.2" @@ -6653,7 +6660,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 41e5ee0aca..721a0d0dc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -170,6 +170,7 @@ indenter = "0.3.3" derive_more = { workspace = true } strum = "0.26.2" dashmap = "6.1.0" +urlencoding = "2.1.3" [dev-dependencies] datatest-stable = "0.2.9" diff --git a/examples/apollo-tracing.graphql b/examples/apollo-tracing.graphql index 550a174bae..368ff53c17 100644 --- a/examples/apollo-tracing.graphql +++ b/examples/apollo-tracing.graphql @@ -1,12 +1,9 @@ -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @telemetry(export: {apollo: {apiKey: "1234", graphRef: "abc@123"}}) { +schema @server(port: 8000, hostname: "0.0.0.0") @telemetry(export: {apollo: {apiKey: "1234", graphRef: "abc@123"}}) { query: Query } type Query @cache(maxAge: 30000) { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type Post { diff --git a/examples/apollo_federation_subgraph_post.graphql b/examples/apollo_federation_subgraph_post.graphql index ba8c290c7b..b1e36ab105 100644 --- a/examples/apollo_federation_subgraph_post.graphql +++ b/examples/apollo_federation_subgraph_post.graphql @@ -1,18 +1,26 @@ -schema - @server(port: 8001, enableFederation: true) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8001, enableFederation: true) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } -type User @http(path: "/users", query: [{key: "id", value: "{{.value.id}}"}], batchKey: ["id"]) { +type User + @http( + url: "http://jsonplaceholder.typicode.com/users" + query: [{key: "id", value: "{{.value.id}}"}] + batchKey: ["id"] + ) { id: Int! } -type Post @http(path: "/posts", query: [{key: "id", value: "{{.value.id}}"}], batchKey: ["id"]) { +type Post + @http( + url: "http://jsonplaceholder.typicode.com/posts" + query: [{key: "id", value: "{{.value.id}}"}] + batchKey: ["id"] + ) { id: Int! userId: Int! title: String! diff --git a/examples/apollo_federation_subgraph_user.graphql b/examples/apollo_federation_subgraph_user.graphql index 8400cc98bb..262b96684e 100644 --- a/examples/apollo_federation_subgraph_user.graphql +++ b/examples/apollo_federation_subgraph_user.graphql @@ -1,14 +1,17 @@ -schema - @server(port: 8002, enableFederation: true) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8002, enableFederation: true) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } -type User @http(path: "/users", query: [{key: "id", value: "{{.value.id}}"}], batchKey: ["id"]) { +type User + @http( + url: "http://jsonplaceholder.typicode.com/users" + query: [{key: "id", value: "{{.value.id}}"}] + batchKey: ["id"] + ) { id: Int! name: String username: String diff --git a/examples/auth.graphql b/examples/auth.graphql index bb716dc7c4..f335e85197 100644 --- a/examples/auth.graphql +++ b/examples/auth.graphql @@ -1,6 +1,6 @@ schema @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) + @upstream(httpCache: 42) @link(id: "auth-basic", type: Htpasswd, src: ".htpasswd") @link(id: "auth-jwt", type: Jwks, src: ".jwks") { query: Query @@ -8,12 +8,12 @@ schema } type Query { - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type Mutation { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/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(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } diff --git a/examples/call.graphql b/examples/call.graphql index f0af6d6a51..7d1156793f 100644 --- a/examples/call.graphql +++ b/examples/call.graphql @@ -1,4 +1,4 @@ -schema @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema { query: Query } @@ -10,9 +10,9 @@ type Post { } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/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(url: "http://jsonplaceholder.typicode.com/posts?userId={{.args.userId}}") } type User { diff --git a/examples/cors.graphql b/examples/cors.graphql index 7e1a78a34b..27a4d12674 100644 --- a/examples/cors.graphql +++ b/examples/cors.graphql @@ -3,13 +3,12 @@ schema port: 8000 hostname: "0.0.0.0" headers: {cors: {allowOrigins: ["*"], allowHeaders: ["*"], allowMethods: [POST, GET, OPTIONS]}} - ) - @upstream(baseURL: "http://jsonplaceholder.typicode.com") { + ) { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type Post { diff --git a/examples/graphql-composition.graphql b/examples/graphql-composition.graphql index 9eefcecefb..b4d5e0c6d1 100644 --- a/examples/graphql-composition.graphql +++ b/examples/graphql-composition.graphql @@ -2,14 +2,12 @@ # i.e. `tc start examples/jsonplaceholder.graphql` # and then you can run this example and test it on 8001 port -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://localhost:8000/graphql", httpCache: 42, batch: {delay: 1}) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42, batch: {delay: 1}) { query: Query } type Query { - posts: [Post] @graphQL(name: "posts") + posts: [Post] @graphQL(url: "http://jsonplaceholder.typicode.com", name: "posts") } type Post { @@ -17,7 +15,8 @@ type Post { userId: Int! title: String! body: String! - user: User @graphQL(name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) + user: User + @graphQL(url: "http://jsonplaceholder.typicode.com", name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type User { diff --git a/examples/grpc-reflection.graphql b/examples/grpc-reflection.graphql index 71a567d5de..841350bbe6 100644 --- a/examples/grpc-reflection.graphql +++ b/examples/grpc-reflection.graphql @@ -1,16 +1,22 @@ # for test upstream server see [repo](https://github.com/tailcallhq/tailcall/tree/main/tailcall-upstream-grpc) schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", httpCache: 42, batch: {delay: 10}) + @upstream(httpCache: 42, batch: {delay: 10}) @link(src: "http://localhost:50051", type: Grpc, headers: [{key: "authorization", value: "Bearer 123"}]) { query: Query } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", method: "news.NewsService.GetNews", body: "{{args.news}}") newsByIdBatch(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetMultipleNews", body: "{{args.news}}", batchKey: ["news", "id"]) + @grpc( + url: "http://localhost:50051" + method: "news.NewsService.GetMultipleNews" + body: "{{args.news}}" + batchKey: ["news", "id"] + ) } type News { diff --git a/examples/grpc.graphql b/examples/grpc.graphql index a3f0b7e7c9..995cea0043 100644 --- a/examples/grpc.graphql +++ b/examples/grpc.graphql @@ -1,16 +1,22 @@ # for test upstream server see [repo](https://github.com/tailcallhq/rust-grpc) schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", httpCache: 42, batch: {delay: 10}) + @upstream(httpCache: 42, batch: {delay: 10}) @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}}") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", method: "news.NewsService.GetNews", body: "{{.args.news}}") newsByIdBatch(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetMultipleNews", body: "{{.args.news}}", batchKey: ["news", "id"]) + @grpc( + url: "http://localhost:50051" + method: "news.NewsService.GetMultipleNews" + body: "{{.args.news}}" + batchKey: ["news", "id"] + ) } type News { diff --git a/examples/jsonplaceholder.graphql b/examples/jsonplaceholder.graphql index 3dbe8d313a..46aebf0105 100644 --- a/examples/jsonplaceholder.graphql +++ b/examples/jsonplaceholder.graphql @@ -1,13 +1,11 @@ -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - posts: [Post] @http(path: "/posts") - users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") greet: String @expr(body: "Hello World!") } diff --git a/examples/jsonplaceholder.json b/examples/jsonplaceholder.json index 6c74931c9a..802964d591 100644 --- a/examples/jsonplaceholder.json +++ b/examples/jsonplaceholder.json @@ -5,7 +5,6 @@ "port": 8000 }, "upstream": { - "baseURL": "http://jsonplaceholder.typicode.com", "httpCache": 42 }, "schema": { @@ -37,7 +36,7 @@ "name": "User" }, "http": { - "path": "/users/{{value.userId}}" + "url": "http://jsonplaceholder.typicode.com/users/{{value.userId}}" } }, "userId": { @@ -57,7 +56,7 @@ } }, "http": { - "path": "/posts" + "url": "http://jsonplaceholder.typicode.com/posts" } }, "user": { @@ -73,7 +72,7 @@ } }, "http": { - "path": "/users/{{args.id}}" + "url": "http://jsonplaceholder.typicode.com/users/{{args.id}}" } } } diff --git a/examples/jsonplaceholder.yml b/examples/jsonplaceholder.yml index 0cd95b6ea1..79c94fb96a 100644 --- a/examples/jsonplaceholder.yml +++ b/examples/jsonplaceholder.yml @@ -2,7 +2,6 @@ server: hostname: 0.0.0.0 port: 8000 upstream: - baseURL: http://jsonplaceholder.typicode.com httpCache: 42 schema: query: Query @@ -25,7 +24,7 @@ types: type: name: User http: - path: /users/{{value.userId}} + url: http://jsonplaceholder.typicode.com/users/{{value.userId}} userId: type: name: Int @@ -37,7 +36,7 @@ types: list: name: Post http: - path: /posts + url: http://jsonplaceholder.typicode.com/posts user: type: name: User @@ -47,7 +46,7 @@ types: name: Int required: true http: - path: /users/{{args.id}} + url: http://jsonplaceholder.typicode.com/users/{{args.id}} User: fields: email: diff --git a/examples/jsonplaceholder_batch.graphql b/examples/jsonplaceholder_batch.graphql index 41d000b0cb..1722c6d686 100644 --- a/examples/jsonplaceholder_batch.graphql +++ b/examples/jsonplaceholder_batch.graphql @@ -1,11 +1,9 @@ -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 1, maxSize: 1000}) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 1, maxSize: 1000}) { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { @@ -22,5 +20,10 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}], batchKey: ["id"]) + user: User + @http( + url: "http://jsonplaceholder.typicode.com/users" + query: [{key: "id", value: "{{.value.userId}}"}] + batchKey: ["id"] + ) } diff --git a/examples/jsonplaceholder_batch.json b/examples/jsonplaceholder_batch.json index 9c6565d918..72059725b7 100644 --- a/examples/jsonplaceholder_batch.json +++ b/examples/jsonplaceholder_batch.json @@ -3,7 +3,6 @@ "port": 8000 }, "upstream": { - "baseURL": "http://jsonplaceholder.typicode.com", "httpCache": 42, "batch": { "maxSize": 1000, @@ -40,7 +39,7 @@ "name": "User" }, "http": { - "path": "/users", + "url": "http://jsonplaceholder.typicode.com/users", "query": [ { "key": "id", @@ -67,7 +66,7 @@ } }, "http": { - "path": "/posts" + "url": "http://jsonplaceholder.typicode.com/posts" } } } diff --git a/examples/jsonplaceholder_batch.yml b/examples/jsonplaceholder_batch.yml index 520db3b74c..78ac2980f9 100644 --- a/examples/jsonplaceholder_batch.yml +++ b/examples/jsonplaceholder_batch.yml @@ -1,7 +1,6 @@ server: port: 8000 upstream: - baseURL: http://jsonplaceholder.typicode.com httpCache: 42 batch: maxSize: 1000 @@ -28,7 +27,7 @@ types: type: name: User http: - path: /users + url: http://jsonplaceholder.typicode.com/users query: - key: id value: "{{value.userId}}" @@ -45,7 +44,7 @@ types: list: name: Post http: - path: /posts + url: http://jsonplaceholder.typicode.com/posts User: fields: email: diff --git a/examples/jsonplaceholder_http_2.graphql b/examples/jsonplaceholder_http_2.graphql index a2a931fdb6..1d6d917e95 100644 --- a/examples/jsonplaceholder_http_2.graphql +++ b/examples/jsonplaceholder_http_2.graphql @@ -2,12 +2,12 @@ schema @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: 42) { + @upstream(httpCache: 42) { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } diff --git a/examples/jsonplaceholder_script.graphql b/examples/jsonplaceholder_script.graphql index 71924d48ff..a336671cae 100644 --- a/examples/jsonplaceholder_script.graphql +++ b/examples/jsonplaceholder_script.graphql @@ -1,13 +1,13 @@ schema @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, onRequest: "onRequest") + @upstream(httpCache: 42, onRequest: "onRequest") @link(type: Script, src: "scripts/echo.js") { query: Query } type Query { - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/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(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } diff --git a/examples/rest-api.graphql b/examples/rest-api.graphql index 824bf1dcbb..bc9a45aedd 100644 --- a/examples/rest-api.graphql +++ b/examples/rest-api.graphql @@ -1,14 +1,14 @@ schema @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) + @upstream(httpCache: 42) @link(type: Operation, src: "operations/routes.graphql") { query: Query } type Query { - posts: [Post] @http(path: "/posts") - users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/examples/telemetry-otlp.graphql b/examples/telemetry-otlp.graphql index 13d9e5e51a..35001b9252 100644 --- a/examples/telemetry-otlp.graphql +++ b/examples/telemetry-otlp.graphql @@ -1,6 +1,6 @@ schema @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) + @upstream(httpCache: 42) @link(type: Operation, src: "operations/routes.graphql") @link(id: "news", src: "../tailcall-fixtures/fixtures/protobuf/news.proto", type: Protobuf) @telemetry( @@ -20,10 +20,10 @@ schema } type Query { - posts: [Post] @http(path: "/posts") @cache(maxAge: 3000) - 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") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") @cache(maxAge: 3000) + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") } type User { @@ -40,7 +40,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } type News { diff --git a/examples/telemetry-prometheus.graphql b/examples/telemetry-prometheus.graphql index f1010e5d6b..aecb4660f2 100644 --- a/examples/telemetry-prometheus.graphql +++ b/examples/telemetry-prometheus.graphql @@ -1,13 +1,13 @@ schema @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) + @upstream(httpCache: 42) @telemetry(export: {prometheus: {path: "/metrics"}}) { query: Query } type Query { - posts: [Post] @http(path: "/posts") @cache(maxAge: 5000) - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") @cache(maxAge: 5000) + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/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(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } diff --git a/examples/telemetry-stdout.graphql b/examples/telemetry-stdout.graphql index c9245f4b92..70eac8f7bb 100644 --- a/examples/telemetry-stdout.graphql +++ b/examples/telemetry-stdout.graphql @@ -1,13 +1,10 @@ -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) - @telemetry(export: {stdout: {pretty: true}}) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) @telemetry(export: {stdout: {pretty: true}}) { query: Query } type Query { - posts: [Post] @http(path: "/posts") @cache(maxAge: 5000) - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") @cache(maxAge: 5000) + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { @@ -24,5 +21,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } diff --git a/generated/.tailcallrc.graphql b/generated/.tailcallrc.graphql index 2eb7d144ba..814de7a05e 100644 --- a/generated/.tailcallrc.graphql +++ b/generated/.tailcallrc.graphql @@ -67,11 +67,6 @@ directive @graphQL( """ args: [KeyValue] """ - This refers to the base URL of the API. If not specified, the default base URL is - the one specified in the `@upstream` operator. - """ - baseURL: String - """ If the upstream GraphQL server supports request batching, you can specify the 'batch' argument to batch several requests into a single batch request.Make sure you have also specified batch settings to the `@upstream` and to the `@graphQL` operator. @@ -96,6 +91,10 @@ directive @graphQL( field, Tailcall requests data from the corresponding upstream field. """ name: String! + """ + This refers URL of the API. + """ + url: String! ) on FIELD_DEFINITION | OBJECT """ @@ -108,11 +107,6 @@ In this scenario, the GraphQL server will make a gRPC request to the gRPC endpoi specified when the `users` field is queried. """ directive @grpc( - """ - This refers to the base URL of the API. If not specified, the default base URL is - the one specified in the `@upstream` operator. - """ - baseURL: String """ The `batchKey` dictates the path Tailcall will follow to group the returned items from the batch request. For more details please refer out [n + 1 guide](https://tailcall.run/docs/guides/n+1#solving-using-batching). @@ -151,6 +145,10 @@ directive @grpc( }` """ select: JSON + """ + This refers to URL of the API. + """ + url: String! ) on FIELD_DEFINITION | OBJECT """ @@ -162,11 +160,6 @@ server will make a GET request to the API endpoint specified when the `users` fi is queried. """ directive @http( - """ - This refers to the base URL of the API. If not specified, the default base URL is - the one specified in the `@upstream` operator. - """ - baseURL: String """ The `batchKey` dictates the path Tailcall will follow to group the returned items from the batch request. For more details please refer out [n + 1 guide](https://tailcall.run/docs/guides/n+1#solving-using-batching). @@ -215,12 +208,6 @@ directive @http( """ output: Schema """ - This refers to the API endpoint you're going to call. For instance `https://jsonplaceholder.typicode.com/users`.For - dynamic segments in your API endpoint, use Mustache templates for variable substitution. - For instance, to fetch a specific user, use `/users/{{args.id}}`. - """ - path: String! - """ This represents the query parameters of your API call. You can pass it as a static object or use Mustache template for dynamic parameters. These parameters will be added to the URL. NOTE: Query parameter order is critical for batching in Tailcall. @@ -238,6 +225,10 @@ directive @http( }` """ select: JSON + """ + This refers to URL of the API. + """ + url: String! ) on FIELD_DEFINITION | OBJECT directive @js( @@ -404,13 +395,6 @@ directive @upstream( """ allowedHeaders: [String!] """ - This refers to the default base URL for your APIs. If it's not explicitly mentioned - in the `@upstream` operator, then each [@http](#http) operator must specify its own - `baseURL`. If neither `@upstream` nor [@http](#http) provides a `baseURL`, it results - in a compilation error. - """ - baseURL: String - """ An object that specifies the batch settings, including `maxSize` (the maximum size of the batch), `delay` (the delay in milliseconds between each batch), and `headers` (an array of HTTP headers to be included in the batch). @@ -788,11 +772,6 @@ input GraphQL { """ args: [KeyValue] """ - This refers to the base URL of the API. If not specified, the default base URL is - the one specified in the `@upstream` operator. - """ - baseURL: String - """ If the upstream GraphQL server supports request batching, you can specify the 'batch' argument to batch several requests into a single batch request.Make sure you have also specified batch settings to the `@upstream` and to the `@graphQL` operator. @@ -817,6 +796,10 @@ input GraphQL { field, Tailcall requests data from the corresponding upstream field. """ name: String! + """ + This refers URL of the API. + """ + url: String! } """ @@ -829,11 +812,6 @@ In this scenario, the GraphQL server will make a gRPC request to the gRPC endpoi specified when the `users` field is queried. """ input Grpc { - """ - This refers to the base URL of the API. If not specified, the default base URL is - the one specified in the `@upstream` operator. - """ - baseURL: String """ The `batchKey` dictates the path Tailcall will follow to group the returned items from the batch request. For more details please refer out [n + 1 guide](https://tailcall.run/docs/guides/n+1#solving-using-batching). @@ -872,6 +850,10 @@ input Grpc { }` """ select: JSON + """ + This refers to URL of the API. + """ + url: String! } """ @@ -883,11 +865,6 @@ server will make a GET request to the API endpoint specified when the `users` fi is queried. """ input Http { - """ - This refers to the base URL of the API. If not specified, the default base URL is - the one specified in the `@upstream` operator. - """ - baseURL: String """ The `batchKey` dictates the path Tailcall will follow to group the returned items from the batch request. For more details please refer out [n + 1 guide](https://tailcall.run/docs/guides/n+1#solving-using-batching). @@ -936,12 +913,6 @@ input Http { """ output: Schema """ - This refers to the API endpoint you're going to call. For instance `https://jsonplaceholder.typicode.com/users`.For - dynamic segments in your API endpoint, use Mustache templates for variable substitution. - For instance, to fetch a specific user, use `/users/{{args.id}}`. - """ - path: String! - """ This represents the query parameters of your API call. You can pass it as a static object or use Mustache template for dynamic parameters. These parameters will be added to the URL. NOTE: Query parameter order is critical for batching in Tailcall. @@ -959,6 +930,10 @@ input Http { }` """ select: JSON + """ + This refers to URL of the API. + """ + url: String! } """ diff --git a/generated/.tailcallrc.schema.json b/generated/.tailcallrc.schema.json index 8cb3cc2bce..1353de9a9a 100644 --- a/generated/.tailcallrc.schema.json +++ b/generated/.tailcallrc.schema.json @@ -546,7 +546,8 @@ "description": "The @graphQL operator allows to specify GraphQL API server request to fetch data from.", "type": "object", "required": [ - "name" + "name", + "url" ], "properties": { "args": { @@ -559,13 +560,6 @@ "$ref": "#/definitions/KeyValue" } }, - "baseURL": { - "description": "This refers to the base URL of the API. If not specified, the default base URL is the one specified in the `@upstream` operator.", - "type": [ - "string", - "null" - ] - }, "batch": { "description": "If the upstream GraphQL server supports request batching, you can specify the 'batch' argument to batch several requests into a single batch request.\n\nMake sure you have also specified batch settings to the `@upstream` and to the `@graphQL` operator.", "type": "boolean" @@ -587,6 +581,10 @@ "name": { "description": "Specifies the root field on the upstream to request data from. This maps a field in your schema to a field in the upstream schema. When a query is received for this field, Tailcall requests data from the corresponding upstream field.", "type": "string" + }, + "url": { + "description": "This refers URL of the API.", + "type": "string" } }, "additionalProperties": false @@ -595,16 +593,10 @@ "description": "The @grpc operator indicates that a field or node is backed by a gRPC API.\n\nFor instance, if you add the @grpc operator to the `users` field of the Query type with a service argument of `NewsService` and method argument of `GetAllNews`, it signifies that the `users` field is backed by a gRPC API. The `service` argument specifies the name of the gRPC service. The `method` argument specifies the name of the gRPC method. In this scenario, the GraphQL server will make a gRPC request to the gRPC endpoint specified when the `users` field is queried.", "type": "object", "required": [ - "method" + "method", + "url" ], "properties": { - "baseURL": { - "description": "This refers to the base URL of the API. If not specified, the default base URL is the one specified in the `@upstream` operator.", - "type": [ - "string", - "null" - ] - }, "batchKey": { "description": "The `batchKey` dictates the path Tailcall will follow to group the returned items from the batch request. For more details please refer out [n + 1 guide](https://tailcall.run/docs/guides/n+1#solving-using-batching).", "type": "array", @@ -635,6 +627,10 @@ }, "select": { "description": "You can use `select` with mustache syntax to re-construct the directives response to the desired format. This is useful when data are deeply nested or want to keep specific fields only from the response.\n\n* EXAMPLE 1: if we have a call that returns `{ \"user\": { \"items\": [...], ... } ... }` we can use `\"{{.user.items}}\"`, to extract the `items`. * EXAMPLE 2: if we have a call that returns `{ \"foo\": \"bar\", \"fizz\": { \"buzz\": \"eggs\", ... }, ... }` we can use { foo: \"{{.foo}}\", buzz: \"{{.fizz.buzz}}\" }`" + }, + "url": { + "description": "This refers to URL of the API.", + "type": "string" } }, "additionalProperties": false @@ -691,16 +687,9 @@ "description": "The @http operator indicates that a field or node is backed by a REST API.\n\nFor instance, if you add the @http operator to the `users` field of the Query type with a path argument of `\"/users\"`, it signifies that the `users` field is backed by a REST API. The path argument specifies the path of the REST API. In this scenario, the GraphQL server will make a GET request to the API endpoint specified when the `users` field is queried.", "type": "object", "required": [ - "path" + "url" ], "properties": { - "baseURL": { - "description": "This refers to the base URL of the API. If not specified, the default base URL is the one specified in the `@upstream` operator.", - "type": [ - "string", - "null" - ] - }, "batchKey": { "description": "The `batchKey` dictates the path Tailcall will follow to group the returned items from the batch request. For more details please refer out [n + 1 guide](https://tailcall.run/docs/guides/n+1#solving-using-batching).", "type": "array", @@ -774,10 +763,6 @@ } ] }, - "path": { - "description": "This refers to the API endpoint you're going to call. For instance `https://jsonplaceholder.typicode.com/users`.\n\nFor dynamic segments in your API endpoint, use Mustache templates for variable substitution. For instance, to fetch a specific user, use `/users/{{args.id}}`.", - "type": "string" - }, "query": { "description": "This represents the query parameters of your API call. You can pass it as a static object or use Mustache template for dynamic parameters. These parameters will be added to the URL. NOTE: Query parameter order is critical for batching in Tailcall. The first parameter referencing a field in the current value using mustache syntax is automatically selected as the batching parameter.", "type": "array", @@ -787,6 +772,10 @@ }, "select": { "description": "You can use `select` with mustache syntax to re-construct the directives response to the desired format. This is useful when data are deeply nested or want to keep specific fields only from the response.\n\n* EXAMPLE 1: if we have a call that returns `{ \"user\": { \"items\": [...], ... } ... }` we can use `\"{{.user.items}}\"`, to extract the `items`. * EXAMPLE 2: if we have a call that returns `{ \"foo\": \"bar\", \"fizz\": { \"buzz\": \"eggs\", ... }, ... }` we can use { foo: \"{{.foo}}\", buzz: \"{{.fizz.buzz}}\" }`" + }, + "url": { + "description": "This refers to URL of the API.", + "type": "string" } }, "additionalProperties": false @@ -1572,13 +1561,6 @@ }, "uniqueItems": true }, - "baseURL": { - "description": "This refers to the default base URL for your APIs. If it's not explicitly mentioned in the `@upstream` operator, then each [@http](#http) operator must specify its own `baseURL`. If neither `@upstream` nor [@http](#http) provides a `baseURL`, it results in a compilation error.", - "type": [ - "string", - "null" - ] - }, "batch": { "description": "An object that specifies the batch settings, including `maxSize` (the maximum size of the batch), `delay` (the delay in milliseconds between each batch), and `headers` (an array of HTTP headers to be included in the batch).", "anyOf": [ diff --git a/src/cli/generator/config.rs b/src/cli/generator/config.rs index a89a80fec2..183ee15c2f 100644 --- a/src/cli/generator/config.rs +++ b/src/cli/generator/config.rs @@ -43,8 +43,6 @@ pub struct LLMConfig { #[serde(deny_unknown_fields)] pub struct PresetConfig { pub merge_type: Option, - #[serde(rename = "consolidateURL")] - pub consolidate_url: Option, pub infer_type_names: Option, pub tree_shake: Option, pub unwrap_single_field_types: Option, @@ -85,6 +83,7 @@ pub enum Source { }, Proto { src: Location, + url: String, }, Config { src: Location, @@ -134,10 +133,6 @@ impl ValidateFrom for Preset { preset = preset.merge_type(merge_type); } - if let Some(consolidate_url) = config.consolidate_url { - preset = preset.consolidate_url(consolidate_url); - } - if let Some(use_better_names) = config.infer_type_names { preset = preset.infer_type_names(use_better_names); } @@ -154,10 +149,8 @@ impl ValidateFrom for Preset { Valid::succeed(preset) .and_then(|preset| { let merge_types_th = between(preset.merge_type, 0.0, 1.0).trace("mergeType"); - let consolidate_url_th = - between(preset.consolidate_url, 0.0, 1.0).trace("consolidateURL"); - merge_types_th.and(consolidate_url_th).map_to(preset) + merge_types_th.map_to(preset) }) .trace("preset") } @@ -224,9 +217,9 @@ impl Source { is_mutation, }) } - Source::Proto { src } => { + Source::Proto { src, url } => { let resolved_path = src.into_resolved(parent_dir); - Ok(Source::Proto { src: resolved_path }) + Ok(Source::Proto { src: resolved_path, url }) } Source::Config { src } => { let resolved_path = src.into_resolved(parent_dir); @@ -337,7 +330,6 @@ mod tests { tree_shake: None, infer_type_names: None, merge_type: Some(2.0), - consolidate_url: None, unwrap_single_field_types: None, }; @@ -352,14 +344,12 @@ mod tests { tree_shake: Some(true), infer_type_names: Some(true), merge_type: Some(0.5), - consolidate_url: Some(1.0), unwrap_single_field_types: None, }; let transform_preset: Preset = config_preset.validate_into().to_result().unwrap(); let expected_preset = Preset::new() .infer_type_names(true) .tree_shake(true) - .consolidate_url(1.0) .merge_type(0.5); assert_eq!(transform_preset, expected_preset); } @@ -431,12 +421,11 @@ mod tests { fn test_raise_error_unknown_field_in_preset() { let json = r#" {"preset": { - "mergeTypes": 1.0, - "consolidateURL": 0.5 - }} + "mergeTypes": 1.0 + }} "#; let expected_error = - "unknown field `mergeTypes`, expected one of `mergeType`, `consolidateURL`, `inferTypeNames`, `treeShake`, `unwrapSingleFieldTypes` at line 3 column 28"; + "unknown field `mergeTypes`, expected one of `mergeType`, `inferTypeNames`, `treeShake`, `unwrapSingleFieldTypes` at line 3 column 28"; assert_deserialization_error(json, expected_error); } diff --git a/src/cli/generator/generator.rs b/src/cli/generator/generator.rs index 0476ab13b4..9120e3f62d 100644 --- a/src/cli/generator/generator.rs +++ b/src/cli/generator/generator.rs @@ -139,13 +139,13 @@ impl Generator { headers: headers.into_btree_map(), }); } - Source::Proto { src } => { + Source::Proto { src, url } => { let path = src.0; let mut metadata = proto_reader.read(&path).await?; if let Some(relative_path_to_proto) = to_relative_path(output_dir, &path) { metadata.path = relative_path_to_proto; } - input_samples.push(Input::Proto(metadata)); + input_samples.push(Input::Proto { metadata, url }); } Source::Config { src } => { let path = src.0; diff --git a/src/core/blueprint/fixture/all-constructs.graphql b/src/core/blueprint/fixture/all-constructs.graphql index d93f4c9e14..43098a8157 100644 --- a/src/core/blueprint/fixture/all-constructs.graphql +++ b/src/core/blueprint/fixture/all-constructs.graphql @@ -1,6 +1,4 @@ -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query mutation: Mutation } @@ -44,8 +42,9 @@ type Post implements Node { } type Query { - user(id: ID!): User @http(path: "/users/{{.args.id}}") - search(term: String!): [SearchResult!] @http(path: "/search", query: [{key: "q", value: "{{.args.term}}"}]) + user(id: ID!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + search(term: String!): [SearchResult!] + @http(url: "http://jsonplaceholder.typicode.com/search", query: [{key: "q", value: "{{.args.term}}"}]) } input PostInput { @@ -55,6 +54,8 @@ input PostInput { } type Mutation { - createUser(input: UserInput!): User! @http(path: "/users", body: "{{.args.input}}", method: "POST") - createPost(input: PostInput): Post! @http(path: "/posts", body: "{{.args.input}}", method: "POST") + createUser(input: UserInput!): User! + @http(url: "http://jsonplaceholder.typicode.com/users", body: "{{.args.input}}", method: "POST") + createPost(input: PostInput): Post! + @http(url: "http://jsonplaceholder.typicode.com/posts", body: "{{.args.input}}", method: "POST") } diff --git a/src/core/blueprint/operators/graphql.rs b/src/core/blueprint/operators/graphql.rs index 80c99147c1..d54547b714 100644 --- a/src/core/blueprint/operators/graphql.rs +++ b/src/core/blueprint/operators/graphql.rs @@ -62,33 +62,27 @@ pub fn compile_graphql( graphql: &GraphQL, ) -> Valid { let args = graphql.args.as_ref(); - Valid::from_option( - graphql - .base_url - .as_ref() - .or(config.upstream.base_url.as_ref()), - "No base URL defined".to_string(), - ) - .zip(helpers::headers::to_mustache_headers(&graphql.headers)) - .and_then(|(base_url, headers)| { - Valid::from( - RequestTemplate::new( - base_url.to_owned(), - operation_type, - &graphql.name, - args, - headers, - create_related_fields(config, type_name, &mut HashSet::new()), + Valid::succeed(graphql.url.as_str()) + .zip(helpers::headers::to_mustache_headers(&graphql.headers)) + .and_then(|(base_url, headers)| { + Valid::from( + RequestTemplate::new( + base_url.to_owned(), + operation_type, + &graphql.name, + args, + headers, + create_related_fields(config, type_name, &mut HashSet::new()), + ) + .map_err(|e| ValidationError::new(e.to_string())), ) - .map_err(|e| ValidationError::new(e.to_string())), - ) - }) - .map(|req_template| { - let field_name = graphql.name.clone(); - let batch = graphql.batch; - let dedupe = graphql.dedupe.unwrap_or_default(); - IR::IO(IO::GraphQL { req_template, field_name, batch, dl_id: None, dedupe }) - }) + }) + .map(|req_template| { + let field_name = graphql.name.clone(); + let batch = graphql.batch; + let dedupe = graphql.dedupe.unwrap_or_default(); + IR::IO(IO::GraphQL { req_template, field_name, batch, dl_id: None, dedupe }) + }) } pub fn update_graphql<'a>( diff --git a/src/core/blueprint/operators/grpc.rs b/src/core/blueprint/operators/grpc.rs index adbfd419ea..1cf22c28c8 100644 --- a/src/core/blueprint/operators/grpc.rs +++ b/src/core/blueprint/operators/grpc.rs @@ -16,12 +16,8 @@ use crate::core::try_fold::TryFold; use crate::core::valid::{Valid, ValidationError, Validator}; use crate::core::{config, helpers}; -fn to_url(grpc: &Grpc, method: &GrpcMethod, config: &Config) -> Valid { - Valid::from_option( - grpc.base_url.as_ref().or(config.upstream.base_url.as_ref()), - "No base URL defined".to_string(), - ) - .and_then(|base_url| { +fn to_url(grpc: &Grpc, method: &GrpcMethod) -> Valid { + Valid::succeed(grpc.url.as_str()).and_then(|base_url| { let mut base_url = base_url.trim_end_matches('/').to_owned(); base_url.push('/'); base_url.push_str(format!("{}.{}", method.package, method.service).as_str()); @@ -172,7 +168,7 @@ pub fn compile_grpc(inputs: CompileGrpc) -> Valid { } to_operation(&method, file_descriptor_set) - .fuse(to_url(grpc, &method, config_module)) + .fuse(to_url(grpc, &method)) .fuse(helpers::headers::to_mustache_headers(&grpc.headers)) .fuse(helpers::body::to_body(grpc.body.as_ref())) .into() diff --git a/src/core/blueprint/operators/http.rs b/src/core/blueprint/operators/http.rs index b394a87d64..c7e7bb4cce 100644 --- a/src/core/blueprint/operators/http.rs +++ b/src/core/blueprint/operators/http.rs @@ -27,17 +27,9 @@ pub fn compile_http( && !http.batch_key.is_empty() }), ) - .and(Valid::from_option( - http.base_url - .as_ref() - .or(config_module.upstream.base_url.as_ref()), - "No base URL defined".to_string(), - )) + .and(Valid::succeed(http.url.as_str())) .zip(helpers::headers::to_mustache_headers(&http.headers)) .and_then(|(base_url, headers)| { - let mut base_url = base_url.trim_end_matches('/').to_owned(); - base_url.push_str(http.path.clone().as_str()); - let query = http .query .clone() diff --git a/src/core/blueprint/upstream.rs b/src/core/blueprint/upstream.rs index 28ab604d52..15171f90d5 100644 --- a/src/core/blueprint/upstream.rs +++ b/src/core/blueprint/upstream.rs @@ -23,7 +23,6 @@ pub struct Upstream { pub tcp_keep_alive: u64, pub user_agent: String, pub allowed_headers: BTreeSet, - pub base_url: Option, pub http_cache: u64, pub batch: Option, pub http2_only: bool, @@ -64,9 +63,8 @@ impl TryFrom<&ConfigModule> for Upstream { } get_batch(&config_upstream) - .fuse(get_base_url(&config_upstream)) .fuse(get_proxy(&config_upstream)) - .map(|(batch, base_url, proxy)| Upstream { + .map(|(batch, proxy)| Upstream { pool_idle_timeout: (config_upstream).get_pool_idle_timeout(), pool_max_idle_per_host: (config_upstream).get_pool_max_idle_per_host(), keep_alive_interval: (config_upstream).get_keep_alive_interval(), @@ -78,7 +76,6 @@ impl TryFrom<&ConfigModule> for Upstream { tcp_keep_alive: (config_upstream).get_tcp_keep_alive(), user_agent: (config_upstream).get_user_agent(), allowed_headers, - base_url, http_cache: (config_upstream).get_http_cache_size(), batch, http2_only: (config_upstream).get_http_2_only(), @@ -102,15 +99,6 @@ fn get_batch(upstream: &config::Upstream) -> Valid, String> { ) } -fn get_base_url(upstream: &config::Upstream) -> Valid, String> { - if let Some(ref base_url) = upstream.base_url { - Valid::from(reqwest::Url::parse(base_url).map_err(|e| ValidationError::new(e.to_string()))) - .map_to(Some(base_url.clone())) - } else { - Valid::succeed(None) - } -} - fn get_proxy(upstream: &config::Upstream) -> Valid, String> { if let Some(ref proxy) = upstream.proxy { Valid::succeed(Some(Proxy { url: proxy.url.clone() })) diff --git a/src/core/config/config_module/fixtures/subgraph-posts.graphql b/src/core/config/config_module/fixtures/subgraph-posts.graphql index 16cee982ba..ab6ff45aaf 100644 --- a/src/core/config/config_module/fixtures/subgraph-posts.graphql +++ b/src/core/config/config_module/fixtures/subgraph-posts.graphql @@ -1,13 +1,12 @@ -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - posts: [UserPost] @http(path: "/posts") - addComment(postId: Int!, comment: CommentInput!, premium: Boolean): Boolean @http(path: "/add-comment", method: POST) - searchComments(type: CommentSearch): [Comment] @http(path: "/comment") + posts: [UserPost] @http(url: "http://jsonplaceholder.typicode.com/posts") + addComment(postId: Int!, comment: CommentInput!, premium: Boolean): Boolean + @http(url: "http://jsonplaceholder.typicode.com/add-comment", method: POST) + searchComments(type: CommentSearch): [Comment] @http(url: "http://jsonplaceholder.typicode.com/comment") } interface Post { diff --git a/src/core/config/config_module/fixtures/subgraph-users.graphql b/src/core/config/config_module/fixtures/subgraph-users.graphql index a6b1f6e05b..d07194ec9e 100644 --- a/src/core/config/config_module/fixtures/subgraph-users.graphql +++ b/src/core/config/config_module/fixtures/subgraph-users.graphql @@ -1,13 +1,12 @@ -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{.args.id}}") - addComment(postId: Int!, comment: CommentInput!): Boolean @http(path: "/add-comment") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + addComment(postId: Int!, comment: CommentInput!): Boolean + @http(url: "http://jsonplaceholder.typicode.com/add-comment") } enum Role { @@ -26,13 +25,13 @@ type User { interface Post { userId: Int! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } type UserPost implements Post { userId: Int! title: String - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } input CommentInput { diff --git a/src/core/config/config_module/snapshots/tailcall__core__config__config_module__merge__tests__federation_router.snap b/src/core/config/config_module/snapshots/tailcall__core__config__config_module__merge__tests__federation_router.snap index a514247c2d..4a3cb46200 100644 --- a/src/core/config/config_module/snapshots/tailcall__core__config__config_module__merge__tests__federation_router.snap +++ b/src/core/config/config_module/snapshots/tailcall__core__config__config_module__merge__tests__federation_router.snap @@ -2,7 +2,7 @@ source: src/core/config/config_module/merge.rs expression: merged.to_sdl() --- -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: 42) { +schema @server(port: 8000) @upstream(batch: {delay: 100, headers: []}, httpCache: 42) { query: Query } @@ -14,7 +14,7 @@ input CommentInput { interface Post { body: String id: Int! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! } @@ -34,11 +34,11 @@ type Comment { } type Query { - addComment(postId: Int!, comment: CommentInput!): Boolean @http(method: "POST", path: "/add-comment") - posts: [UserPost] @http(path: "/posts") - searchComments(type: CommentSearch): [Comment] @http(path: "/comment") - user(id: Int!): User @http(path: "/users/{{.args.id}}") - users: [User] @http(path: "/users") + addComment(postId: Int!, comment: CommentInput!): Boolean @http(url: "http://jsonplaceholder.typicode.com/add-comment", method: "POST") + posts: [UserPost] @http(url: "http://jsonplaceholder.typicode.com/posts") + searchComments(type: CommentSearch): [Comment] @http(url: "http://jsonplaceholder.typicode.com/comment") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") version: String @expr(body: "test") } @@ -56,6 +56,6 @@ type UserPost implements Post { body: String id: Int! title: String - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! } diff --git a/src/core/config/directives/graphql.rs b/src/core/config/directives/graphql.rs index 63ff2355aa..e366bbaaa2 100644 --- a/src/core/config/directives/graphql.rs +++ b/src/core/config/directives/graphql.rs @@ -25,10 +25,8 @@ pub struct GraphQL { /// Named arguments for the requested field. More info [here](https://tailcall.run/docs/guides/operators/#args) pub args: Option>, - #[serde(rename = "baseURL", default, skip_serializing_if = "is_default")] - /// This refers to the base URL of the API. If not specified, the default - /// base URL is the one specified in the `@upstream` operator. - pub base_url: Option, + /// This refers URL of the API. + pub url: String, #[serde(default, skip_serializing_if = "is_default")] /// If the upstream GraphQL server supports request batching, you can diff --git a/src/core/config/directives/grpc.rs b/src/core/config/directives/grpc.rs index cdb744d05d..d770ce6502 100644 --- a/src/core/config/directives/grpc.rs +++ b/src/core/config/directives/grpc.rs @@ -30,10 +30,8 @@ use crate::core::is_default; /// In this scenario, the GraphQL server will make a gRPC request to the gRPC /// endpoint specified when the `users` field is queried. pub struct Grpc { - #[serde(rename = "baseURL", default, skip_serializing_if = "is_default")] - /// This refers to the base URL of the API. If not specified, the default - /// base URL is the one specified in the `@upstream` operator. - pub base_url: Option, + /// This refers to URL of the API. + pub url: String, #[serde(default, skip_serializing_if = "is_default")] /// This refers to the arguments of your gRPC call. You can pass it as a /// static object or use Mustache template for dynamic parameters. These diff --git a/src/core/config/directives/http.rs b/src/core/config/directives/http.rs index 00defb62c2..8d13eb44ac 100644 --- a/src/core/config/directives/http.rs +++ b/src/core/config/directives/http.rs @@ -34,10 +34,8 @@ pub struct Http { /// request interception handler. pub on_request: Option, - #[serde(rename = "baseURL", default, skip_serializing_if = "is_default")] - /// This refers to the base URL of the API. If not specified, the default - /// base URL is the one specified in the `@upstream` operator. - pub base_url: Option, + /// This refers to URL of the API. + pub url: String, #[serde(default, skip_serializing_if = "is_default")] /// The body of the API call. It's used for methods like POST or PUT that @@ -71,13 +69,6 @@ pub struct Http { /// include `GET`, `POST`, `PUT`, `DELETE` etc. @default `GET`. pub method: Method, - /// This refers to the API endpoint you're going to call. For instance `https://jsonplaceholder.typicode.com/users`. - /// - /// For dynamic segments in your API endpoint, use Mustache templates for - /// variable substitution. For instance, to fetch a specific user, use - /// `/users/{{args.id}}`. - pub path: String, - #[serde(default, skip_serializing_if = "is_default")] /// Schema of the output of the API call. It is automatically inferred in /// most cases. diff --git a/src/core/config/directives/upstream.rs b/src/core/config/directives/upstream.rs index baf6abf766..0beeb99d42 100644 --- a/src/core/config/directives/upstream.rs +++ b/src/core/config/directives/upstream.rs @@ -66,14 +66,6 @@ pub struct Upstream { /// security but possibly limiting data flow. pub allowed_headers: Option>, - #[serde(rename = "baseURL", default, skip_serializing_if = "is_default")] - /// This refers to the default base URL for your APIs. If it's not - /// explicitly mentioned in the `@upstream` operator, then each - /// [@http](#http) operator must specify its own `baseURL`. If neither - /// `@upstream` nor [@http](#http) provides a `baseURL`, it results in a - /// compilation error. - pub base_url: Option, - #[serde(default, skip_serializing_if = "is_default")] /// An object that specifies the batch settings, including `maxSize` (the /// maximum size of the batch), `delay` (the delay in milliseconds between diff --git a/src/core/config/npo/fixtures/cycles.graphql b/src/core/config/npo/fixtures/cycles.graphql index fde1f1acac..1db52b0384 100644 --- a/src/core/config/npo/fixtures/cycles.graphql +++ b/src/core/config/npo/fixtures/cycles.graphql @@ -12,5 +12,5 @@ type F2 { } type Query { - f1: [F1] @http(path: "") + f1: [F1] @http(url: "") } diff --git a/src/core/config/npo/fixtures/cyclic-resolver.graphql b/src/core/config/npo/fixtures/cyclic-resolver.graphql index 7e406e2f29..31b63a6d95 100644 --- a/src/core/config/npo/fixtures/cyclic-resolver.graphql +++ b/src/core/config/npo/fixtures/cyclic-resolver.graphql @@ -4,7 +4,7 @@ schema @server @upstream { type F1 { f1: [F1] - f2: String @http(path: "") + f2: String @http(url: "") } type F2 { @@ -12,5 +12,5 @@ type F2 { } type Query { - f1: F1 @http(path: "") + f1: F1 @http(url: "") } diff --git a/src/core/config/npo/fixtures/cyclic-resolvers.graphql b/src/core/config/npo/fixtures/cyclic-resolvers.graphql index c81a5777df..3a33a15c06 100644 --- a/src/core/config/npo/fixtures/cyclic-resolvers.graphql +++ b/src/core/config/npo/fixtures/cyclic-resolvers.graphql @@ -4,7 +4,7 @@ schema @server @upstream { type F1 { f1: [F1] - f2: String @http(path: "") + f2: String @http(url: "") } type F2 { @@ -12,5 +12,5 @@ type F2 { } type Query { - f1: [F1] @http(path: "") + f1: [F1] @http(url: "") } diff --git a/src/core/config/npo/fixtures/multiple-keys.graphql b/src/core/config/npo/fixtures/multiple-keys.graphql index 8cdcec69b8..58436360b0 100644 --- a/src/core/config/npo/fixtures/multiple-keys.graphql +++ b/src/core/config/npo/fixtures/multiple-keys.graphql @@ -3,8 +3,8 @@ schema @server @upstream { } type F1 { - f2: F2 @http(path: "") - f3: F3 @http(path: "") + f2: F2 @http(url: "") + f3: F3 @http(url: "") } type F2 { @@ -15,7 +15,7 @@ type F3 { } type Query { - f1: [F1] @http(path: "") - f2: F2 @http(path: "") - f3: F3 @http(path: "") + f1: [F1] @http(url: "") + f2: F2 @http(url: "") + f3: F3 @http(url: "") } diff --git a/src/core/config/npo/fixtures/nested-non-list.graphql b/src/core/config/npo/fixtures/nested-non-list.graphql index 2035a6cca6..942eed40ab 100644 --- a/src/core/config/npo/fixtures/nested-non-list.graphql +++ b/src/core/config/npo/fixtures/nested-non-list.graphql @@ -3,7 +3,7 @@ schema @server @upstream { } type F { - g: [G] @http(path: "") + g: [G] @http(url: "") } type G { @@ -11,5 +11,5 @@ type G { } type Query { - f: F @http(path: "") + f: F @http(url: "") } diff --git a/src/core/config/npo/fixtures/nested-resolvers.graphql b/src/core/config/npo/fixtures/nested-resolvers.graphql index 3f25f05a22..a7701977bb 100644 --- a/src/core/config/npo/fixtures/nested-resolvers.graphql +++ b/src/core/config/npo/fixtures/nested-resolvers.graphql @@ -11,9 +11,9 @@ type F2 { } type F3 { - f4: String @http(path: "") + f4: String @http(url: "") } type Query { - f1: [F1] @http(path: "") + f1: [F1] @http(url: "") } diff --git a/src/core/config/npo/fixtures/nested-without-resolvers.graphql b/src/core/config/npo/fixtures/nested-without-resolvers.graphql index 1db800eb1e..c18f69eb80 100644 --- a/src/core/config/npo/fixtures/nested-without-resolvers.graphql +++ b/src/core/config/npo/fixtures/nested-without-resolvers.graphql @@ -11,5 +11,5 @@ type F2 { } type Query { - f1: [F1] @http(path: "") + f1: [F1] @http(url: "") } diff --git a/src/core/config/npo/fixtures/non-list-resolvers.graphql b/src/core/config/npo/fixtures/non-list-resolvers.graphql index d71d601b42..ede9ead54e 100644 --- a/src/core/config/npo/fixtures/non-list-resolvers.graphql +++ b/src/core/config/npo/fixtures/non-list-resolvers.graphql @@ -11,9 +11,9 @@ type F2 { } type F3 { - f4: String @http(path: "") + f4: String @http(url: "") } type Query { - f1: F1 @http(path: "") + f1: F1 @http(url: "") } diff --git a/src/core/config/npo/fixtures/simple-batch-resolver.graphql b/src/core/config/npo/fixtures/simple-batch-resolver.graphql index 7cb2a10f4e..ba76bf78f3 100644 --- a/src/core/config/npo/fixtures/simple-batch-resolver.graphql +++ b/src/core/config/npo/fixtures/simple-batch-resolver.graphql @@ -3,7 +3,7 @@ schema @server @upstream { } type F1 { - f2: [F2] @http(batchKey: ["id"], path: "") + f2: [F2] @http(batchKey: ["id"], url: "") } type F2 { @@ -11,5 +11,5 @@ type F2 { } type Query { - f1: [F1] @http(path: "") + f1: [F1] @http(url: "") } diff --git a/src/core/config/npo/fixtures/simple-resolvers.graphql b/src/core/config/npo/fixtures/simple-resolvers.graphql index f0fea9e3f3..3981ecf3e2 100644 --- a/src/core/config/npo/fixtures/simple-resolvers.graphql +++ b/src/core/config/npo/fixtures/simple-resolvers.graphql @@ -3,7 +3,7 @@ schema @server @upstream { } type F1 { - f2: [F2] @http(path: "") + f2: [F2] @http(url: "") } type F2 { @@ -11,5 +11,5 @@ type F2 { } type Query { - f1: [F1] @http(path: "") + f1: [F1] @http(url: "") } diff --git a/src/core/config/transformer/ambiguous_type.rs b/src/core/config/transformer/ambiguous_type.rs index 225ad81f6c..1748de4974 100644 --- a/src/core/config/transformer/ambiguous_type.rs +++ b/src/core/config/transformer/ambiguous_type.rs @@ -150,7 +150,6 @@ impl Transform for AmbiguousType { #[cfg(test)] mod tests { - use insta::assert_snapshot; use prost_reflect::prost_types::FileDescriptorSet; use tailcall_fixtures::protobuf; @@ -246,12 +245,13 @@ mod tests { async fn test_resolve_ambiguous_news_types() -> anyhow::Result<()> { let news_proto = tailcall_fixtures::protobuf::NEWS; let set = compile_protobuf(&[protobuf::NEWS])?; + let url = "http://localhost:50051".to_string(); let cfg_module = Generator::default() - .inputs(vec![Input::Proto(ProtoMetadata { - descriptor_set: set, - path: news_proto.to_string(), - })]) + .inputs(vec![Input::Proto { + metadata: ProtoMetadata { descriptor_set: set, path: news_proto.to_string() }, + url, + }]) .generate(false)?; let mut config = AmbiguousType::default() diff --git a/src/core/config/transformer/consolidate_url/consolidate_url.rs b/src/core/config/transformer/consolidate_url/consolidate_url.rs deleted file mode 100644 index 71d90ebb9f..0000000000 --- a/src/core/config/transformer/consolidate_url/consolidate_url.rs +++ /dev/null @@ -1,140 +0,0 @@ -use std::collections::HashSet; - -use super::max_value_map::MaxValueMap; -use crate::core::config::{Config, Resolver}; -use crate::core::transform::Transform; -use crate::core::valid::Valid; - -struct UrlTypeMapping { - /// maintains the url to it's frequency mapping. - url_to_frequency_map: MaxValueMap, - /// maintains the types that contains the base_url in it's fields. - visited_type_set: HashSet, -} - -impl UrlTypeMapping { - fn new() -> Self { - Self { - url_to_frequency_map: Default::default(), - visited_type_set: Default::default(), - } - } - - /// Populates the URL type mapping based on the given configuration. - fn populate_url_frequency_map(&mut self, config: &Config) { - for (type_name, type_) in config.types.iter() { - for field in type_.fields.values() { - if let Some(Resolver::Http(http)) = &field.resolver { - if let Some(base_url) = &http.base_url { - self.url_to_frequency_map.increment(base_url.to_owned(), 1); - self.visited_type_set.insert(type_name.to_owned()); - } - } - } - } - } - - /// Finds the most common URL that meets the threshold. - fn find_common_url(&self, threshold: f32) -> Option { - if let Some((common_url, frequency)) = self.url_to_frequency_map.get_max_pair() { - if *frequency >= (self.url_to_frequency_map.len() as f32 * threshold).ceil() as u32 { - return Some(common_url.to_owned()); - } - } - None - } -} - -pub struct ConsolidateURL { - threshold: f32, -} - -impl ConsolidateURL { - pub fn new(threshold: f32) -> Self { - Self { threshold } - } - - fn generate_base_url(&self, mut config: Config) -> Config { - let mut url_type_mapping = UrlTypeMapping::new(); - url_type_mapping.populate_url_frequency_map(&config); - - if let Some(common_url) = url_type_mapping.find_common_url(self.threshold) { - config.upstream.base_url = Some(common_url.to_owned()); - - for type_name in url_type_mapping.visited_type_set { - if let Some(type_) = config.types.get_mut(&type_name) { - for field in type_.fields.values_mut() { - if let Some(Resolver::Http(http)) = &mut field.resolver { - if let Some(base_url) = &http.base_url { - if base_url == &common_url { - http.base_url = None; - } - } - } - } - } - } - } else { - tracing::warn!( - "Threshold matching base url not found, transformation cannot be performed." - ); - } - - config - } - - pub fn is_enabled(threshold: f32) -> bool { - threshold > 0.0 - } -} - -impl Transform for ConsolidateURL { - type Value = Config; - type Error = String; - fn transform(&self, config: Config) -> Valid { - let config = self.generate_base_url(config); - Valid::succeed(config) - } -} - -#[cfg(test)] -mod test { - use std::fs; - - use tailcall_fixtures::configs; - - use super::*; - use crate::core::config::Config; - use crate::core::transform::Transform; - use crate::core::valid::Validator; - - fn read_fixture(path: &str) -> String { - fs::read_to_string(path).unwrap() - } - - #[test] - fn should_generate_correct_upstream_when_multiple_base_urls_present() { - let config = Config::from_sdl(read_fixture(configs::MULTI_URL_CONFIG).as_str()) - .to_result() - .unwrap(); - - let transformed_config = ConsolidateURL::new(0.5) - .transform(config) - .to_result() - .unwrap(); - insta::assert_snapshot!(transformed_config.to_sdl()); - } - - #[test] - fn should_not_generate_upstream_when_threshold_is_not_matched() { - let config = Config::from_sdl(read_fixture(configs::MULTI_URL_CONFIG).as_str()) - .to_result() - .unwrap(); - - let transformed_config = ConsolidateURL::new(0.9) - .transform(config) - .to_result() - .unwrap(); - insta::assert_snapshot!(transformed_config.to_sdl()); - } -} diff --git a/src/core/config/transformer/consolidate_url/max_value_map.rs b/src/core/config/transformer/consolidate_url/max_value_map.rs deleted file mode 100644 index 9f6786dd55..0000000000 --- a/src/core/config/transformer/consolidate_url/max_value_map.rs +++ /dev/null @@ -1,91 +0,0 @@ -use std::collections::HashMap; -use std::hash::Hash; - -/// A data structure that holds K and V, and allows querying the max valued key -/// in O(1) time complexity -pub struct MaxValueMap { - map: HashMap, - max_valued_key: Option, -} - -impl Default for MaxValueMap -where - K: Eq + Hash + Clone, - V: PartialOrd + Clone + std::ops::AddAssign, -{ - fn default() -> Self { - Self::new() - } -} - -impl MaxValueMap -where - K: Eq + Hash + Clone, - V: PartialOrd + Clone + std::ops::AddAssign, -{ - pub fn new() -> Self { - MaxValueMap { map: HashMap::new(), max_valued_key: None } - } - - pub fn insert(&mut self, key: K, value: V) { - if let Some((_, max_value)) = self.get_max_pair() { - if *max_value < value { - self.max_valued_key = Some(key.to_owned()); - } - } else { - self.max_valued_key = Some(key.to_owned()); - } - self.map.insert(key, value); - } - - pub fn increment(&mut self, key: K, increment_by: V) - where - V: Clone + std::ops::Add, - { - if let Some(value) = self.map.get(&key) { - self.insert(key, value.to_owned() + increment_by); - } else { - self.insert(key, increment_by); - } - } - - pub fn get_max_pair(&self) -> Option<(&K, &V)> { - if let Some(ref key) = self.max_valued_key { - return self.map.get_key_value(key); - } - None - } - - pub fn len(&self) -> usize { - self.map.len() - } -} - -#[cfg(test)] -mod tests { - use super::*; - - #[test] - fn test_insert() { - let mut max_value_map = MaxValueMap::new(); - max_value_map.insert("a", 10); - max_value_map.insert("b", 20); - - assert_eq!(max_value_map.get_max_pair(), Some((&"b", &20))); - } - - #[test] - fn test_increment() { - let mut max_value_map = MaxValueMap::new(); - max_value_map.insert("a", 10); - max_value_map.increment("a", 15); // "a" becomes 25 - - assert_eq!(max_value_map.get_max_pair(), Some((&"a", &25))); - } - - #[test] - fn test_get_max_pair_empty() { - let max_value_map: MaxValueMap = MaxValueMap::new(); - assert_eq!(max_value_map.get_max_pair(), None); - } -} diff --git a/src/core/config/transformer/consolidate_url/mod.rs b/src/core/config/transformer/consolidate_url/mod.rs deleted file mode 100644 index f4424fa0f0..0000000000 --- a/src/core/config/transformer/consolidate_url/mod.rs +++ /dev/null @@ -1,4 +0,0 @@ -mod consolidate_url; -mod max_value_map; - -pub use consolidate_url::ConsolidateURL; diff --git a/src/core/config/transformer/consolidate_url/snapshots/tailcall__core__config__transformer__consolidate_url__consolidate_url__test__should_generate_correct_upstream_when_multiple_base_urls_present.snap b/src/core/config/transformer/consolidate_url/snapshots/tailcall__core__config__transformer__consolidate_url__consolidate_url__test__should_generate_correct_upstream_when_multiple_base_urls_present.snap deleted file mode 100644 index b90f6e9722..0000000000 --- a/src/core/config/transformer/consolidate_url/snapshots/tailcall__core__config__transformer__consolidate_url__consolidate_url__test__should_generate_correct_upstream_when_multiple_base_urls_present.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: src/core/config/transformer/consolidate_url/consolidate_url.rs -expression: transformed_config.to_sdl() ---- -schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder-1.typicode.com", httpCache: 42) { - query: Query -} - -type Post { - body: String! - id: Int! - title: String! - user: User @http(baseURL: "http://jsonplaceholder-2.typicode.com", path: "/users/{{.value.userId}}") - userId: Int! -} - -type Query { - post(id: Int!): Post @http(path: "/posts/{{.args.id}}") - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(baseURL: "http://jsonplaceholder-3.typicode.com", path: "/users/{{.args.id}}") - users: [User] @http(baseURL: "http://jsonplaceholder-2.typicode.com", path: "/users") -} - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String @expr(body: "/users/website/{{.value.username}}") -} diff --git a/src/core/config/transformer/consolidate_url/snapshots/tailcall__core__config__transformer__consolidate_url__consolidate_url__test__should_not_generate_upstream_when_threshold_is_not_matched.snap b/src/core/config/transformer/consolidate_url/snapshots/tailcall__core__config__transformer__consolidate_url__consolidate_url__test__should_not_generate_upstream_when_threshold_is_not_matched.snap deleted file mode 100644 index 3b4fffba89..0000000000 --- a/src/core/config/transformer/consolidate_url/snapshots/tailcall__core__config__transformer__consolidate_url__consolidate_url__test__should_not_generate_upstream_when_threshold_is_not_matched.snap +++ /dev/null @@ -1,31 +0,0 @@ ---- -source: src/core/config/transformer/consolidate_url/consolidate_url.rs -expression: transformed_config.to_sdl() ---- -schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) { - query: Query -} - -type Post { - body: String! - id: Int! - title: String! - user: User @http(baseURL: "http://jsonplaceholder-2.typicode.com", path: "/users/{{.value.userId}}") - userId: Int! -} - -type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplaceholder-1.typicode.com", path: "/posts/{{.args.id}}") - posts: [Post] @http(baseURL: "http://jsonplaceholder-1.typicode.com", path: "/posts") - user(id: Int!): User @http(baseURL: "http://jsonplaceholder-3.typicode.com", path: "/users/{{.args.id}}") - users: [User] @http(baseURL: "http://jsonplaceholder-2.typicode.com", path: "/users") -} - -type User { - email: String! - id: Int! - name: String! - phone: String - username: String! - website: String @expr(body: "/users/website/{{.value.username}}") -} diff --git a/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__input_types.snap b/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__input_types.snap index d2622368ce..725071fd48 100644 --- a/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__input_types.snap +++ b/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__input_types.snap @@ -2,7 +2,7 @@ source: src/core/config/transformer/merge_types/type_merger.rs expression: config.to_sdl() --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -16,7 +16,7 @@ input GEN__M1 { } type Query { - bar(input: GEN__M1): String @http(path: "/bar") - far(input: Far): String @http(path: "/far") - foo(input: GEN__M1): String @http(path: "/foo") + bar(input: GEN__M1): String @http(url: "https://jsonplaceholder.typicode.com/bar") + far(input: Far): String @http(url: "https://jsonplaceholder.typicode.com/far") + foo(input: GEN__M1): String @http(url: "https://jsonplaceholder.typicode.com/foo") } diff --git a/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__list_field_types.snap b/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__list_field_types.snap index 3e212a6efb..618f632dc9 100644 --- a/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__list_field_types.snap +++ b/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__list_field_types.snap @@ -2,7 +2,7 @@ source: src/core/config/transformer/merge_types/type_merger.rs expression: config.to_sdl() --- -schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) { query: Query } @@ -15,8 +15,8 @@ type F3 { } type Query { - user(id: Int!): F3 @http(path: "/users/{{.args.id}}") - users: F2 @http(path: "/users") + user(id: Int!): F3 @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + users: F2 @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__union_types.snap b/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__union_types.snap index 9dff6bd02b..c463a6d54d 100644 --- a/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__union_types.snap +++ b/src/core/config/transformer/merge_types/snapshots/tailcall__core__config__transformer__merge_types__type_merger__test__union_types.snap @@ -2,7 +2,7 @@ source: src/core/config/transformer/merge_types/type_merger.rs expression: config.to_sdl() --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,5 +19,5 @@ type GEN__M1 { } type Query { - foo: FooBar @http(path: "/foo") + foo: FooBar @http(url: "http://jsonplacheholder.typicode.com/foo") } diff --git a/src/core/config/transformer/mod.rs b/src/core/config/transformer/mod.rs index 75a1396761..01a037c6bd 100644 --- a/src/core/config/transformer/mod.rs +++ b/src/core/config/transformer/mod.rs @@ -1,5 +1,4 @@ mod ambiguous_type; -mod consolidate_url; mod flatten_single_field; mod improve_type_names; mod merge_types; @@ -12,7 +11,6 @@ mod tree_shake; mod union_input_type; pub use ambiguous_type::{AmbiguousType, Resolution}; -pub use consolidate_url::ConsolidateURL; pub use flatten_single_field::FlattenSingleField; pub use improve_type_names::ImproveTypeNames; pub use merge_types::TypeMerger; diff --git a/src/core/config/transformer/preset.rs b/src/core/config/transformer/preset.rs index b888f0cce8..ac54401473 100644 --- a/src/core/config/transformer/preset.rs +++ b/src/core/config/transformer/preset.rs @@ -8,7 +8,6 @@ use crate::core::transform::{self, Transform, TransformerOps}; #[derive(Setters, Debug, PartialEq)] pub struct Preset { pub merge_type: f32, - pub consolidate_url: f32, pub tree_shake: bool, pub infer_type_names: bool, pub unwrap_single_field_types: bool, @@ -18,7 +17,6 @@ impl Preset { pub fn new() -> Self { Self { merge_type: 0.0, - consolidate_url: 0.0, tree_shake: false, infer_type_names: false, unwrap_single_field_types: true, @@ -43,10 +41,6 @@ impl Transform for Preset { ) .pipe(super::FlattenSingleField.when(self.unwrap_single_field_types)) .pipe(super::ImproveTypeNames.when(self.infer_type_names)) - .pipe( - super::ConsolidateURL::new(self.consolidate_url) - .when(super::ConsolidateURL::is_enabled(self.consolidate_url)), - ) .transform(config) } } @@ -55,7 +49,6 @@ impl Default for Preset { fn default() -> Self { Self { merge_type: 1.0, - consolidate_url: 0.5, infer_type_names: true, tree_shake: true, unwrap_single_field_types: false, diff --git a/src/core/config/transformer/rename_types.rs b/src/core/config/transformer/rename_types.rs index 1ff72b9c2c..685d77646b 100644 --- a/src/core/config/transformer/rename_types.rs +++ b/src/core/config/transformer/rename_types.rs @@ -174,10 +174,10 @@ mod test { COMPLETED } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type Mutation { - createUser(user: B!): A @http(method: POST, path: "/users", body: "{{args.user}}") + createUser(user: B!): A @http(method: POST, url: "http://jsonplaceholder.typicode.com/users", body: "{{args.user}}") } "#; let config = Config::from_sdl(sdl).to_result().unwrap(); @@ -210,7 +210,7 @@ mod test { title: String } type PostQuery { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } "#; let config = Config::from_sdl(sdl).to_result().unwrap(); @@ -237,7 +237,7 @@ mod test { body: String } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } "#; let config = Config::from_sdl(sdl).to_result().unwrap(); @@ -272,7 +272,7 @@ mod test { title: String } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "/posts") } "#; let config = Config::from_sdl(sdl).to_result().unwrap(); diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__ambiguous_type__tests__resolve_ambiguous_news_types.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__ambiguous_type__tests__resolve_ambiguous_news_types.snap index 54b21b53c8..438ff66017 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__ambiguous_type__tests__resolve_ambiguous_news_types.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__ambiguous_type__tests__resolve_ambiguous_news_types.snap @@ -41,10 +41,10 @@ type GEN__news__NewsList { } type Query { - GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(body: "{{.args.news}}", method: "news.NewsService.AddNews") - GEN__news__NewsService__DeleteNews(newsId: GEN__news__NewsId!): Empty @grpc(body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") - GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(body: "{{.args.news}}", method: "news.NewsService.EditNews") - GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(method: "news.NewsService.GetAllNews") - GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") - GEN__news__NewsService__GetNews(newsId: GEN__news__NewsId!): GEN__news__News @grpc(body: "{{.args.newsId}}", method: "news.NewsService.GetNews") + GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.AddNews") + GEN__news__NewsService__DeleteNews(newsId: GEN__news__NewsId!): Empty @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") + GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.EditNews") + GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(url: "http://localhost:50051", body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") + GEN__news__NewsService__GetNews(newsId: GEN__news__NewsId!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.GetNews") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator.snap index f77d6903e3..09d179abcb 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator.snap @@ -2,7 +2,7 @@ source: src/core/config/transformer/improve_type_names.rs expression: transformed_config.to_sdl() --- -schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://example.typicode.com", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) { query: Query } @@ -17,7 +17,7 @@ type F1 { } type Query { - f1: F1 @http(path: "/colors") + f1: F1 @http(url: "http://example.typicode.com/colors") } type T3 { diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_transform.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_transform.snap index 5adc5c064e..529931e56e 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_transform.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_transform.snap @@ -37,5 +37,5 @@ type Geo { } type Query { - f1: [F1] @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users") + f1: [F1] @http(url: "https://jsonplaceholder.typicode.com/users") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_with_cyclic_types.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_with_cyclic_types.snap index 2b5aed96fa..8dfc11f868 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_with_cyclic_types.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__improve_type_names__test__type_name_generator_with_cyclic_types.snap @@ -26,5 +26,5 @@ type Post { } type Query { - f1: [Author] @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users") + f1: [Author] @http(url: "https://jsonplaceholder.typicode.com/users") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__nested_unions__tests__nested_unions.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__nested_unions__tests__nested_unions.snap index e1f1192937..61d3ccbecf 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__nested_unions__tests__nested_unions.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__nested_unions__tests__nested_unions.snap @@ -34,5 +34,5 @@ union U1 = T1 | T2 | T3 union U2 = T3 | T4 type Query { - test(u: U!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") + test(u: U!): U @http(url: "http://localhost/users/{{args.u}}") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__inferface_rename.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__inferface_rename.snap index 06f20b4e3e..00d4511bf6 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__inferface_rename.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__inferface_rename.snap @@ -16,5 +16,5 @@ type Post implements NodeTest { } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "/posts") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__rename_type.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__rename_type.snap index 6f3669a884..853b670043 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__rename_type.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__rename_types__test__rename_type.snap @@ -26,7 +26,7 @@ type Post { } type PostQuery { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { @@ -35,5 +35,5 @@ type User { } type UserMutation { - createUser(user: InputUser!): User @http(body: "{{args.user}}", method: "POST", path: "/users") + createUser(user: InputUser!): User @http(url: "http://jsonplaceholder.typicode.com/users", body: "{{args.user}}", method: "POST") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__subgraph__tests__extractor__non_value_template.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__subgraph__tests__extractor__non_value_template.snap index 8fabb5a9e6..e01033b5f2 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__subgraph__tests__extractor__non_value_template.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__subgraph__tests__extractor__non_value_template.snap @@ -11,7 +11,7 @@ Valid( description: None, trace: [ "http", - "path", + "url", ], }, Cause { diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__nested_unions.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__nested_unions.snap index d967ae1f70..86249a9b06 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__nested_unions.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__nested_unions.snap @@ -34,9 +34,9 @@ union U1 = T1 | T2 | T3 union U2 = T3 | T4 type Query { - testVar0(u: T1!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar1(u: T2!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar2(u: T3!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar3(u: T4!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar4(u: T5!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") + testVar0(u: T1!): U @http(url: "http://localhost/users/{{args.u}}") + testVar1(u: T2!): U @http(url: "http://localhost/users/{{args.u}}") + testVar2(u: T3!): U @http(url: "http://localhost/users/{{args.u}}") + testVar3(u: T4!): U @http(url: "http://localhost/users/{{args.u}}") + testVar4(u: T5!): U @http(url: "http://localhost/users/{{args.u}}") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__recursive_input.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__recursive_input.snap index d97ad02499..24fe5b9359 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__recursive_input.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__recursive_input.snap @@ -2,7 +2,7 @@ source: src/core/config/transformer/union_input_type.rs expression: config.to_sdl() --- -schema @server(port: 8000) @upstream(baseURL: "http://localhost") { +schema @server(port: 8000) @upstream { query: Query } @@ -16,5 +16,5 @@ input Foo { } type Query { - bars(filter: Bar): String @graphQL(args: [{key: "baz", value: "{{.args.baz}}"}], baseURL: "http://localhost", name: "bars") + bars(filter: Bar): String @graphQL(args: [{key: "baz", value: "{{.args.baz}}"}], url: "http://localhost", name: "bars") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union.snap index ef8c7cf816..a50dc27104 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union.snap @@ -22,7 +22,7 @@ input T3 { union U = T1 | T2 | T3 type Query { - testVar0(u: T1!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar1(u: T2!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar2(u: T3!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") + testVar0(u: T1!): U @http(url: "http://localhost/users/{{args.u}}") + testVar1(u: T2!): U @http(url: "http://localhost/users/{{args.u}}") + testVar2(u: T3!): U @http(url: "http://localhost/users/{{args.u}}") } diff --git a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union_in_type.snap b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union_in_type.snap index 78dd4c5006..b27bbc7d60 100644 --- a/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union_in_type.snap +++ b/src/core/config/transformer/snapshots/tailcall__core__config__transformer__union_input_type__tests__union_in_type.snap @@ -66,13 +66,13 @@ type NU { } type Query { - testVar0Var0(nu: NU__u0!, nnu: NNU__nu0): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar0Var1(nu: NU__u0!, nnu: NNU__nu1): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar0Var2(nu: NU__u0!, nnu: NNU__nu2): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar1Var0(nu: NU__u1!, nnu: NNU__nu0): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar1Var1(nu: NU__u1!, nnu: NNU__nu1): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar1Var2(nu: NU__u1!, nnu: NNU__nu2): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar2Var0(nu: NU__u2!, nnu: NNU__nu0): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar2Var1(nu: NU__u2!, nnu: NNU__nu1): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar2Var2(nu: NU__u2!, nnu: NNU__nu2): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") + testVar0Var0(nu: NU__u0!, nnu: NNU__nu0): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar0Var1(nu: NU__u0!, nnu: NNU__nu1): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar0Var2(nu: NU__u0!, nnu: NNU__nu2): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar1Var0(nu: NU__u1!, nnu: NNU__nu0): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar1Var1(nu: NU__u1!, nnu: NNU__nu1): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar1Var2(nu: NU__u1!, nnu: NNU__nu2): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar2Var0(nu: NU__u2!, nnu: NNU__nu0): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar2Var1(nu: NU__u2!, nnu: NNU__nu1): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar2Var2(nu: NU__u2!, nnu: NNU__nu2): U @http(url: "http://localhost/users/{{args.nu.u}}") } diff --git a/src/core/config/transformer/subgraph.rs b/src/core/config/transformer/subgraph.rs index eae26a1e2c..014d8ba542 100644 --- a/src/core/config/transformer/subgraph.rs +++ b/src/core/config/transformer/subgraph.rs @@ -198,8 +198,7 @@ impl KeysExtractor { Resolver::Http(http) => { Valid::from_iter( [ - Self::parse_str_option(http.base_url.as_deref()).trace("base_url"), - Self::parse_str(&http.path).trace("path"), + Self::parse_str(http.url.as_str()).trace("url"), Self::parse_str_option(http.body.as_deref()).trace("body"), Self::parse_key_value_iter(http.headers.iter()).trace("headers"), Self::parse_key_value_iter(http.query.iter().map(|q| KeyValue { @@ -214,7 +213,7 @@ impl KeysExtractor { } Resolver::Grpc(grpc) => Valid::from_iter( [ - Self::parse_str_option(grpc.base_url.as_deref()), + Self::parse_str(grpc.url.as_str()), Self::parse_str(&grpc.method), Self::parse_value_option(&grpc.body), Self::parse_key_value_iter(grpc.headers.iter()), @@ -389,8 +388,7 @@ mod tests { #[test] fn test_non_value_template() { let http = Http { - base_url: Some("http://tailcall.run".to_string()), - path: "users/{{.args.id}}".to_string(), + url: "http://tailcall.run/users/{{.args.id}}".to_string(), query: vec![URLQuery { key: "{{.env.query.key}}".to_string(), value: "{{.args.query.value}}".to_string(), @@ -407,14 +405,13 @@ mod tests { #[test] fn test_extract_http() { let http = Http { - base_url: Some("http://tailcall.run".to_string()), + url: "http://tailcall.run/users/{{.value.id}}".to_string(), body: Some(r#"{ "obj": "{{.value.obj}}"} "#.to_string()), headers: vec![KeyValue { key: "{{.value.header.key}}".to_string(), value: "{{.value.header.value}}".to_string(), }], method: Method::POST, - path: "users/{{.value.id}}".to_string(), query: vec![URLQuery { key: "{{.value.query_key}}".to_string(), value: "{{.value.query_value}}".to_string(), @@ -431,7 +428,7 @@ mod tests { #[test] fn test_extract_grpc() { let grpc = Grpc { - base_url: Some("http://localhost:5051/{{.env.target}}".to_string()), + url: "http://localhost:5051/{{.env.target}}".to_string(), body: Some(json!({ "a": "{{.value.body.a}}", "b": "{{.value.body.b}}"})), headers: vec![KeyValue { key: "test".to_string(), @@ -450,7 +447,7 @@ mod tests { #[test] fn test_extract_graphql() { let graphql = GraphQL { - base_url: Some("http://localhost:5051/{{.env.target}}".to_string()), + url: "http://localhost:5051/{{.env.target}}".to_string(), headers: vec![KeyValue { key: "test".to_string(), value: "{{.value.header_test}}".to_string(), diff --git a/src/core/errata.rs b/src/core/errata.rs index 7cc493ef3b..6f681511a2 100644 --- a/src/core/errata.rs +++ b/src/core/errata.rs @@ -306,18 +306,18 @@ mod tests { #[test] fn test_title_trace_caused_by() { let error = Errata::new("Configuration Error").caused_by(vec![Errata::new( - "Base URL needs to be specified", + "URL needs to be specified", ) .trace(vec![ "User".into(), "posts".into(), "@http".into(), - "baseURL".into(), + "url".into(), ])]); let expected = r"|Configuration Error |Caused by: - | • Base URL needs to be specified [at User.posts.@http.baseURL]" + | • URL needs to be specified [at User.posts.@http.url]" .strip_margin(); assert_eq!(error.to_string(), expected); @@ -326,40 +326,40 @@ mod tests { #[test] fn test_title_trace_multiple_caused_by() { let error = Errata::new("Configuration Error").caused_by(vec![ - Errata::new("Base URL needs to be specified").trace(vec![ + Errata::new("URL needs to be specified").trace(vec![ "User".into(), "posts".into(), "@http".into(), - "baseURL".into(), + "url".into(), ]), - Errata::new("Base URL needs to be specified").trace(vec![ + Errata::new("URL needs to be specified").trace(vec![ "Post".into(), "users".into(), "@http".into(), - "baseURL".into(), + "url".into(), ]), - Errata::new("Base URL needs to be specified") - .description("Set `baseURL` in @http or @server directives".into()) + Errata::new("URL needs to be specified") + .description("Set `url` in @http or @server directives".into()) .trace(vec![ "Query".into(), "users".into(), "@http".into(), - "baseURL".into(), + "url".into(), ]), - Errata::new("Base URL needs to be specified").trace(vec![ + Errata::new("URL needs to be specified").trace(vec![ "Query".into(), "posts".into(), "@http".into(), - "baseURL".into(), + "url".into(), ]), ]); let expected = r"|Configuration Error |Caused by: - | • Base URL needs to be specified [at User.posts.@http.baseURL] - | • Base URL needs to be specified [at Post.users.@http.baseURL] - | • Base URL needs to be specified: Set `baseURL` in @http or @server directives [at Query.users.@http.baseURL] - | • Base URL needs to be specified [at Query.posts.@http.baseURL]" + | • URL needs to be specified [at User.posts.@http.url] + | • URL needs to be specified [at Post.users.@http.url] + | • URL needs to be specified: Set `url` in @http or @server directives [at Query.users.@http.url] + | • URL needs to be specified [at Query.posts.@http.url]" .strip_margin(); assert_eq!(error.to_string(), expected); @@ -367,14 +367,14 @@ mod tests { #[test] fn test_from_validation() { - let cause = Cause::new("Base URL needs to be specified") - .description("Set `baseURL` in @http or @server directives") - .trace(vec!["Query", "users", "@http", "baseURL"]); + let cause = Cause::new("URL needs to be specified") + .description("Set `url` in @http or @server directives") + .trace(vec!["Query", "users", "@http", "url"]); let valid = ValidationError::from(cause); let error = Errata::from(valid); let expected = r"|Invalid Configuration |Caused by: - | • Base URL needs to be specified: Set `baseURL` in @http or @server directives [at Query.users.@http.baseURL]" + | • URL needs to be specified: Set `url` in @http or @server directives [at Query.users.@http.url]" .strip_margin(); assert_eq!(error.to_string(), expected); diff --git a/src/core/generator/from_json.rs b/src/core/generator/from_json.rs index bb615a771b..1f380d8ced 100644 --- a/src/core/generator/from_json.rs +++ b/src/core/generator/from_json.rs @@ -125,10 +125,6 @@ impl Transform for FromJsonGenerator<'_> { &sample.operation_type, &header_keys, )) - .pipe(json::FieldBaseUrlGenerator::new( - &sample.url, - &sample.operation_type, - )) .pipe(RenameTypes::new(rename_types.into_iter())) .transform(config.clone()) }) diff --git a/src/core/generator/from_proto.rs b/src/core/generator/from_proto.rs index 633d7b4fb8..3066e704c5 100644 --- a/src/core/generator/from_proto.rs +++ b/src/core/generator/from_proto.rs @@ -327,6 +327,7 @@ impl Context { mut self, services: &[ServiceDescriptorProto], parent_path: &PathBuilder, + url: &str, ) -> Result { if services.is_empty() { return Ok(self); @@ -367,7 +368,7 @@ impl Context { cfg_field.type_of = cfg_field.type_of.with_name(output_ty); cfg_field.resolver = Some(Resolver::Grpc(Grpc { - base_url: None, + url: url.to_string(), body, batch_key: vec![], headers: vec![], @@ -454,7 +455,7 @@ fn get_input_type(input_ty: &str) -> Result>> { } /// The main entry point that builds a Config object from proto descriptor sets. -pub fn from_proto(descriptor_sets: &[FileDescriptorSet], query: &str) -> Result { +pub fn from_proto(descriptor_sets: &[FileDescriptorSet], query: &str, url: &str) -> Result { let mut ctx = Context::new(query); for descriptor_set in descriptor_sets.iter() { for file_descriptor in descriptor_set.file.iter() { @@ -469,7 +470,7 @@ pub fn from_proto(descriptor_sets: &[FileDescriptorSet], query: &str) -> Result< ctx = ctx .append_enums(&file_descriptor.enum_type, &root_path, false) .append_msg_type(&file_descriptor.message_type, &root_path, false)? - .append_query_service(&file_descriptor.service, &root_path)?; + .append_query_service(&file_descriptor.service, &root_path, url)?; } } @@ -497,7 +498,7 @@ mod test { macro_rules! assert_gen { ($( $set:expr ), +) => { let set = compile_protobuf(&[$( $set ),+]).unwrap(); - let config = from_proto(&[set], "Query").unwrap(); + let config = from_proto(&[set], "Query", "http://localhost:50051").unwrap(); let config_module = ConfigModule::from(config); let result = config_module.to_sdl(); insta::assert_snapshot!(result); @@ -541,9 +542,10 @@ mod test { let set1 = compile_protobuf(&[protobuf::NEWS])?; let set2 = compile_protobuf(&[protobuf::GREETINGS_A])?; let set3 = compile_protobuf(&[protobuf::GREETINGS_B])?; + let url = "http://localhost:50051"; - let actual = from_proto(&[set.clone()], "Query")?.to_sdl(); - let expected = from_proto(&[set1, set2, set3], "Query")?.to_sdl(); + let actual = from_proto(&[set.clone()], "Query", url)?.to_sdl(); + let expected = from_proto(&[set1, set2, set3], "Query", url)?.to_sdl(); pretty_assertions::assert_eq!(actual, expected); Ok(()) diff --git a/src/core/generator/generator.rs b/src/core/generator/generator.rs index 0e27e2f688..d27edac4d2 100644 --- a/src/core/generator/generator.rs +++ b/src/core/generator/generator.rs @@ -38,7 +38,10 @@ pub enum Input { is_mutation: bool, headers: Option>, }, - Proto(ProtoMetadata), + Proto { + url: String, + metadata: ProtoMetadata, + }, Config { schema: String, source: config::Source, @@ -83,9 +86,10 @@ impl Generator { &self, metadata: &ProtoMetadata, operation_name: &str, + url: &str, ) -> anyhow::Result { let descriptor_set = resolve_file_descriptor_set(metadata.descriptor_set.clone())?; - let mut config = from_proto(&[descriptor_set], operation_name)?; + let mut config = from_proto(&[descriptor_set], operation_name, url)?; config.links.push(Link { id: None, src: metadata.path.to_owned(), @@ -128,9 +132,9 @@ impl Generator { config = config .merge_right(self.generate_from_json(&type_name_generator, &[req_sample])?); } - Input::Proto(proto_input) => { + Input::Proto { metadata, url } => { config = - config.merge_right(self.generate_from_proto(proto_input, &self.query)?); + config.merge_right(self.generate_from_proto(metadata, &self.query, url)?); } } } @@ -253,10 +257,13 @@ pub mod test { let set = compile_protobuf(&[news_proto])?; let cfg_module = Generator::default() - .inputs(vec![Input::Proto(ProtoMetadata { - descriptor_set: set, - path: "../../../tailcall-fixtures/fixtures/protobuf/news.proto".to_string(), - })]) + .inputs(vec![Input::Proto { + metadata: ProtoMetadata { + descriptor_set: set, + path: "../../../tailcall-fixtures/fixtures/protobuf/news.proto".to_string(), + }, + url: "http://localhost:50051".to_string(), + }]) .generate(false)?; insta::assert_snapshot!(cfg_module.config().to_sdl()); @@ -303,10 +310,13 @@ pub mod test { // Proto input let news_proto = tailcall_fixtures::protobuf::NEWS; let proto_set = compile_protobuf(&[news_proto])?; - let proto_input = Input::Proto(ProtoMetadata { - descriptor_set: proto_set, - path: "../../../tailcall-fixtures/fixtures/protobuf/news.proto".to_string(), - }); + let proto_input = Input::Proto { + metadata: ProtoMetadata { + descriptor_set: proto_set, + path: "../../../tailcall-fixtures/fixtures/protobuf/news.proto".to_string(), + }, + url: "http://localhost:50051".to_string(), + }; // Config input let config_input = Input::Config { diff --git a/src/core/generator/json/field_base_url_generator.rs b/src/core/generator/json/field_base_url_generator.rs deleted file mode 100644 index 1fec627b4d..0000000000 --- a/src/core/generator/json/field_base_url_generator.rs +++ /dev/null @@ -1,161 +0,0 @@ -use convert_case::{Case, Casing}; -use url::Url; - -use super::url_utils::extract_base_url; -use crate::core::config::{Config, GraphQLOperationType, Resolver}; -use crate::core::transform::Transform; -use crate::core::valid::Valid; - -pub struct FieldBaseUrlGenerator<'a> { - url: &'a Url, - operation_type: &'a GraphQLOperationType, -} - -impl<'a> FieldBaseUrlGenerator<'a> { - pub fn new(url: &'a Url, operation_type: &'a GraphQLOperationType) -> Self { - Self { url, operation_type } - } - - fn update_base_urls(&self, config: &mut Config, operation_name: &str, base_url: &str) { - if let Some(query_type) = config.types.get_mut(operation_name) { - for field in query_type.fields.values_mut() { - if let Some(Resolver::Http(http)) = &mut field.resolver { - if http.base_url.is_none() { - http.base_url = Some(base_url.to_owned()) - } - } - } - } - } -} - -impl Transform for FieldBaseUrlGenerator<'_> { - type Value = Config; - type Error = String; - fn transform(&self, mut config: Self::Value) -> Valid { - let base_url = match extract_base_url(self.url) { - Some(base_url) => base_url, - None => { - return Valid::fail(format!("failed to extract the host url from {} ", self.url)) - } - }; - let op_name = self.operation_type.to_string().to_case(Case::Pascal); - self.update_base_urls(&mut config, &op_name, &base_url); - - Valid::succeed(config) - } -} - -#[cfg(test)] -mod test { - use url::Url; - - use super::FieldBaseUrlGenerator; - use crate::core::config::{Config, Field, GraphQLOperationType, Http, Resolver, Type}; - use crate::core::transform::Transform; - use crate::core::valid::Validator; - - #[test] - fn should_add_base_url_for_http_fields() { - let url = Url::parse("https://example.com").unwrap(); - let field_base_url_gen = FieldBaseUrlGenerator::new(&url, &GraphQLOperationType::Query); - - let mut config = Config::default(); - let mut query_type = Type::default(); - query_type.fields.insert( - "f1".to_string(), - Field { - type_of: "Int".to_string().into(), - resolver: Some(Resolver::Http(Http { - path: "/day".to_string(), - ..Default::default() - })), - ..Default::default() - }, - ); - query_type.fields.insert( - "f2".to_string(), - Field { - type_of: "String".to_string().into(), - resolver: Some(Resolver::Http(Http { - path: "/month".to_string(), - ..Default::default() - })), - ..Default::default() - }, - ); - query_type.fields.insert( - "f3".to_string(), - Field { - type_of: "String".to_string().into(), - resolver: Some(Resolver::Http(Http { - path: "/status".to_string(), - ..Default::default() - })), - ..Default::default() - }, - ); - config.types.insert("Query".to_string(), query_type); - - config = field_base_url_gen.transform(config).to_result().unwrap(); - - insta::assert_snapshot!(config.to_sdl()); - } - - #[test] - fn should_add_base_url_if_not_present() { - let url = Url::parse("http://localhost:8080").unwrap(); - let field_base_url_gen = FieldBaseUrlGenerator::new(&url, &GraphQLOperationType::Query); - - let mut config = Config::default(); - let mut query_type = Type::default(); - query_type.fields.insert( - "f1".to_string(), - Field { - type_of: "Int".to_string().into(), - resolver: Some(Resolver::Http(Http { - base_url: Some("https://calender.com/api/v1/".to_string()), - path: "/day".to_string(), - ..Default::default() - })), - ..Default::default() - }, - ); - query_type.fields.insert( - "f2".to_string(), - Field { - type_of: "String".to_string().into(), - resolver: Some(Resolver::Http(Http { - path: "/month".to_string(), - ..Default::default() - })), - ..Default::default() - }, - ); - query_type.fields.insert( - "f3".to_string(), - Field { - type_of: "String".to_string().into(), - resolver: None, - ..Default::default() - }, - ); - config.types.insert("Query".to_string(), query_type); - - config = field_base_url_gen.transform(config).to_result().unwrap(); - - insta::assert_snapshot!(config.to_sdl()); - } - - #[test] - fn should_not_add_base_url_when_query_not_present() { - let url = Url::parse("https://example.com").unwrap(); - let field_base_url_gen = FieldBaseUrlGenerator::new(&url, &GraphQLOperationType::Query); - assert!(field_base_url_gen - .transform(Default::default()) - .to_result() - .unwrap() - .to_sdl() - .is_empty()); - } -} diff --git a/src/core/generator/json/http_directive_generator.rs b/src/core/generator/json/http_directive_generator.rs index 9c60a809b6..3ab63cdacf 100644 --- a/src/core/generator/json/http_directive_generator.rs +++ b/src/core/generator/json/http_directive_generator.rs @@ -94,7 +94,14 @@ impl<'a> HttpDirectiveGenerator<'a> { }); // add path in http directive. - self.http.path = mustache_compatible_url.to_string(); + let mut url = self.url.clone(); + url.set_path(&mustache_compatible_url); + url.set_query(None); + + let url = url.to_string(); + let decoded = urlencoding::decode(&url).unwrap(); + + self.http.url = decoded.to_string(); } fn add_query_variables(&mut self, field: &mut Field) { @@ -211,7 +218,10 @@ mod test { ] .into_iter() .collect::>(); - assert_eq!("/foo/{{.args.GEN__2}}/bar/{{.args.GEN__1}}", http.path); + assert_eq!( + "http://example.com/foo/{{.args.GEN__2}}/bar/{{.args.GEN__1}}", + http.url + ); assert_eq!(test_args, args); } } diff --git a/src/core/generator/json/mod.rs b/src/core/generator/json/mod.rs index 2d6dbca632..a647e2093d 100644 --- a/src/core/generator/json/mod.rs +++ b/src/core/generator/json/mod.rs @@ -1,11 +1,8 @@ -mod field_base_url_generator; mod http_directive_generator; mod operation_generator; mod schema_generator; mod types_generator; -mod url_utils; -pub use field_base_url_generator::FieldBaseUrlGenerator; pub use operation_generator::OperationTypeGenerator; pub use schema_generator::SchemaGenerator; pub use types_generator::GraphQLTypesGenerator; diff --git a/src/core/generator/json/snapshots/tailcall__core__generator__json__field_base_url_generator__test__should_add_base_url_for_http_fields.snap b/src/core/generator/json/snapshots/tailcall__core__generator__json__field_base_url_generator__test__should_add_base_url_for_http_fields.snap deleted file mode 100644 index b68924ab19..0000000000 --- a/src/core/generator/json/snapshots/tailcall__core__generator__json__field_base_url_generator__test__should_add_base_url_for_http_fields.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: src/core/generator/json/field_base_url_generator.rs -expression: config.to_sdl() ---- -type Query { - f1: Int @http(baseURL: "https://example.com", path: "/day") - f2: String @http(baseURL: "https://example.com", path: "/month") - f3: String @http(baseURL: "https://example.com", path: "/status") -} diff --git a/src/core/generator/json/snapshots/tailcall__core__generator__json__field_base_url_generator__test__should_add_base_url_if_not_present.snap b/src/core/generator/json/snapshots/tailcall__core__generator__json__field_base_url_generator__test__should_add_base_url_if_not_present.snap deleted file mode 100644 index b99bf63db4..0000000000 --- a/src/core/generator/json/snapshots/tailcall__core__generator__json__field_base_url_generator__test__should_add_base_url_if_not_present.snap +++ /dev/null @@ -1,9 +0,0 @@ ---- -source: src/core/generator/json/field_base_url_generator.rs -expression: config.to_sdl() ---- -type Query { - f1: Int @http(baseURL: "https://calender.com/api/v1/", path: "/day") - f2: String @http(baseURL: "http://localhost:8080", path: "/month") - f3: String -} diff --git a/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__append_field_if_operation_type_exists.snap b/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__append_field_if_operation_type_exists.snap index f1968d89dd..cb169612c6 100644 --- a/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__append_field_if_operation_type_exists.snap +++ b/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__append_field_if_operation_type_exists.snap @@ -4,5 +4,5 @@ expression: config.to_sdl() --- type Query { post: Int - postComments(postId: Int): T44 @http(path: "/comments", query: [{key: "postId", value: "{{.args.postId}}"}]) + postComments(postId: Int): T44 @http(url: "https://jsonplaceholder.typicode.com/comments", query: [{key: "postId", value: "{{.args.postId}}"}]) } diff --git a/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__mutation.snap b/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__mutation.snap index 86853a3c98..68701229b8 100644 --- a/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__mutation.snap +++ b/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__mutation.snap @@ -10,5 +10,5 @@ input Input1 { } type Mutation { - postComments(GEN__Input1: Input1): T44 @http(body: "{{.args.GEN__Input1}}", method: "POST", path: "/posts") + postComments(GEN__Input1: Input1): T44 @http(url: "https://jsonplaceholder.typicode.com/posts", body: "{{.args.GEN__Input1}}", method: "POST") } diff --git a/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__query.snap b/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__query.snap index 48e4d0e543..4cf288d906 100644 --- a/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__query.snap +++ b/src/core/generator/json/snapshots/tailcall__core__generator__json__operation_generator__test__query.snap @@ -3,5 +3,5 @@ source: src/core/generator/json/operation_generator.rs expression: config.to_sdl() --- type Query { - postComments(postId: Int): T44 @http(path: "/comments", query: [{key: "postId", value: "{{.args.postId}}"}]) + postComments(postId: Int): T44 @http(url: "https://jsonplaceholder.typicode.com/comments", query: [{key: "postId", value: "{{.args.postId}}"}]) } diff --git a/src/core/generator/json/url_utils.rs b/src/core/generator/json/url_utils.rs deleted file mode 100644 index 8aed633187..0000000000 --- a/src/core/generator/json/url_utils.rs +++ /dev/null @@ -1,45 +0,0 @@ -use url::Url; - -pub fn extract_base_url(url: &Url) -> Option { - match url.host_str() { - Some(host) => match url.port() { - Some(port) => Some(format!("{}://{}:{}", url.scheme(), host, port)), - None => Some(format!("{}://{}", url.scheme(), host)), - }, - None => None, - } -} - -#[cfg(test)] -mod test { - use url::Url; - - use super::*; - - #[test] - fn test_extract_base_url_with_port() { - let url = Url::parse("http://example.com:8080/path/to/resource").unwrap(); - assert_eq!( - extract_base_url(&url), - Some("http://example.com:8080".to_string()) - ); - } - - #[test] - fn test_extract_base_url_without_port() { - let url = Url::parse("https://subdomain.example.org").unwrap(); - assert_eq!( - extract_base_url(&url), - Some("https://subdomain.example.org".to_string()) - ); - } - - #[test] - fn test_extract_base_url_with_ip_address() { - let url = Url::parse("http://192.168.1.1:8080/path/to/resource").unwrap(); - assert_eq!( - extract_base_url(&url), - Some("http://192.168.1.1:8080".to_string()) - ); - } -} diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_json__tests__generate_config_from_json.snap b/src/core/generator/snapshots/tailcall__core__generator__from_json__tests__generate_config_from_json.snap index a16119dc42..06b130ea6d 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_json__tests__generate_config_from_json.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_json__tests__generate_config_from_json.snap @@ -2,7 +2,7 @@ source: src/core/generator/from_json.rs expression: config.to_sdl() --- -schema @server @upstream(allowedHeaders: ["authorization"], baseURL: "https://example.com") { +schema @server @upstream(allowedHeaders: ["authorization"]) { query: Query } @@ -35,11 +35,11 @@ type Person { } type Query { - inCompatibleObjects: [JSON] @http(path: "/api/v2/users") - inCompatibleProperties: InCompatibleProperty @http(path: "/") - inCompatibleRootObject: JSON @http(path: "/") - nestedSameProperties: NestedSameProperty @http(path: "/") - nestedUsers(children: Boolean): NestedUser @http(path: "/users", query: [{key: "children", value: "{{.args.children}}"}]) + inCompatibleObjects: [JSON] @http(url: "https://example.com/api/v2/users") + inCompatibleProperties: InCompatibleProperty @http(url: "https://example.com/") + inCompatibleRootObject: JSON @http(url: "https://example.com/") + nestedSameProperties: NestedSameProperty @http(url: "https://example.com/") + nestedUsers(children: Boolean): NestedUser @http(url: "https://example.com/users", query: [{key: "children", value: "{{.args.children}}"}]) } type T6 { diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto.snap index a32820de20..e06e1948ea 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto.snap @@ -66,15 +66,15 @@ type Query { """ Sends a greeting """ - GEN__greetings_a__b__Greeter__SayHello(helloRequest: GEN__greetings_a__b__HelloRequest!): GEN__greetings_a__b__HelloReply @grpc(body: "{{.args.helloRequest}}", method: "greetings_a.b.Greeter.SayHello") + GEN__greetings_a__b__Greeter__SayHello(helloRequest: GEN__greetings_a__b__HelloRequest!): GEN__greetings_a__b__HelloReply @grpc(url: "http://localhost:50051", body: "{{.args.helloRequest}}", method: "greetings_a.b.Greeter.SayHello") """ Sends a greeting """ - GEN__greetings_b__c__Greeter__SayHello(helloRequest: GEN__greetings__HelloRequest!): GEN__greetings__HelloReply @grpc(body: "{{.args.helloRequest}}", method: "greetings_b.c.Greeter.SayHello") - GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(body: "{{.args.news}}", method: "news.NewsService.AddNews") - GEN__news__NewsService__DeleteNews(newsId: GEN__news__NewsId!): Empty @grpc(body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") - GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(body: "{{.args.news}}", method: "news.NewsService.EditNews") - GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(method: "news.NewsService.GetAllNews") - GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") - GEN__news__NewsService__GetNews(newsId: GEN__news__NewsId!): GEN__news__News @grpc(body: "{{.args.newsId}}", method: "news.NewsService.GetNews") + GEN__greetings_b__c__Greeter__SayHello(helloRequest: GEN__greetings__HelloRequest!): GEN__greetings__HelloReply @grpc(url: "http://localhost:50051", body: "{{.args.helloRequest}}", method: "greetings_b.c.Greeter.SayHello") + GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.AddNews") + GEN__news__NewsService__DeleteNews(newsId: GEN__news__NewsId!): Empty @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") + GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.EditNews") + GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(url: "http://localhost:50051", body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") + GEN__news__NewsService__GetNews(newsId: GEN__news__NewsId!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.GetNews") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto_no_pkg_file.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto_no_pkg_file.snap index 29842976af..f78ccc36d7 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto_no_pkg_file.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__from_proto_no_pkg_file.snap @@ -18,5 +18,5 @@ type GEN__NewsList { } type Query { - GEN__NewsService__GetAllNews: GEN__NewsList @grpc(method: "NewsService.GetAllNews") + GEN__NewsService__GetAllNews: GEN__NewsList @grpc(url: "http://localhost:50051", method: "NewsService.GetAllNews") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__greetings_proto_file.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__greetings_proto_file.snap index 1ded2729c0..8297302bf4 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__greetings_proto_file.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__greetings_proto_file.snap @@ -15,5 +15,5 @@ type GEN__greetings__HelloReply { } type Query { - GEN__greetings__Greeter__SayHello(helloRequest: GEN__greetings__HelloRequest!): GEN__greetings__HelloReply @grpc(body: "{{.args.helloRequest}}", method: "greetings.Greeter.SayHello") + GEN__greetings__Greeter__SayHello(helloRequest: GEN__greetings__HelloRequest!): GEN__greetings__HelloReply @grpc(url: "http://localhost:50051", body: "{{.args.helloRequest}}", method: "greetings.Greeter.SayHello") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__map_types.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__map_types.snap index 3ed658011e..bad9a66493 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__map_types.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__map_types.snap @@ -15,5 +15,5 @@ type GEN__map__MapResponse { } type Query { - GEN__map__MapService__GetMap(mapRequest: GEN__map__MapRequest!): GEN__map__MapResponse @grpc(body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") + GEN__map__MapService__GetMap(mapRequest: GEN__map__MapRequest!): GEN__map__MapResponse @grpc(url: "http://localhost:50051", body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__movies.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__movies.snap index 7deb630559..1d23d60529 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__movies.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__movies.snap @@ -400,17 +400,17 @@ type Query { """ get all movies """ - GEN__movies__AnotherExample__GetMovies(movieRequest: GEN__movies__MovieRequest!): GEN__movies__MoviesResult @grpc(body: "{{.args.movieRequest}}", method: "movies.AnotherExample.GetMovies") + GEN__movies__AnotherExample__GetMovies(movieRequest: GEN__movies__MovieRequest!): GEN__movies__MoviesResult @grpc(url: "http://localhost:50051", body: "{{.args.movieRequest}}", method: "movies.AnotherExample.GetMovies") """ search movies by the name of the cast """ - GEN__movies__AnotherExample__SearchMoviesByCast(searchByCastRequest: GEN__movies__SearchByCastRequest!): GEN__movies__Movie @grpc(body: "{{.args.searchByCastRequest}}", method: "movies.AnotherExample.SearchMoviesByCast") + GEN__movies__AnotherExample__SearchMoviesByCast(searchByCastRequest: GEN__movies__SearchByCastRequest!): GEN__movies__Movie @grpc(url: "http://localhost:50051", body: "{{.args.searchByCastRequest}}", method: "movies.AnotherExample.SearchMoviesByCast") """ get all movies """ - GEN__movies__Example__GetMovies(movieRequest: GEN__movies__MovieRequest!): GEN__movies__MoviesResult @grpc(body: "{{.args.movieRequest}}", method: "movies.Example.GetMovies") + GEN__movies__Example__GetMovies(movieRequest: GEN__movies__MovieRequest!): GEN__movies__MoviesResult @grpc(url: "http://localhost:50051", body: "{{.args.movieRequest}}", method: "movies.Example.GetMovies") """ search movies by the name of the cast """ - GEN__movies__Example__SearchMoviesByCast(searchByCastRequest: GEN__movies__SearchByCastRequest!): GEN__movies__Movie @grpc(body: "{{.args.searchByCastRequest}}", method: "movies.Example.SearchMoviesByCast") + GEN__movies__Example__SearchMoviesByCast(searchByCastRequest: GEN__movies__SearchByCastRequest!): GEN__movies__Movie @grpc(url: "http://localhost:50051", body: "{{.args.searchByCastRequest}}", method: "movies.Example.SearchMoviesByCast") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__nested_types.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__nested_types.snap index 38115b5b19..6572244989 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__nested_types.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__nested_types.snap @@ -32,5 +32,5 @@ type GEN__nested__types__Result__Nested__VeryNested { } type Query { - GEN__nested__types__Example__Get(veryNested: GEN__nested__types__Result__Nested__VeryNestedInput!): GEN__nested__types__Result @grpc(body: "{{.args.veryNested}}", method: "nested.types.Example.Get") + GEN__nested__types__Example__Get(veryNested: GEN__nested__types__Result__Nested__VeryNestedInput!): GEN__nested__types__Result @grpc(url: "http://localhost:50051", body: "{{.args.veryNested}}", method: "nested.types.Example.Get") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__oneof_types.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__oneof_types.snap index 997c16d271..395a63806f 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__oneof_types.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__oneof_types.snap @@ -102,5 +102,5 @@ type GEN__oneof__Response__Var2 implements GEN__oneof__Response__Interface { } type Query { - GEN__oneof__OneOfService__GetOneOf(request: GEN__oneof__Request!): GEN__oneof__Response @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + GEN__oneof__OneOfService__GetOneOf(request: GEN__oneof__Request!): GEN__oneof__Response @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__optional_fields.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__optional_fields.snap index a8631cd06d..3fe01495f0 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__optional_fields.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__optional_fields.snap @@ -51,5 +51,5 @@ type GEN__type__Type__Nested { } type Query { - GEN__type__TypeService__Get(type: GEN__type__TypeInput!): GEN__type__Type @grpc(body: "{{.args.type}}", method: "type.TypeService.Get") + GEN__type__TypeService__Get(type: GEN__type__TypeInput!): GEN__type__Type @grpc(url: "http://localhost:50051", body: "{{.args.type}}", method: "type.TypeService.Get") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__required_types.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__required_types.snap index a600c6428b..bbc9e751a0 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__required_types.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__required_types.snap @@ -18,7 +18,7 @@ type GEN__person__Person { } type Query { - GEN__person__PersonService__GetPerson: GEN__person__Person @grpc(method: "person.PersonService.GetPerson") + GEN__person__PersonService__GetPerson: GEN__person__Person @grpc(url: "http://localhost:50051", method: "person.PersonService.GetPerson") } """ diff --git a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__scalar_types.snap b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__scalar_types.snap index 1cd6c1f237..025b8b84c6 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__scalar_types.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__from_proto__test__scalar_types.snap @@ -47,5 +47,5 @@ type GEN__scalars__Result { } type Query { - GEN__scalars__Example__Get(item: GEN__scalars__ItemInput!): GEN__scalars__Result @grpc(body: "{{.args.item}}", method: "scalars.Example.Get") + GEN__scalars__Example__Get(item: GEN__scalars__ItemInput!): GEN__scalars__Result @grpc(url: "http://localhost:50051", body: "{{.args.item}}", method: "scalars.Example.Get") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__generator__test__generate_from_config_from_multiple_jsons.snap b/src/core/generator/snapshots/tailcall__core__generator__generator__test__generate_from_config_from_multiple_jsons.snap index c3247b1a49..820697c0fd 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__generator__test__generate_from_config_from_multiple_jsons.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__generator__test__generate_from_config_from_multiple_jsons.snap @@ -2,7 +2,7 @@ source: src/core/generator/generator.rs expression: cfg_module.config().to_sdl() --- -schema @server @upstream(allowedHeaders: ["authorization"], baseURL: "https://example.com") { +schema @server @upstream(allowedHeaders: ["authorization"]) { query: Query } @@ -12,9 +12,9 @@ type InCompatibleProperty { } type Query { - inCompatibleObjects: [JSON] @http(path: "/api/v2/users") - inCompatibleProperties: InCompatibleProperty @http(path: "/") - userData: [Userdatum] @http(path: "/users") + inCompatibleObjects: [JSON] @http(url: "https://example.com/api/v2/users") + inCompatibleProperties: InCompatibleProperty @http(url: "https://example.com/") + userData: [Userdatum] @http(url: "https://example.com/users") } type Userdatum { diff --git a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_combined_config.snap b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_combined_config.snap index c102b794a6..62d027c923 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_combined_config.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_combined_config.snap @@ -2,7 +2,7 @@ source: src/core/generator/generator.rs expression: cfg_module.config().to_sdl() --- -schema @server(hostname: "0.0.0.0", port: 8000) @upstream(allowedHeaders: ["authorization"], baseURL: "https://example.com", httpCache: 42) @link(src: "../../../tailcall-fixtures/fixtures/protobuf/news.proto", type: Protobuf) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(allowedHeaders: ["authorization"], httpCache: 42) @link(src: "../../../tailcall-fixtures/fixtures/protobuf/news.proto", type: Protobuf) { query: Query } @@ -30,7 +30,7 @@ enum Status { type Album { id: Int! - photos: [Photo] @http(path: "/albums/{{.value.id}}/photos?_limit=3") + photos: [Photo] @http(url: "https://jsonplaceholder.typicode.com/albums/{{.value.id}}/photos?_limit=3") title: Int userId: Int! } @@ -69,30 +69,30 @@ type Photo { type Post { body: String! - comments: [Comment] @http(path: "/posts/{{.value.id}}/comments") + comments: [Comment] @http(url: "https://jsonplaceholder.typicode.com/posts/{{.value.id}}/comments") id: Int! title: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "https://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! - users: [User] @http(path: "/users") + users: [User] @http(url: "https://jsonplaceholder.typicode.com/users") } type Query { - GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): News @grpc(body: "{{.args.news}}", method: "news.NewsService.AddNews") - GEN__news__NewsService__DeleteNews(newsId: Id!): Empty @grpc(body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") - GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): News @grpc(body: "{{.args.news}}", method: "news.NewsService.EditNews") - GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(method: "news.NewsService.GetAllNews") - GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") - GEN__news__NewsService__GetNews(newsId: Id!): News @grpc(body: "{{.args.newsId}}", method: "news.NewsService.GetNews") - inCompatibleProperties: InCompatibleProperty @http(path: "/") - post(id: Int! = 1): Post @http(path: "/posts/{{.args.id}}") - posts: [Post] @http(path: "/posts?_limit=11") - user(id: Int!): User @http(path: "/users/{{.args.id}}") - users: [User] @http(path: "/users") + GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.AddNews") + GEN__news__NewsService__DeleteNews(newsId: Id!): Empty @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") + GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.EditNews") + GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(url: "http://localhost:50051", body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") + GEN__news__NewsService__GetNews(newsId: Id!): News @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.GetNews") + inCompatibleProperties: InCompatibleProperty @http(url: "https://example.com/") + post(id: Int! = 1): Post @http(url: "https://jsonplaceholder.typicode.com/posts/{{.args.id}}") + posts: [Post] @http(url: "https://jsonplaceholder.typicode.com/posts?_limit=11") + user(id: Int!): User @http(url: "https://jsonplaceholder.typicode.com/users/{{.args.id}}") + users: [User] @http(url: "https://jsonplaceholder.typicode.com/users") } type User { - albums: [Album] @http(path: "/users/{{.value.id}}/albums?_limit=2") + albums: [Album] @http(url: "https://jsonplaceholder.typicode.com/users/{{.value.id}}/albums?_limit=2") blog: String @expr(body: "https://test.blog/users/website/{{.value.username}}") email: String! id: Int! diff --git a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_configs.snap b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_configs.snap index ab4e5fc607..8d34015c98 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_configs.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_configs.snap @@ -2,13 +2,13 @@ source: src/core/generator/generator.rs expression: cfg_module.config().to_sdl() --- -schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) { query: Query } type Album { id: Int! - photos: [Photo] @http(path: "/albums/{{.value.id}}/photos?_limit=3") + photos: [Photo] @http(url: "https://jsonplaceholder.typicode.com/albums/{{.value.id}}/photos?_limit=3") title: Int userId: Int! } @@ -30,23 +30,23 @@ type Photo { type Post { body: String! - comments: [Comment] @http(path: "/posts/{{.value.id}}/comments") + comments: [Comment] @http(url: "https://jsonplaceholder.typicode.com/posts/{{.value.id}}/comments") id: Int! title: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "https://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! - users: [User] @http(path: "/users") + users: [User] @http(url: "https://jsonplaceholder.typicode.com/users") } type Query { - post(id: Int! = 1): Post @http(path: "/posts/{{.args.id}}") - posts: [Post] @http(path: "/posts?_limit=11") - user(id: Int!): User @http(path: "/users/{{.args.id}}") - users: [User] @http(path: "/users") + post(id: Int! = 1): Post @http(url: "https://jsonplaceholder.typicode.com/posts/{{.args.id}}") + posts: [Post] @http(url: "https://jsonplaceholder.typicode.com/posts?_limit=11") + user(id: Int!): User @http(url: "https://jsonplaceholder.typicode.com/users/{{.args.id}}") + users: [User] @http(url: "https://jsonplaceholder.typicode.com/users") } type User { - albums: [Album] @http(path: "/users/{{.value.id}}/albums?_limit=2") + albums: [Album] @http(url: "https://jsonplaceholder.typicode.com/users/{{.value.id}}/albums?_limit=2") blog: String @expr(body: "https://test.blog/users/website/{{.value.username}}") email: String! id: Int! diff --git a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_json.snap b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_json.snap index b3c9cd036f..bea2fb784c 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_json.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_json.snap @@ -2,7 +2,7 @@ source: src/core/generator/generator.rs expression: cfg_module.config().to_sdl() --- -schema @server @upstream(allowedHeaders: ["authorization"], baseURL: "https://example.com") { +schema @server @upstream(allowedHeaders: ["authorization"]) { query: Query } @@ -12,5 +12,5 @@ type InCompatibleProperty { } type Query { - inCompatibleProperties: InCompatibleProperty @http(path: "/") + inCompatibleProperties: InCompatibleProperty @http(url: "https://example.com/") } diff --git a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_proto.snap b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_proto.snap index 165aa35022..e4221c54d1 100644 --- a/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_proto.snap +++ b/src/core/generator/snapshots/tailcall__core__generator__generator__test__should_generate_config_from_proto.snap @@ -41,10 +41,10 @@ type GEN__news__NewsList { } type Query { - GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(body: "{{.args.news}}", method: "news.NewsService.AddNews") - GEN__news__NewsService__DeleteNews(newsId: GEN__news__NewsId!): Empty @grpc(body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") - GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(body: "{{.args.news}}", method: "news.NewsService.EditNews") - GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(method: "news.NewsService.GetAllNews") - GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") - GEN__news__NewsService__GetNews(newsId: GEN__news__NewsId!): GEN__news__News @grpc(body: "{{.args.newsId}}", method: "news.NewsService.GetNews") + GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.AddNews") + GEN__news__NewsService__DeleteNews(newsId: GEN__news__NewsId!): Empty @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") + GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.EditNews") + GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(url: "http://localhost:50051", body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") + GEN__news__NewsService__GetNews(newsId: GEN__news__NewsId!): GEN__news__News @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.GetNews") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__add_cart.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__add_cart.json.snap index 05af5a8903..b9232784f8 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__add_cart.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__add_cart.json.snap @@ -38,5 +38,5 @@ type GEN__2 { } type Mutation { - addCart(code: String, GEN__Input1: GEN__4): GEN__2 @http(baseURL: "https://dummyjson.com", body: "{{.args.GEN__Input1}}", method: "POST", path: "/carts/add", query: [{key: "code", value: "{{.args.code}}"}]) + addCart(code: String, GEN__Input1: GEN__4): GEN__2 @http(url: "https://dummyjson.com/carts/add", body: "{{.args.GEN__Input1}}", method: "POST", query: [{key: "code", value: "{{.args.code}}"}]) } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__boolean.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__boolean.json.snap index e4615cd9e3..c4ed346cad 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__boolean.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__boolean.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - userStatus(GEN__1: Int!): Boolean @http(baseURL: "https://example.com", path: "/user/{{.args.GEN__1}}/online") + userStatus(GEN__1: Int!): Boolean @http(url: "https://example.com/user/{{.args.GEN__1}}/online") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__create_post.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__create_post.json.snap index 78312f50cf..d1b65c95d2 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__create_post.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__create_post.json.snap @@ -20,5 +20,5 @@ type GEN__1 { } type Mutation { - createPost(GEN__Input1: GEN__2): GEN__1 @http(baseURL: "https://jsonplaceholder.typicode.com", body: "{{.args.GEN__Input1}}", method: "POST", path: "/posts") + createPost(GEN__Input1: GEN__2): GEN__1 @http(url: "https://jsonplaceholder.typicode.com/posts", body: "{{.args.GEN__Input1}}", method: "POST") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__create_product.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__create_product.json.snap index 9426007dfe..0e363ab41f 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__create_product.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__create_product.json.snap @@ -24,5 +24,5 @@ type GEN__1 { } type Mutation { - createProduct(GEN__Input1: GEN__2): GEN__1 @http(baseURL: "https://fakestoreapi.com", body: "{{.args.GEN__Input1}}", method: "POST", path: "/products") + createProduct(GEN__Input1: GEN__2): GEN__1 @http(url: "https://fakestoreapi.com/products", body: "{{.args.GEN__Input1}}", method: "POST") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__create_user.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__create_user.json.snap index baad97357a..b80810870e 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__create_user.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__create_user.json.snap @@ -24,5 +24,5 @@ type GEN__1 { } type Mutation { - createPost(GEN__Input1: GEN__2): GEN__1 @http(baseURL: "https://jsonplaceholder.typicode.com", body: "{{.args.GEN__Input1}}", method: "POST", path: "/posts") + createPost(GEN__Input1: GEN__2): GEN__1 @http(url: "https://jsonplaceholder.typicode.com/posts", body: "{{.args.GEN__Input1}}", method: "POST") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__empty_list.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__empty_list.json.snap index 6114cc1e35..9f26881c1c 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__empty_list.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__empty_list.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - users: [JSON] @http(baseURL: "https://example.com", path: "/users") + users: [JSON] @http(url: "https://example.com/users") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__generate_auth_token.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__generate_auth_token.json.snap index 47bea6709f..072cbae6aa 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__generate_auth_token.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__generate_auth_token.json.snap @@ -25,5 +25,5 @@ type GEN__1 { } type Mutation { - login(GEN__Input1: GEN__2): GEN__1 @http(baseURL: "https://dummyjson.com", body: "{{.args.GEN__Input1}}", method: "POST", path: "/auth/login") + login(GEN__Input1: GEN__2): GEN__1 @http(url: "https://dummyjson.com/auth/login", body: "{{.args.GEN__Input1}}", method: "POST") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_properties.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_properties.json.snap index a0b4217958..ec24b14514 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_properties.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_properties.json.snap @@ -12,5 +12,5 @@ type GEN__1 { } type Query { - inCompatibleProperties: GEN__1 @http(baseURL: "https://example.com", path: "/") + inCompatibleProperties: GEN__1 @http(url: "https://example.com/") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_root_object.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_root_object.json.snap index 52584e3814..efa94d5427 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_root_object.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__incompatible_root_object.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - inCompatibleRootObject: JSON @http(baseURL: "https://example.com", path: "/") + inCompatibleRootObject: JSON @http(url: "https://example.com/") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__list.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__list.json.snap index dfc869e01a..b84ac60e5e 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__list.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__list.json.snap @@ -13,5 +13,5 @@ type GEN__1 { } type Query { - userData: [GEN__1] @http(baseURL: "https://example.com", path: "/users") + userData: [GEN__1] @http(url: "https://example.com/users") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__list_incompatible_object.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__list_incompatible_object.json.snap index 6b8a9af188..9b613c3e85 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__list_incompatible_object.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__list_incompatible_object.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - inCompatibleObjects: [JSON] @http(baseURL: "https://example.com", path: "/api/v2/users") + inCompatibleObjects: [JSON] @http(url: "https://example.com/api/v2/users") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__list_primitive_type.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__list_primitive_type.json.snap index e2c795951a..98d3e57a5c 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__list_primitive_type.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__list_primitive_type.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - users: [String] @http(baseURL: "https://example.com", path: "/users") + users: [String] @http(url: "https://example.com/users") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__nested_list.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__nested_list.json.snap index e8749fa888..42dff08b2b 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__nested_list.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__nested_list.json.snap @@ -22,5 +22,5 @@ type GEN__3 { } type Query { - nestedUsers(children: Boolean): GEN__3 @http(baseURL: "https://example.com", path: "/users", query: [{key: "children", value: "{{.args.children}}"}]) + nestedUsers(children: Boolean): GEN__3 @http(url: "https://example.com/users", query: [{key: "children", value: "{{.args.children}}"}]) } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__nested_same_properties.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__nested_same_properties.json.snap index e5b67d0cb5..01a562d70c 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__nested_same_properties.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__nested_same_properties.json.snap @@ -25,5 +25,5 @@ type GEN__4 { } type Query { - nestedSameProperties: GEN__4 @http(baseURL: "https://example.com", path: "/") + nestedSameProperties: GEN__4 @http(url: "https://example.com/") } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__null.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__null.json.snap index 1a01bf6c9c..b7f5063085 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__null.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__null.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - usersAge(age: Int): JSON @http(baseURL: "https://example.com", path: "/users", query: [{key: "age", value: "{{.args.age}}"}]) + usersAge(age: Int): JSON @http(url: "https://example.com/users", query: [{key: "age", value: "{{.args.age}}"}]) } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__number.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__number.json.snap index dc8c587f73..303184bfcb 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__number.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__number.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - verifiedUsers(verifiedUser: Boolean): Int @http(baseURL: "https://example.com", path: "/users", query: [{key: "verified_user", value: "{{.args.verifiedUser}}"}]) + verifiedUsers(verifiedUser: Boolean): Int @http(url: "https://example.com/users", query: [{key: "verified_user", value: "{{.args.verifiedUser}}"}]) } diff --git a/src/core/generator/tests/snapshots/json_to_config_spec__string.json.snap b/src/core/generator/tests/snapshots/json_to_config_spec__string.json.snap index 774248e691..53f2406c26 100644 --- a/src/core/generator/tests/snapshots/json_to_config_spec__string.json.snap +++ b/src/core/generator/tests/snapshots/json_to_config_spec__string.json.snap @@ -7,5 +7,5 @@ schema @server @upstream { } type Query { - loginStatus: String @http(baseURL: "https://example.com", path: "/login/status") + loginStatus: String @http(url: "https://example.com/login/status") } diff --git a/src/core/jit/fixtures/dedupe.graphql b/src/core/jit/fixtures/dedupe.graphql index 7b06a3773a..5bcf6f9837 100644 --- a/src/core/jit/fixtures/dedupe.graphql +++ b/src/core/jit/fixtures/dedupe.graphql @@ -1,12 +1,10 @@ -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - posts: [Post] @http(path: "/posts") - users: [User] @http(path: "/users", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users", dedupe: true) } type User { @@ -15,7 +13,7 @@ type User { username: String! email: String! phone: String - comments: [Comment] @http(path: "/users/{{.value.id}}/comments", dedupe: true) + comments: [Comment] @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.id}}/comments", dedupe: true) } type Post { @@ -23,7 +21,7 @@ type Post { userId: ID! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}", dedupe: true) + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}", dedupe: true) } type Comment { diff --git a/src/core/jit/fixtures/jsonplaceholder-mutation.graphql b/src/core/jit/fixtures/jsonplaceholder-mutation.graphql index 6516db64af..751c168d11 100644 --- a/src/core/jit/fixtures/jsonplaceholder-mutation.graphql +++ b/src/core/jit/fixtures/jsonplaceholder-mutation.graphql @@ -1,16 +1,16 @@ schema @server(port: 8000, headers: {cors: {allowOrigins: ["*"], allowHeaders: ["*"], allowMethods: [POST, GET, OPTIONS]}}) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { + @upstream(httpCache: 42, batch: {delay: 100}) { query: Query mutation: Mutation } type Query { - posts: [Post] @http(path: "/posts") - users: [User] @http(path: "/users") - user(id: ID!): User @http(path: "/users/{{.args.id}}") - post(id: ID!): Post @http(path: "/posts/{{.args.id}}") - getUserIdOrEmail(id: ID!): UserIdOrEmail @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") + user(id: ID!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + post(id: ID!): Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.args.id}}") + getUserIdOrEmail(id: ID!): UserIdOrEmail @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type UserId { @@ -24,8 +24,10 @@ type UserEmail { union UserIdOrEmail = UserId | UserEmail type Mutation { - createUser(user: InputUser!): User @http(method: POST, path: "/users", body: "{{args.user}}") - createPost(post: InputPost!): Post @http(method: POST, path: "/posts", body: "{{args.post}}") + createUser(user: InputUser!): User + @http(method: POST, url: "http://jsonplaceholder.typicode.com/users", body: "{{args.user}}") + createPost(post: InputPost!): Post + @http(method: POST, url: "http://jsonplaceholder.typicode.com/posts", body: "{{args.post}}") } input InputPost { @@ -52,7 +54,7 @@ type User { phone: String website: String address: Address - todo: Todo @http(path: "/todos/{{.value.id}}") + todo: Todo @http(url: "http://jsonplaceholder.typicode.com/todos/{{.value.id}}") } type Todo { diff --git a/tailcall-fixtures/fixtures/configs/auto_generate_config.graphql b/tailcall-fixtures/fixtures/configs/auto_generate_config.graphql index 8db82cd5e8..b75c024ca0 100644 --- a/tailcall-fixtures/fixtures/configs/auto_generate_config.graphql +++ b/tailcall-fixtures/fixtures/configs/auto_generate_config.graphql @@ -3,7 +3,7 @@ schema @server @upstream { } type Query { - f1: [RootType1] @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users") + f1: [RootType1] @http(url: "https://jsonplaceholder.typicode.com/users") } type T1 { diff --git a/tailcall-fixtures/fixtures/configs/cyclic_config.graphql b/tailcall-fixtures/fixtures/configs/cyclic_config.graphql index aad488a47d..3b8a79489a 100644 --- a/tailcall-fixtures/fixtures/configs/cyclic_config.graphql +++ b/tailcall-fixtures/fixtures/configs/cyclic_config.graphql @@ -3,7 +3,7 @@ schema @server @upstream { } type Query { - f1: [RootType1] @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users") + f1: [RootType1] @http(url: "https://jsonplaceholder.typicode.com/users") } type RootType1 { diff --git a/tailcall-fixtures/fixtures/configs/input-type-config.graphql b/tailcall-fixtures/fixtures/configs/input-type-config.graphql index 1617867280..0b99e4383c 100644 --- a/tailcall-fixtures/fixtures/configs/input-type-config.graphql +++ b/tailcall-fixtures/fixtures/configs/input-type-config.graphql @@ -1,4 +1,4 @@ -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -16,7 +16,7 @@ input Far { } type Query { - foo(input: Foo): String @http(path: "/foo") - bar(input: Bar): String @http(path: "/bar") - far(input: Far): String @http(path: "/far") + foo(input: Foo): String @http(url: "https://jsonplaceholder.typicode.com/foo") + bar(input: Bar): String @http(url: "https://jsonplaceholder.typicode.com/bar") + far(input: Far): String @http(url: "https://jsonplaceholder.typicode.com/far") } diff --git a/tailcall-fixtures/fixtures/configs/jsonplaceholder.graphql b/tailcall-fixtures/fixtures/configs/jsonplaceholder.graphql index ae41585800..bfde45a660 100644 --- a/tailcall-fixtures/fixtures/configs/jsonplaceholder.graphql +++ b/tailcall-fixtures/fixtures/configs/jsonplaceholder.graphql @@ -1,14 +1,12 @@ -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - posts: [Post] @http(path: "/posts?_limit=11") - users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{.args.id}}") - post(id: Int! = 1): Post @http(path: "/posts/{{.args.id}}") + posts: [Post] @http(url: "https://jsonplaceholder.typicode.com/posts?_limit=11") + users: [User] @http(url: "https://jsonplaceholder.typicode.com/users") + user(id: Int!): User @http(url: "https://jsonplaceholder.typicode.com/users/{{.args.id}}") + post(id: Int! = 1): Post @http(url: "https://jsonplaceholder.typicode.com/posts/{{.args.id}}") } type User { @@ -18,7 +16,7 @@ type User { email: String! phone: String blog: String @expr(body: "https://test.blog/users/website/{{.value.username}}") - albums: [Album] @http(path: "/users/{{.value.id}}/albums?_limit=2") + albums: [Album] @http(url: "https://jsonplaceholder.typicode.com/users/{{.value.id}}/albums?_limit=2") } type Post { @@ -26,9 +24,9 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}") - users: [User] @http(path: "/users") - comments: [Comment] @http(path: "/posts/{{.value.id}}/comments") + user: User @http(url: "https://jsonplaceholder.typicode.com/users/{{.value.userId}}") + users: [User] @http(url: "https://jsonplaceholder.typicode.com/users") + comments: [Comment] @http(url: "https://jsonplaceholder.typicode.com/posts/{{.value.id}}/comments") } type Comment { @@ -50,5 +48,5 @@ type Album { userId: Int! id: Int! title: Int - photos: [Photo] @http(path: "/albums/{{.value.id}}/photos?_limit=3") + photos: [Photo] @http(url: "https://jsonplaceholder.typicode.com/albums/{{.value.id}}/photos?_limit=3") } diff --git a/tailcall-fixtures/fixtures/configs/multi-url-config.graphql b/tailcall-fixtures/fixtures/configs/multi-url-config.graphql index f7229b76c7..95ba4742fe 100644 --- a/tailcall-fixtures/fixtures/configs/multi-url-config.graphql +++ b/tailcall-fixtures/fixtures/configs/multi-url-config.graphql @@ -3,10 +3,10 @@ schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) { } type Query { - posts: [Post] @http(baseURL: "http://jsonplaceholder-1.typicode.com", path: "/posts") - users: [User] @http(baseURL: "http://jsonplaceholder-2.typicode.com", path: "/users") - user(id: Int!): User @http(baseURL: "http://jsonplaceholder-3.typicode.com", path: "/users/{{.args.id}}") - post(id: Int!): Post @http(baseURL: "http://jsonplaceholder-1.typicode.com", path: "/posts/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder-1.typicode.com/posts") + users: [User] @http(url: "http://jsonplaceholder-2.typicode.com/users") + user(id: Int!): User @http(url: "http://jsonplaceholder-3.typicode.com/users/{{.args.id}}") + post(id: Int!): Post @http(url: "http://jsonplaceholder-1.typicode.com/posts/{{.args.id}}") } type User { @@ -23,5 +23,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(baseURL: "http://jsonplaceholder-2.typicode.com", path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder-2.typicode.com/users/{{.value.userId}}") } diff --git a/tailcall-fixtures/fixtures/configs/name-generation.graphql b/tailcall-fixtures/fixtures/configs/name-generation.graphql index 3eb77f3468..fcfc4f08dc 100644 --- a/tailcall-fixtures/fixtures/configs/name-generation.graphql +++ b/tailcall-fixtures/fixtures/configs/name-generation.graphql @@ -1,4 +1,4 @@ -schema @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://example.typicode.com", httpCache: 42) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type T3 { @@ -17,5 +17,5 @@ type T1 { } type Query { - f1: T1 @http(path: "/colors") + f1: T1 @http(url: "http://example.typicode.com/colors") } diff --git a/tailcall-fixtures/fixtures/configs/proto_no_pkg.graphql b/tailcall-fixtures/fixtures/configs/proto_no_pkg.graphql index 2700f0f72c..daa18f612f 100644 --- a/tailcall-fixtures/fixtures/configs/proto_no_pkg.graphql +++ b/tailcall-fixtures/fixtures/configs/proto_no_pkg.graphql @@ -1,12 +1,9 @@ -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051") - @link(id: "news", src: "proto/news_no_pkg.proto", type: Protobuf) { +schema @server(port: 8000) @link(id: "news", src: "proto/news_no_pkg.proto", type: Protobuf) { query: Query } type Query { - news: News! @grpc(method: "news.NewsService.GetAllNews") + news: News! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") } type News { diff --git a/tailcall-fixtures/fixtures/configs/union-config.graphql b/tailcall-fixtures/fixtures/configs/union-config.graphql index d8cc46fc33..d5f203272f 100644 --- a/tailcall-fixtures/fixtures/configs/union-config.graphql +++ b/tailcall-fixtures/fixtures/configs/union-config.graphql @@ -1,4 +1,4 @@ -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } @@ -19,5 +19,5 @@ type Foo { } type Query { - foo: FooBar @http(path: "/foo") + foo: FooBar @http(url: "http://jsonplacheholder.typicode.com/foo") } diff --git a/tailcall-fixtures/fixtures/configs/user-list.graphql b/tailcall-fixtures/fixtures/configs/user-list.graphql index 442b1a3a67..1bb591b9e9 100644 --- a/tailcall-fixtures/fixtures/configs/user-list.graphql +++ b/tailcall-fixtures/fixtures/configs/user-list.graphql @@ -1,6 +1,4 @@ -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } @@ -21,6 +19,6 @@ type User { } type Query { - users: F2 @http(path: "/users") - user(id: Int!): F3 @http(path: "/users/{{.args.id}}") + users: F2 @http(url: "http://jsonplaceholder.typicode.com/users") + user(id: Int!): F3 @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } diff --git a/tailcall-fixtures/fixtures/configs/yaml-nested-unions-recursive.yaml b/tailcall-fixtures/fixtures/configs/yaml-nested-unions-recursive.yaml index e4c0974957..829afc48ff 100644 --- a/tailcall-fixtures/fixtures/configs/yaml-nested-unions-recursive.yaml +++ b/tailcall-fixtures/fixtures/configs/yaml-nested-unions-recursive.yaml @@ -45,8 +45,7 @@ types: name: U required: true http: - baseURL: http://localhost - path: /users/{{args.u}} + url: http://localhost/users/{{args.u}} unions: U1: diff --git a/tailcall-fixtures/fixtures/configs/yaml-nested-unions.yaml b/tailcall-fixtures/fixtures/configs/yaml-nested-unions.yaml index 6e7e0946c9..4672968a04 100644 --- a/tailcall-fixtures/fixtures/configs/yaml-nested-unions.yaml +++ b/tailcall-fixtures/fixtures/configs/yaml-nested-unions.yaml @@ -45,8 +45,7 @@ types: name: U required: true http: - baseURL: http://localhost - path: /users/{{args.u}} + url: http://localhost/users/{{args.u}} unions: U1: diff --git a/tailcall-fixtures/fixtures/configs/yaml-recursive-input.yaml b/tailcall-fixtures/fixtures/configs/yaml-recursive-input.yaml index 0f8aee6585..43ee7c3c72 100644 --- a/tailcall-fixtures/fixtures/configs/yaml-recursive-input.yaml +++ b/tailcall-fixtures/fixtures/configs/yaml-recursive-input.yaml @@ -1,7 +1,5 @@ server: port: 8000 -upstream: - baseURL: http://localhost schema: query: Query types: @@ -27,7 +25,7 @@ types: args: - key: baz value: '{{.args.baz}}' - baseURL: http://localhost + url: http://localhost name: bars Foo: fields: diff --git a/tailcall-fixtures/fixtures/configs/yaml-union-in-type.yaml b/tailcall-fixtures/fixtures/configs/yaml-union-in-type.yaml index 48d247ef1f..66cf2edaae 100644 --- a/tailcall-fixtures/fixtures/configs/yaml-union-in-type.yaml +++ b/tailcall-fixtures/fixtures/configs/yaml-union-in-type.yaml @@ -57,8 +57,7 @@ types: type: name: NNU http: - baseURL: http://localhost - path: /users/{{args.nu.u}} + url: http://localhost/users/{{args.nu.u}} unions: U: diff --git a/tailcall-fixtures/fixtures/configs/yaml-union.yaml b/tailcall-fixtures/fixtures/configs/yaml-union.yaml index 890006f883..1398fe227c 100644 --- a/tailcall-fixtures/fixtures/configs/yaml-union.yaml +++ b/tailcall-fixtures/fixtures/configs/yaml-union.yaml @@ -33,8 +33,7 @@ types: name: U required: true http: - baseURL: http://localhost - path: /users/{{args.u}} + url: http://localhost/users/{{args.u}} unions: U: diff --git a/tests/cli/fixtures/generator/gen_deezer.md b/tests/cli/fixtures/generator/gen_deezer.md index 2e3a61140a..744b7e1bc8 100644 --- a/tests/cli/fixtures/generator/gen_deezer.md +++ b/tests/cli/fixtures/generator/gen_deezer.md @@ -52,7 +52,6 @@ ], "preset": { "mergeType": 1.0, - "consolidateURL": 0.5, "treeShake": true, "inferTypeNames": true }, diff --git a/tests/cli/fixtures/generator/gen_json_proto_mix_config.md b/tests/cli/fixtures/generator/gen_json_proto_mix_config.md index be7a4f639d..5fe595e5f0 100644 --- a/tests/cli/fixtures/generator/gen_json_proto_mix_config.md +++ b/tests/cli/fixtures/generator/gen_json_proto_mix_config.md @@ -3,19 +3,19 @@ "inputs": [ { "curl": { - "src": "https://jsonplaceholder.typicode.com/users", + "src": "http://jsonplaceholder.typicode.com/users", "fieldName": "users" } }, { "proto": { - "src": "tailcall-fixtures/fixtures/protobuf/news.proto" + "src": "tailcall-fixtures/fixtures/protobuf/news.proto", + "url": "http://localhost:50051" } } ], "preset": { "mergeType": 1.0, - "consolidateURL": 0.5, "inferTypeNames": true, "treeShake": true }, diff --git a/tests/cli/fixtures/generator/gen_jsonplaceholder.md b/tests/cli/fixtures/generator/gen_jsonplaceholder.md index 2c9487a93f..9c3066ff49 100644 --- a/tests/cli/fixtures/generator/gen_jsonplaceholder.md +++ b/tests/cli/fixtures/generator/gen_jsonplaceholder.md @@ -74,7 +74,6 @@ ], "preset": { "mergeType": 1.0, - "consolidateURL": 0.5, "treeShake": true, "inferTypeNames": true }, @@ -90,6 +89,6 @@ ```json @env { - "BASE_URL": "https://jsonplaceholder.typicode.com" + "BASE_URL": "http://jsonplaceholder.typicode.com" } ``` diff --git a/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_deezer.md.snap b/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_deezer.md.snap index c929f58e18..e90f22122b 100644 --- a/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_deezer.md.snap +++ b/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_deezer.md.snap @@ -2,7 +2,7 @@ source: tests/cli/gen.rs expression: config.to_sdl() --- -schema @server @upstream(baseURL: "https://api.deezer.com") { +schema @server @upstream { query: Query } @@ -383,14 +383,14 @@ type Podcast { } type Query { - album(GEN__1: Int!): GEN__39 @http(path: "/album/{{.args.GEN__1}}") - artist(GEN__1: Int!): GEN__40 @http(path: "/artist/{{.args.GEN__1}}") - chart: Chart @http(path: "/chart") - editorial: Editorial @http(path: "/editorial") - playlist(GEN__1: Int!): Playlist @http(path: "/playlist/{{.args.GEN__1}}") - search(q: String): Search @http(path: "/search", query: [{key: "q", value: "{{.args.q}}"}]) - track(GEN__1: Int!): GEN__4 @http(path: "/track/{{.args.GEN__1}}") - user(GEN__1: Int!): User @http(path: "/user/{{.args.GEN__1}}") + album(GEN__1: Int!): GEN__39 @http(url: "https://api.deezer.com/album/{{.args.GEN__1}}") + artist(GEN__1: Int!): GEN__40 @http(url: "https://api.deezer.com/artist/{{.args.GEN__1}}") + chart: Chart @http(url: "https://api.deezer.com/chart") + editorial: Editorial @http(url: "https://api.deezer.com/editorial") + playlist(GEN__1: Int!): Playlist @http(url: "https://api.deezer.com/playlist/{{.args.GEN__1}}") + search(q: String): Search @http(url: "https://api.deezer.com/search", query: [{key: "q", value: "{{.args.q}}"}]) + track(GEN__1: Int!): GEN__4 @http(url: "https://api.deezer.com/track/{{.args.GEN__1}}") + user(GEN__1: Int!): User @http(url: "https://api.deezer.com/user/{{.args.GEN__1}}") } type Search { diff --git a/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_json_proto_mix_config.md.snap b/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_json_proto_mix_config.md.snap index 359ae375b4..e5123e7567 100644 --- a/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_json_proto_mix_config.md.snap +++ b/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_json_proto_mix_config.md.snap @@ -2,7 +2,7 @@ source: tests/cli/gen.rs expression: config.to_sdl() --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -60,13 +60,13 @@ type News { } type Query { - GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): News @grpc(body: "{{.args.news}}", method: "news.NewsService.AddNews") - GEN__news__NewsService__DeleteNews(newsId: Id!): Empty @grpc(body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") - GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): News @grpc(body: "{{.args.news}}", method: "news.NewsService.EditNews") - GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(method: "news.NewsService.GetAllNews") - GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") - GEN__news__NewsService__GetNews(newsId: Id!): News @grpc(body: "{{.args.newsId}}", method: "news.NewsService.GetNews") - users: [User] @http(path: "/users") + GEN__news__NewsService__AddNews(news: GEN__news__NewsInput!): News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.AddNews") + GEN__news__NewsService__DeleteNews(newsId: Id!): Empty @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.DeleteNews") + GEN__news__NewsService__EditNews(news: GEN__news__NewsInput!): News @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.EditNews") + GEN__news__NewsService__GetAllNews: GEN__news__NewsList @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + GEN__news__NewsService__GetMultipleNews(multipleNewsId: GEN__news__MultipleNewsId!): GEN__news__NewsList @grpc(url: "http://localhost:50051", body: "{{.args.multipleNewsId}}", method: "news.NewsService.GetMultipleNews") + GEN__news__NewsService__GetNews(newsId: Id!): News @grpc(url: "http://localhost:50051", body: "{{.args.newsId}}", method: "news.NewsService.GetNews") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_jsonplaceholder.md.snap b/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_jsonplaceholder.md.snap index 12b65cd93f..ed5c4a6229 100644 --- a/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_jsonplaceholder.md.snap +++ b/tests/cli/snapshots/cli_spec__test__generator_spec__tests__cli__fixtures__generator__gen_jsonplaceholder.md.snap @@ -2,7 +2,7 @@ source: tests/cli/gen.rs expression: config.to_sdl() --- -schema @server @upstream(allowedHeaders: ["Accept", "Content-Type"], baseURL: "https://jsonplaceholder.typicode.com") { +schema @server @upstream(allowedHeaders: ["Accept", "Content-Type"]) { query: Query } @@ -49,17 +49,17 @@ type Post { } type Query { - comment(GEN__1: Int!): Comment @http(path: "/comments/{{.args.GEN__1}}") - comments: [Comment] @http(path: "/comments") - photo(GEN__1: Int!): Photo @http(path: "/photos/{{.args.GEN__1}}") - photos: [Photo] @http(path: "/photos") - post(GEN__1: Int!): Post @http(path: "/posts/{{.args.GEN__1}}") - postComments(postId: Int): [Comment] @http(path: "/comments", query: [{key: "postId", value: "{{.args.postId}}"}]) - posts: [Post] @http(path: "/posts") - todo(GEN__1: Int!): Todo @http(path: "/todos/{{.args.GEN__1}}") - todos: [Todo] @http(path: "/todos") - user(GEN__1: Int!): User @http(path: "/users/{{.args.GEN__1}}") - users: [User] @http(path: "/users") + comment(GEN__1: Int!): Comment @http(url: "http://jsonplaceholder.typicode.com/comments/{{.args.GEN__1}}") + comments: [Comment] @http(url: "http://jsonplaceholder.typicode.com/comments") + photo(GEN__1: Int!): Photo @http(url: "http://jsonplaceholder.typicode.com/photos/{{.args.GEN__1}}") + photos: [Photo] @http(url: "http://jsonplaceholder.typicode.com/photos") + post(GEN__1: Int!): Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.args.GEN__1}}") + postComments(postId: Int): [Comment] @http(url: "http://jsonplaceholder.typicode.com/comments", query: [{key: "postId", value: "{{.args.postId}}"}]) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + todo(GEN__1: Int!): Todo @http(url: "http://jsonplaceholder.typicode.com/todos/{{.args.GEN__1}}") + todos: [Todo] @http(url: "http://jsonplaceholder.typicode.com/todos") + user(GEN__1: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.GEN__1}}") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type Todo { diff --git a/tests/core/snapshots/add-field-index-list.md_merged.snap b/tests/core/snapshots/add-field-index-list.md_merged.snap index 1d4f15f4ad..2e2d9544a5 100644 --- a/tests/core/snapshots/add-field-index-list.md_merged.snap +++ b/tests/core/snapshots/add-field-index-list.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query @addField(name: "username", path: ["users", "0", "name"]) { - users: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/core/snapshots/add-field-many-list.md_merged.snap b/tests/core/snapshots/add-field-many-list.md_merged.snap index a3a8115a1f..cd3c909596 100644 --- a/tests/core/snapshots/add-field-many-list.md_merged.snap +++ b/tests/core/snapshots/add-field-many-list.md_merged.snap @@ -13,7 +13,7 @@ type A { } type Query { - u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") + u: U @http(url: "http://jsonplaceholder.typicode.com/us/1") } type U diff --git a/tests/core/snapshots/add-field-many.md_merged.snap b/tests/core/snapshots/add-field-many.md_merged.snap index 116351d1eb..949429e670 100644 --- a/tests/core/snapshots/add-field-many.md_merged.snap +++ b/tests/core/snapshots/add-field-many.md_merged.snap @@ -15,7 +15,7 @@ type Foo } type Query { - user: Foo @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: Foo @http(url: "http://jsonplaceholder.typicode.com/users/1") } type X { diff --git a/tests/core/snapshots/add-field-modify.md_merged.snap b/tests/core/snapshots/add-field-modify.md_merged.snap index 520e038cf1..983ec36527 100644 --- a/tests/core/snapshots/add-field-modify.md_merged.snap +++ b/tests/core/snapshots/add-field-modify.md_merged.snap @@ -13,7 +13,7 @@ type Address { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User diff --git a/tests/core/snapshots/add-field-with-composition.md_merged.snap b/tests/core/snapshots/add-field-with-composition.md_merged.snap index 257d3141d3..6c517c2f1c 100644 --- a/tests/core/snapshots/add-field-with-composition.md_merged.snap +++ b/tests/core/snapshots/add-field-with-composition.md_merged.snap @@ -19,7 +19,7 @@ type Geo { 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") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/add-field-with-modify.md_merged.snap b/tests/core/snapshots/add-field-with-modify.md_merged.snap index 002d700600..9fedd3356b 100644 --- a/tests/core/snapshots/add-field-with-modify.md_merged.snap +++ b/tests/core/snapshots/add-field-with-modify.md_merged.snap @@ -7,8 +7,8 @@ schema @server @upstream { } 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") + person1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") + person2: User @http(url: "http://jsonplaceholder.typicode.com/users/2") } type User { diff --git a/tests/core/snapshots/add-field.md_merged.snap b/tests/core/snapshots/add-field.md_merged.snap index de49becae5..8b39ec30f5 100644 --- a/tests/core/snapshots/add-field.md_merged.snap +++ b/tests/core/snapshots/add-field.md_merged.snap @@ -15,7 +15,7 @@ type Geo { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User @addField(name: "lat", path: ["address", "geo", "lat"]) { diff --git a/tests/core/snapshots/apollo-federation-entities-batch.md_merged.snap b/tests/core/snapshots/apollo-federation-entities-batch.md_merged.snap index 408f82c78a..8511079c2c 100644 --- a/tests/core/snapshots/apollo-federation-entities-batch.md_merged.snap +++ b/tests/core/snapshots/apollo-federation-entities-batch.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(enableFederation: true, port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: 42) { +schema @server(enableFederation: true, port: 8000) @upstream(batch: {delay: 100, headers: []}, httpCache: 42) { query: Query } @@ -13,7 +11,7 @@ scalar _Any union _Entity = Post | User type Post - @graphQL(args: [{key: "id", value: "{{.value.id}}"}], baseURL: "http://upstream/graphql", batch: true, name: "post") + @graphQL(args: [{key: "id", value: "{{.value.id}}"}], url: "http://upstream/graphql", batch: true, name: "post") @key(fields: "id") { id: Int! title: String! @@ -28,10 +26,16 @@ type Query { Apollo federation Query._service resolver """ _service: _Service! - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } -type User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.id}}"}]) @key(fields: "id") { +type User + @http( + url: "http://jsonplaceholder.typicode.com/users" + batchKey: ["id"] + query: [{key: "id", value: "{{.value.id}}"}] + ) + @key(fields: "id") { id: Int! name: String! } diff --git a/tests/core/snapshots/apollo-federation-entities.md_merged.snap b/tests/core/snapshots/apollo-federation-entities.md_merged.snap index 6f147a593b..dd26a0e9a3 100644 --- a/tests/core/snapshots/apollo-federation-entities.md_merged.snap +++ b/tests/core/snapshots/apollo-federation-entities.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(enableFederation: true, port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: 42) + @upstream(batch: {delay: 100, headers: []}, httpCache: 42) @link(src: "./posts.graphql", type: Config) { query: Query } @@ -27,7 +27,7 @@ type Query { Apollo federation Query._service resolver """ _service: _Service! - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User @call(steps: [{query: "user", args: {id: "{{.value.id}}"}}]) @key(fields: "id") { diff --git a/tests/core/snapshots/apollo-tracing.md_merged.snap b/tests/core/snapshots/apollo-tracing.md_merged.snap index b2b9da293d..330ab43603 100644 --- a/tests/core/snapshots/apollo-tracing.md_merged.snap +++ b/tests/core/snapshots/apollo-tracing.md_merged.snap @@ -7,5 +7,5 @@ schema @server(hostname: "0.0.0.0", port: 8000) @upstream { } type Query { - hello: String! @http(baseURL: "http://api.com", path: "/") + hello: String! @http(url: "http://api.com/") } diff --git a/tests/core/snapshots/async-cache-disabled.md_merged.snap b/tests/core/snapshots/async-cache-disabled.md_merged.snap index 099f2b3552..6fb6ca4f37 100644 --- a/tests/core/snapshots/async-cache-disabled.md_merged.snap +++ b/tests/core/snapshots/async-cache-disabled.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) @upstream { query: Query } @@ -10,12 +10,12 @@ type Post { body: String id: Int title: String - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! } type Query { - posts: Post @http(path: "/post?id=1") + posts: Post @http(url: "http://jsonplaceholder.typicode.com/post?id=1") } type User { diff --git a/tests/core/snapshots/async-cache-enable-multiple-resolvers.md_merged.snap b/tests/core/snapshots/async-cache-enable-multiple-resolvers.md_merged.snap index 586d3b1807..1b3803ad06 100644 --- a/tests/core/snapshots/async-cache-enable-multiple-resolvers.md_merged.snap +++ b/tests/core/snapshots/async-cache-enable-multiple-resolvers.md_merged.snap @@ -2,21 +2,21 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) @upstream { query: Query } type Post { body: String id: Int! - taggedUsers: [User] @http(path: "/taggedUsers/{{.value.id}}", dedupe: true) + taggedUsers: [User] @http(url: "http://jsonplaceholder.typicode.com/taggedUsers/{{.value.id}}", dedupe: true) title: String - user: User @http(path: "/users/{{.value.userId}}", dedupe: true) + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}", dedupe: true) userId: Int! } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type User { diff --git a/tests/core/snapshots/async-cache-enabled.md_merged.snap b/tests/core/snapshots/async-cache-enabled.md_merged.snap index 6bc4cb7cd4..3506d4506b 100644 --- a/tests/core/snapshots/async-cache-enabled.md_merged.snap +++ b/tests/core/snapshots/async-cache-enabled.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) @upstream { query: Query } @@ -10,12 +10,12 @@ type Post { body: String id: Int title: String - user: User @http(path: "/users/{{.value.userId}}", dedupe: true) + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}", dedupe: true) userId: Int! } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type User { diff --git a/tests/core/snapshots/async-cache-global.md_merged.snap b/tests/core/snapshots/async-cache-global.md_merged.snap index 8a9869d62e..628bcda6e6 100644 --- a/tests/core/snapshots/async-cache-global.md_merged.snap +++ b/tests/core/snapshots/async-cache-global.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) @upstream { query: Query } @@ -14,7 +14,7 @@ type Post { } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type User { diff --git a/tests/core/snapshots/async-cache-inflight-request.md_merged.snap b/tests/core/snapshots/async-cache-inflight-request.md_merged.snap index 6bc4cb7cd4..3506d4506b 100644 --- a/tests/core/snapshots/async-cache-inflight-request.md_merged.snap +++ b/tests/core/snapshots/async-cache-inflight-request.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) @upstream { query: Query } @@ -10,12 +10,12 @@ type Post { body: String id: Int title: String - user: User @http(path: "/users/{{.value.userId}}", dedupe: true) + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}", dedupe: true) userId: Int! } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type User { diff --git a/tests/core/snapshots/auth-basic.md_merged.snap b/tests/core/snapshots/auth-basic.md_merged.snap index 3f24e7dd05..7317c1c588 100644 --- a/tests/core/snapshots/auth-basic.md_merged.snap +++ b/tests/core/snapshots/auth-basic.md_merged.snap @@ -8,7 +8,7 @@ schema @server(port: 8000) @upstream @link(id: "htpasswd", src: ".htpasswd", typ } type Mutation { - protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") + protectedType: ProtectedType @http(url: "http://upstream/protected") } type Nested { diff --git a/tests/core/snapshots/auth-jwt.md_merged.snap b/tests/core/snapshots/auth-jwt.md_merged.snap index 48ce3cefb4..f4d83de801 100644 --- a/tests/core/snapshots/auth-jwt.md_merged.snap +++ b/tests/core/snapshots/auth-jwt.md_merged.snap @@ -8,7 +8,7 @@ schema @server(port: 8000) @upstream @link(id: "jwks", src: "jwks.json", type: J } type Mutation { - protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") + protectedType: ProtectedType @http(url: "http://upstream/protected") } type Nested { diff --git a/tests/core/snapshots/batching-default.md_merged.snap b/tests/core/snapshots/batching-default.md_merged.snap index d81add832c..2760790e5a 100644 --- a/tests/core/snapshots/batching-default.md_merged.snap +++ b/tests/core/snapshots/batching-default.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 10, headers: []}, httpCache: 42) { +schema @server @upstream(batch: {delay: 10, headers: []}, httpCache: 42) { query: Query } @@ -14,15 +12,15 @@ type Post { title: String user: User @http( + url: "http://jsonplaceholder.typicode.com/users" 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") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type User { diff --git a/tests/core/snapshots/batching-disabled.md_merged.snap b/tests/core/snapshots/batching-disabled.md_merged.snap index 9053b2bf07..3b12a7c11d 100644 --- a/tests/core/snapshots/batching-disabled.md_merged.snap +++ b/tests/core/snapshots/batching-disabled.md_merged.snap @@ -2,18 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server - @upstream( - baseURL: "http://jsonplaceholder.typicode.com" - batch: {delay: 0, headers: [], maxSize: 100} - httpCache: 42 - ) { +schema @server @upstream(batch: {delay: 0, headers: [], maxSize: 100}, httpCache: 42) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/batching-group-by-default.md_merged.snap b/tests/core/snapshots/batching-group-by-default.md_merged.snap index 51c51251fd..23b00350fb 100644 --- a/tests/core/snapshots/batching-group-by-default.md_merged.snap +++ b/tests/core/snapshots/batching-group-by-default.md_merged.snap @@ -2,13 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server - @upstream( - baseURL: "http://jsonplaceholder.typicode.com" - batch: {delay: 1, headers: [], maxSize: 1000} - httpCache: 42 - ) { +schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: 42) { query: Query } @@ -18,15 +12,15 @@ type Post { title: String user: User @http( + url: "http://jsonplaceholder.typicode.com/users" 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") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type User { diff --git a/tests/core/snapshots/batching-group-by-optional-key.md_merged.snap b/tests/core/snapshots/batching-group-by-optional-key.md_merged.snap index ab20bd6f36..c72f004372 100644 --- a/tests/core/snapshots/batching-group-by-optional-key.md_merged.snap +++ b/tests/core/snapshots/batching-group-by-optional-key.md_merged.snap @@ -4,11 +4,7 @@ expression: formatter --- schema @server(port: 8000, queryValidation: false) - @upstream( - baseURL: "http://jsonplaceholder.typicode.com" - batch: {delay: 1, headers: [], maxSize: 1000} - httpCache: 42 - ) { + @upstream(batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: 42) { query: Query } @@ -18,15 +14,15 @@ type Post { title: String user: User @http( + url: "http://jsonplaceholder.typicode.com/users" 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") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type User { diff --git a/tests/core/snapshots/batching-group-by.md_merged.snap b/tests/core/snapshots/batching-group-by.md_merged.snap index ed1ac72b40..840c3b2cb2 100644 --- a/tests/core/snapshots/batching-group-by.md_merged.snap +++ b/tests/core/snapshots/batching-group-by.md_merged.snap @@ -4,11 +4,7 @@ expression: formatter --- schema @server(port: 8000, queryValidation: false) - @upstream( - baseURL: "http://jsonplaceholder.typicode.com" - batch: {delay: 1, headers: [], maxSize: 1000} - httpCache: 42 - ) { + @upstream(batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: 42) { query: Query } @@ -18,15 +14,15 @@ type Post { title: String user: User @http( + url: "http://jsonplaceholder.typicode.com/users" 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") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type User { diff --git a/tests/core/snapshots/batching-post.md_merged.snap b/tests/core/snapshots/batching-post.md_merged.snap index 461c1973b0..f98c413920 100644 --- a/tests/core/snapshots/batching-post.md_merged.snap +++ b/tests/core/snapshots/batching-post.md_merged.snap @@ -4,11 +4,7 @@ expression: formatter --- schema @server(port: 8000, queryValidation: false) - @upstream( - baseURL: "http://jsonplaceholder.typicode.com" - batch: {delay: 1, headers: [], maxSize: 1000} - httpCache: 42 - ) { + @upstream(batch: {delay: 1, headers: [], maxSize: 1000}, httpCache: 42) { query: Query } @@ -16,12 +12,12 @@ type Post { body: String id: Int title: String - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! } type Query { - posts: [Post] @http(path: "/posts?id=1") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1") } type User { diff --git a/tests/core/snapshots/batching.md_merged.snap b/tests/core/snapshots/batching.md_merged.snap index b4768fbd99..ea42772fad 100644 --- a/tests/core/snapshots/batching.md_merged.snap +++ b/tests/core/snapshots/batching.md_merged.snap @@ -7,7 +7,7 @@ schema @server(batchRequests: true) @upstream { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/cache-control.md_merged.snap b/tests/core/snapshots/cache-control.md_merged.snap index b987165bb2..cb766383ea 100644 --- a/tests/core/snapshots/cache-control.md_merged.snap +++ b/tests/core/snapshots/cache-control.md_merged.snap @@ -8,7 +8,7 @@ schema @server(headers: {cacheControl: true}) @upstream { type Query { user(id: Int): User - @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) + @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/caching-collision.md_merged.snap b/tests/core/snapshots/caching-collision.md_merged.snap index 2cb7fad134..b79b449f74 100644 --- a/tests/core/snapshots/caching-collision.md_merged.snap +++ b/tests/core/snapshots/caching-collision.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { +schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { query: Query } type Bar { - foo: Foo @http(path: "/foo?id={{.value.id}}") @cache(maxAge: 300) + foo: Foo @http(url: "http://example.com/foo?id={{.value.id}}") @cache(maxAge: 300) id: String! } @@ -16,5 +16,5 @@ type Foo { } type Query @cache(maxAge: 100) { - bars: [Bar] @http(path: "/bars") + bars: [Bar] @http(url: "http://example.com/bars") } diff --git a/tests/core/snapshots/caching.md_merged.snap b/tests/core/snapshots/caching.md_merged.snap index 72aef82898..120fca795d 100644 --- a/tests/core/snapshots/caching.md_merged.snap +++ b/tests/core/snapshots/caching.md_merged.snap @@ -2,13 +2,13 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { +schema @server @upstream(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) + fieldCache: Type @http(url: "http://example.com/field-cache") @cache(maxAge: 30000) + fieldCacheList: [Type] @http(url: "http://example.com/field-cache-list") @cache(maxAge: 30000) typeCache: TypeCache } @@ -17,7 +17,7 @@ type Type { } 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") + a: Type @http(url: "http://example.com/type-cache-a") + b: Type @http(url: "http://example.com/type-cache-b") + list: [Type] @http(url: "http://example.com/type-cache-list") } diff --git a/tests/core/snapshots/call-graphql-datasource.md_merged.snap b/tests/core/snapshots/call-graphql-datasource.md_merged.snap index d99c0b0ddc..391f71c593 100644 --- a/tests/core/snapshots/call-graphql-datasource.md_merged.snap +++ b/tests/core/snapshots/call-graphql-datasource.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) { query: Query } @@ -17,9 +15,9 @@ type Post { } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") user(id: Int!): User - @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") + @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/call-mutation.md_merged.snap b/tests/core/snapshots/call-mutation.md_merged.snap index ccdcdba79b..2123be8662 100644 --- a/tests/core/snapshots/call-mutation.md_merged.snap +++ b/tests/core/snapshots/call-mutation.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query mutation: Mutation } @@ -23,14 +23,23 @@ type Mutation { attachPostToFirstUser(postId: Int!): User @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}}") + @http( + url: "http://jsonplaceholder.typicode.com/users/{{.args.userId}}" + body: "{\"postId\":{{.args.postId}}}" + method: "PATCH" + ) 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") + insertPost(input: PostInput): Post + @http(url: "http://jsonplaceholder.typicode.com/posts", body: "{{.args.input}}", method: "POST") 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") + @http( + url: "http://jsonplaceholder.typicode.com/users/{{.args.userId}}/posts" + body: "{{.args.input}}" + method: "POST" + ) } type Post { @@ -41,8 +50,8 @@ type Post { } type Query { - firstUser: User @http(path: "/users/1") - postFromUser(userId: Int!): Post @http(path: "/posts?userId={{.args.userId}}") + firstUser: User @http(url: "http://jsonplaceholder.typicode.com/users/1") + postFromUser(userId: Int!): Post @http(url: "http://jsonplaceholder.typicode.com/posts?userId={{.args.userId}}") } type User { diff --git a/tests/core/snapshots/call-operator.md_merged.snap b/tests/core/snapshots/call-operator.md_merged.snap index 16fbf7a355..52aa9cb5d6 100644 --- a/tests/core/snapshots/call-operator.md_merged.snap +++ b/tests/core/snapshots/call-operator.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(hostname: "0.0.0.0", port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) + @upstream(httpCache: 42) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } @@ -37,22 +37,25 @@ type Post { } type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + news: NewsData! @grpc(url: "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}}") + @grpc(url: "http://localhost:{{.args.port}}", method: "news.NewsService.GetAllNews") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + user1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") + userFromValue: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userGraphQL(id: Int): User - @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") + @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "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}}"}]) + @graphQL(url: "http://upstream/graphql", headers: [{key: "id", value: "{{.args.id}}"}], name: "user") + userHttpHeaders(id: ID!): User + @http(url: "http://jsonplaceholder.typicode.com/users", headers: [{key: "id", value: "{{.args.id}}"}]) + userHttpQuery(id: ID!): User + @http(url: "http://jsonplaceholder.typicode.com/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") + userPosts(id: ID!): [Post] + @http(url: "http://jsonplaceholder.typicode.com/posts", query: [{key: "userId", value: "{{.args.id}}"}]) + userWithPosts: UserWithPosts @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/cors-allow-cred-false.md_merged.snap b/tests/core/snapshots/cors-allow-cred-false.md_merged.snap index fd0444e0dc..2105c4fc1d 100644 --- a/tests/core/snapshots/cors-allow-cred-false.md_merged.snap +++ b/tests/core/snapshots/cors-allow-cred-false.md_merged.snap @@ -15,7 +15,7 @@ schema } } ) - @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { 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 index 13287b6775..772c09bada 100644 --- a/tests/core/snapshots/cors-allow-cred-true.md_merged.snap +++ b/tests/core/snapshots/cors-allow-cred-true.md_merged.snap @@ -15,7 +15,7 @@ schema } } ) - @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { 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 index 13287b6775..772c09bada 100644 --- a/tests/core/snapshots/cors-allow-cred-vary.md_merged.snap +++ b/tests/core/snapshots/cors-allow-cred-vary.md_merged.snap @@ -15,7 +15,7 @@ schema } } ) - @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { + @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { query: Query } diff --git a/tests/core/snapshots/dedupe_batch_query_execution.md_merged.snap b/tests/core/snapshots/dedupe_batch_query_execution.md_merged.snap index 8a9869d62e..628bcda6e6 100644 --- a/tests/core/snapshots/dedupe_batch_query_execution.md_merged.snap +++ b/tests/core/snapshots/dedupe_batch_query_execution.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) @upstream { query: Query } @@ -14,7 +14,7 @@ type Post { } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type User { diff --git a/tests/core/snapshots/default-value-arg.md_merged.snap b/tests/core/snapshots/default-value-arg.md_merged.snap index 027b09d6f7..2603c4c8a4 100644 --- a/tests/core/snapshots/default-value-arg.md_merged.snap +++ b/tests/core/snapshots/default-value-arg.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://abc.com") { +schema @server @upstream { query: Query } @@ -11,5 +11,5 @@ input Input { } type Query { - bar(input: Input = {id: 1}): Int @http(path: "/bar/{{.args.input.id}}") + bar(input: Input = {id: 1}): Int @http(url: "http://abc.com/bar/{{.args.input.id}}") } diff --git a/tests/core/snapshots/default-value-config.md_merged.snap b/tests/core/snapshots/default-value-config.md_merged.snap index 0016893a7c..b0ca4d47d7 100644 --- a/tests/core/snapshots/default-value-config.md_merged.snap +++ b/tests/core/snapshots/default-value-config.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://abc.com") { +schema @server @upstream { query: Query } @@ -11,6 +11,6 @@ input Input { } type Query { - bar(input: Input = {id: 3}): Int @http(path: "/foo/{{.args.input.id}}") - foo(input: Input!): Int @http(path: "/foo/{{.args.input.id}}") + bar(input: Input = {id: 3}): Int @http(url: "http://abc.com/foo/{{.args.input.id}}") + foo(input: Input!): Int @http(url: "http://abc.com/foo/{{.args.input.id}}") } diff --git a/tests/core/snapshots/env-value.md_merged.snap b/tests/core/snapshots/env-value.md_merged.snap index f42eee1f1a..ae2ea9bd84 100644 --- a/tests/core/snapshots/env-value.md_merged.snap +++ b/tests/core/snapshots/env-value.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -14,7 +14,7 @@ type Post { } 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}}") + post1: Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.env.ID}}") + post2: Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.env.POST_ID}}") + post3: Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.env.NESTED_POST_ID}}") } diff --git a/tests/core/snapshots/experimental-headers.md_merged.snap b/tests/core/snapshots/experimental-headers.md_merged.snap index b53dc7249a..21ea54563b 100644 --- a/tests/core/snapshots/experimental-headers.md_merged.snap +++ b/tests/core/snapshots/experimental-headers.md_merged.snap @@ -7,7 +7,7 @@ schema @server(headers: {experimental: ["X-experimental", "x-tailcall"]}) @upstr } type Query { - users: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/core/snapshots/federation-subgraph-force-disabled.md_merged.snap b/tests/core/snapshots/federation-subgraph-force-disabled.md_merged.snap index 89a7ebd499..181c9e7a12 100644 --- a/tests/core/snapshots/federation-subgraph-force-disabled.md_merged.snap +++ b/tests/core/snapshots/federation-subgraph-force-disabled.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(enableFederation: false, port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: 42) { +schema @server(enableFederation: false, port: 8000) @upstream(batch: {delay: 100, headers: []}, httpCache: 42) { query: Query } @@ -14,7 +12,7 @@ type Post @expr(body: {id: "{{.value.id}}", title: "post-title-{{.value.id}}"}) } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User @call(steps: [{query: "user", args: {id: "{{.value.id}}"}}]) { diff --git a/tests/core/snapshots/federation-subgraph-force-enabled.md_merged.snap b/tests/core/snapshots/federation-subgraph-force-enabled.md_merged.snap index 1065542849..ce491b9ef6 100644 --- a/tests/core/snapshots/federation-subgraph-force-enabled.md_merged.snap +++ b/tests/core/snapshots/federation-subgraph-force-enabled.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(enableFederation: true, port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: 42) { +schema @server(enableFederation: true, port: 8000) @upstream(batch: {delay: 100, headers: []}, httpCache: 42) { query: Query } @@ -18,7 +16,7 @@ type Query { Apollo federation Query._service resolver """ _service: _Service! - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User @tag(name: "team-accounts") { diff --git a/tests/core/snapshots/federation-subgraph-no-entities.md_merged.snap b/tests/core/snapshots/federation-subgraph-no-entities.md_merged.snap index e8c9606798..0446b75947 100644 --- a/tests/core/snapshots/federation-subgraph-no-entities.md_merged.snap +++ b/tests/core/snapshots/federation-subgraph-no-entities.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: 42) { +schema @server(port: 8000) @upstream(batch: {delay: 100, headers: []}, httpCache: 42) { query: Query } @@ -14,7 +12,7 @@ type Post { } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/graphql-conformance-001.md_merged.snap b/tests/core/snapshots/graphql-conformance-001.md_merged.snap index 867bc1347b..1e9172d87d 100644 --- a/tests/core/snapshots/graphql-conformance-001.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-001.md_merged.snap @@ -2,14 +2,13 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(args: [{key: "id", value: "{{.args.id}}"}], name: "user") + user(id: ID!): User! + @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-conformance-003.md_merged.snap b/tests/core/snapshots/graphql-conformance-003.md_merged.snap index db0f96da00..5936d93fac 100644 --- a/tests/core/snapshots/graphql-conformance-003.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-003.md_merged.snap @@ -2,14 +2,13 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(args: [{key: "id", value: "{{.args.id}}"}], name: "user") + user(id: ID!): User! + @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-conformance-010.md_merged.snap b/tests/core/snapshots/graphql-conformance-010.md_merged.snap index ec808d6825..8d51398c20 100644 --- a/tests/core/snapshots/graphql-conformance-010.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-010.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -26,5 +24,5 @@ type Point { type Query { nearby(location: LocationInput): Point - @graphQL(args: [{key: "location", value: "{{.args.location}}"}], name: "nearby") + @graphQL(args: [{key: "location", value: "{{.args.location}}"}], url: "http://upstream/graphql", name: "nearby") } diff --git a/tests/core/snapshots/graphql-conformance-013.md_merged.snap b/tests/core/snapshots/graphql-conformance-013.md_merged.snap index 8cc9fbeb60..3daa957b60 100644 --- a/tests/core/snapshots/graphql-conformance-013.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-013.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - me: User! @graphQL(name: "me") + me: User! @graphQL(url: "http://upstream/graphql", name: "me") } type User { diff --git a/tests/core/snapshots/graphql-conformance-014.md_merged.snap b/tests/core/snapshots/graphql-conformance-014.md_merged.snap index 867bc1347b..1e9172d87d 100644 --- a/tests/core/snapshots/graphql-conformance-014.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-014.md_merged.snap @@ -2,14 +2,13 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(args: [{key: "id", value: "{{.args.id}}"}], name: "user") + user(id: ID!): User! + @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-conformance-015.md_merged.snap b/tests/core/snapshots/graphql-conformance-015.md_merged.snap index 97a408bc1a..f220edfaf4 100644 --- a/tests/core/snapshots/graphql-conformance-015.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-015.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -19,7 +17,8 @@ input VideoSize { } type Query { - user(id: ID!): User! @graphQL(args: [{key: "id", value: "{{.args.id}}"}], name: "user") + user(id: ID!): User! + @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-conformance-018.md_merged.snap b/tests/core/snapshots/graphql-conformance-018.md_merged.snap index 6dad406ac9..a88d92fcbc 100644 --- a/tests/core/snapshots/graphql-conformance-018.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-018.md_merged.snap @@ -2,14 +2,13 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(args: [{key: "id", value: "{{.args.id}}"}], name: "user") + user(id: ID!): User! + @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-conformance-http-001.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-001.md_merged.snap index c23f16a8e6..642ac573e6 100644 --- a/tests/core/snapshots/graphql-conformance-http-001.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-001.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/graphql-conformance-http-002.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-002.md_merged.snap index 2b4fd26ed2..12edc9dfe2 100644 --- a/tests/core/snapshots/graphql-conformance-http-002.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-002.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -15,7 +13,7 @@ type BirthDay { } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/graphql-conformance-http-003.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-003.md_merged.snap index 15c61094e1..a26db3f74f 100644 --- a/tests/core/snapshots/graphql-conformance-http-003.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-003.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -17,7 +15,7 @@ type User { name: String! profilePic(size: Int, width: Int, height: Int): String! @http( - path: "/pic" + url: "http://upstream/pic" query: [ {key: "id", value: "{{.value.id}}"} {key: "size", value: "{{.args.size}}"} diff --git a/tests/core/snapshots/graphql-conformance-http-004.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-004.md_merged.snap index 15c61094e1..a26db3f74f 100644 --- a/tests/core/snapshots/graphql-conformance-http-004.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-004.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -17,7 +15,7 @@ type User { name: String! profilePic(size: Int, width: Int, height: Int): String! @http( - path: "/pic" + url: "http://upstream/pic" query: [ {key: "id", value: "{{.value.id}}"} {key: "size", value: "{{.args.size}}"} diff --git a/tests/core/snapshots/graphql-conformance-http-005.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-005.md_merged.snap index aba9aaab32..7a07e413b8 100644 --- a/tests/core/snapshots/graphql-conformance-http-005.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-005.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/graphql-conformance-http-006.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-006.md_merged.snap index 02b99f0acb..334955ea82 100644 --- a/tests/core/snapshots/graphql-conformance-http-006.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-006.md_merged.snap @@ -2,23 +2,24 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { friends(first: Int): [User!]! - @http(path: "/friends", query: [{key: "id", value: "{{.value.id}}"}, {key: "first", value: "{{.args.first}}"}]) + @http( + url: "http://upstream/friends" + query: [{key: "id", value: "{{.value.id}}"}, {key: "first", value: "{{.args.first}}"}] + ) id: ID! mutualFriends(first: Int): [User!]! @http( - path: "/mutual-friends" + url: "http://upstream/mutual-friends" query: [{key: "id", value: "{{.value.id}}"}, {key: "first", value: "{{.args.first}}"}] ) name: String! diff --git a/tests/core/snapshots/graphql-conformance-http-007.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-007.md_merged.snap index f044bb9160..05758545a8 100644 --- a/tests/core/snapshots/graphql-conformance-http-007.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-007.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -24,7 +22,8 @@ type Page implements Profile { } type Query { - profiles(handles: [ID!]!): [Profile!]! @http(path: "/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) + profiles(handles: [ID!]!): [Profile!]! + @http(url: "http://upstream/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) } type User implements Profile { diff --git a/tests/core/snapshots/graphql-conformance-http-008.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-008.md_merged.snap index d9d6e589f0..12038fc2b5 100644 --- a/tests/core/snapshots/graphql-conformance-http-008.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-008.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -29,7 +27,8 @@ type Page implements Profile { } type Query { - profiles(handles: [ID!]!): [Profile!]! @http(path: "/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) + profiles(handles: [ID!]!): [Profile!]! + @http(url: "http://upstream/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) } type User implements Profile { diff --git a/tests/core/snapshots/graphql-conformance-http-010.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-010.md_merged.snap index 35a17ee60e..aff10d1696 100644 --- a/tests/core/snapshots/graphql-conformance-http-010.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-010.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -27,7 +25,7 @@ type Point { type Query { nearby(location: LocationInput): Point @http( - path: "/nearby" + url: "http://upstream/nearby" query: [{key: "lon", value: "{{.args.location.lon}}"}, {key: "lat", value: "{{.args.location.lat}}"}] ) } diff --git a/tests/core/snapshots/graphql-conformance-http-012.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-012.md_merged.snap index 863b7394f9..3c19e41372 100644 --- a/tests/core/snapshots/graphql-conformance-http-012.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-012.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -32,5 +30,5 @@ type PhotoMeta { } type Query { - search: [SearchResult!]! @http(path: "/search") + search: [SearchResult!]! @http(url: "http://upstream/search") } diff --git a/tests/core/snapshots/graphql-conformance-http-013.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-013.md_merged.snap index a0fc0f6a99..c4a4d68e66 100644 --- a/tests/core/snapshots/graphql-conformance-http-013.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-013.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - me: User! @http(path: "/me") + me: User! @http(url: "http://upstream/me") } type User { diff --git a/tests/core/snapshots/graphql-conformance-http-014.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-014.md_merged.snap index 95fa9ca054..642ac573e6 100644 --- a/tests/core/snapshots/graphql-conformance-http-014.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-014.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/graphql-conformance-http-015.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-015.md_merged.snap index 0d5cfa528f..8acedfaee5 100644 --- a/tests/core/snapshots/graphql-conformance-http-015.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-015.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -19,7 +17,7 @@ input VideoSize { } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/graphql-conformance-http-017.md_merged.snap b/tests/core/snapshots/graphql-conformance-http-017.md_merged.snap index ad7f2f2ae7..850bd04690 100644 --- a/tests/core/snapshots/graphql-conformance-http-017.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-http-017.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -98,8 +96,8 @@ type Pig implements Animal & DomesticAnimal { } type Query { - allAnimals: [Animal] @http(path: "/all-animals") - edibleAnimals: [EdibleAnimals] @http(path: "/edible-animals") + allAnimals: [Animal] @http(url: "http://upstream/all-animals") + edibleAnimals: [EdibleAnimals] @http(url: "http://upstream/edible-animals") } type Salmon implements Animal & Fish { diff --git a/tests/core/snapshots/graphql-conformance-nested-lists-fragment.md_merged.snap b/tests/core/snapshots/graphql-conformance-nested-lists-fragment.md_merged.snap index ed061d025c..89a4a66c74 100644 --- a/tests/core/snapshots/graphql-conformance-nested-lists-fragment.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-nested-lists-fragment.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -16,11 +14,11 @@ type Admin { } type Query { - users: [[Role!]!]! @http(path: "/users") + users: [[Role!]!]! @http(url: "http://upstream/users") } type User { - accountRef: String! @http(path: "/refs/{{.value.id}}") + accountRef: String! @http(url: "http://upstream/refs/{{.value.id}}") id: ID! name: String! } diff --git a/tests/core/snapshots/graphql-conformance-nested-lists-http.md_merged.snap b/tests/core/snapshots/graphql-conformance-nested-lists-http.md_merged.snap index ebb17ef514..0ca8a52479 100644 --- a/tests/core/snapshots/graphql-conformance-nested-lists-http.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-nested-lists-http.md_merged.snap @@ -2,15 +2,14 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - addUsers(userNames: [[String!]!]!): Boolean @http(body: "{{.args.userNames}}", method: "POST", path: "/users") - userGroups: [[User!]!]! @http(path: "/users") + addUsers(userNames: [[String!]!]!): Boolean + @http(url: "http://upstream/users", body: "{{.args.userNames}}", method: "POST") + userGroups: [[User!]!]! @http(url: "http://upstream/users") } type User { diff --git a/tests/core/snapshots/graphql-conformance-nested-lists.md_merged.snap b/tests/core/snapshots/graphql-conformance-nested-lists.md_merged.snap index 7443c27f80..b2e7447d0f 100644 --- a/tests/core/snapshots/graphql-conformance-nested-lists.md_merged.snap +++ b/tests/core/snapshots/graphql-conformance-nested-lists.md_merged.snap @@ -2,16 +2,14 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { addUsers(userNames: [[String!]!]!): Boolean - @graphQL(args: [{key: "userNames", value: "{{.args.userNames}}"}], name: "addUsers") - userGroups: [[User!]!]! @graphQL(name: "users") + @graphQL(args: [{key: "userNames", value: "{{.args.userNames}}"}], url: "http://upstream/graphql", name: "addUsers") + userGroups: [[User!]!]! @graphQL(url: "http://upstream/graphql", name: "users") } type User { diff --git a/tests/core/snapshots/graphql-dataloader-batch-request.md_merged.snap b/tests/core/snapshots/graphql-dataloader-batch-request.md_merged.snap index 2e58baa40f..4ec834a696 100644 --- a/tests/core/snapshots/graphql-dataloader-batch-request.md_merged.snap +++ b/tests/core/snapshots/graphql-dataloader-batch-request.md_merged.snap @@ -10,17 +10,12 @@ type Post { id: Int title: String user: User - @graphQL( - args: [{key: "id", value: "{{.value.userId}}"}] - baseURL: "http://upstream/graphql" - batch: true - name: "user" - ) + @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], url: "http://upstream/graphql", batch: true, name: "user") userId: Int } type Query { - posts: [Post] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { 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 index 13b9678fa7..ab37e71fdc 100644 --- a/tests/core/snapshots/graphql-dataloader-no-batch-request.md_merged.snap +++ b/tests/core/snapshots/graphql-dataloader-no-batch-request.md_merged.snap @@ -9,12 +9,12 @@ schema @server @upstream(batch: {delay: 1, headers: []}) { type Post { id: Int title: String - user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], baseURL: "http://upstream/graphql", name: "user") + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], url: "http://upstream/graphql", name: "user") userId: Int } type Query { - posts: [Post] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { diff --git a/tests/core/snapshots/graphql-datasource-errors.md_merged.snap b/tests/core/snapshots/graphql-datasource-errors.md_merged.snap index d48edf4f44..30aee8d777 100644 --- a/tests/core/snapshots/graphql-datasource-errors.md_merged.snap +++ b/tests/core/snapshots/graphql-datasource-errors.md_merged.snap @@ -7,8 +7,7 @@ schema @server @upstream { } type Query { - user(id: Int): User - @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") + user(id: Int): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-datasource-mutation.md_merged.snap b/tests/core/snapshots/graphql-datasource-mutation.md_merged.snap index d2c986e266..3ceec60315 100644 --- a/tests/core/snapshots/graphql-datasource-mutation.md_merged.snap +++ b/tests/core/snapshots/graphql-datasource-mutation.md_merged.snap @@ -15,11 +15,11 @@ input UserInput { type Mutation { createUser(user: UserInput!): User - @graphQL(args: [{key: "user", value: "{{.args.user}}"}], baseURL: "http://upstream/graphql", name: "createUser") + @graphQL(args: [{key: "user", value: "{{.args.user}}"}], url: "http://upstream/graphql", name: "createUser") } type Query { - users: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") + users: [User] @graphQL(url: "http://upstream/graphql", name: "users") } type User { diff --git a/tests/core/snapshots/graphql-datasource-no-args.md_merged.snap b/tests/core/snapshots/graphql-datasource-no-args.md_merged.snap index 137b3f01c5..4c1e345f65 100644 --- a/tests/core/snapshots/graphql-datasource-no-args.md_merged.snap +++ b/tests/core/snapshots/graphql-datasource-no-args.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - users_list: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") + users_list: [User] @graphQL(url: "http://upstream/graphql", name: "users") } type User { diff --git a/tests/core/snapshots/graphql-datasource-query-directives.md_merged.snap b/tests/core/snapshots/graphql-datasource-query-directives.md_merged.snap index bce7a5ece7..3e34144364 100644 --- a/tests/core/snapshots/graphql-datasource-query-directives.md_merged.snap +++ b/tests/core/snapshots/graphql-datasource-query-directives.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - user: User @graphQL(baseURL: "http://upstream/graphql", name: "user") + user: User @graphQL(url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-datasource-with-args.md_merged.snap b/tests/core/snapshots/graphql-datasource-with-args.md_merged.snap index beb3b66e16..84332a5847 100644 --- a/tests/core/snapshots/graphql-datasource-with-args.md_merged.snap +++ b/tests/core/snapshots/graphql-datasource-with-args.md_merged.snap @@ -12,10 +12,8 @@ type Post { } 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") + post(id: Int): Post @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "post") + user(id: Int): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], url: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/core/snapshots/graphql-nested-datasource.md_merged.snap b/tests/core/snapshots/graphql-nested-datasource.md_merged.snap index 6f2a2ebc69..1df65b0e41 100644 --- a/tests/core/snapshots/graphql-nested-datasource.md_merged.snap +++ b/tests/core/snapshots/graphql-nested-datasource.md_merged.snap @@ -2,16 +2,14 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type A { - b: B @graphQL(args: [{key: "id", value: "{{.value.bid}}"}], name: "b") + b: B @graphQL(args: [{key: "id", value: "{{.value.bid}}"}], url: "http://upstream/graphql", name: "b") bid: Int! - c: C @graphQL(args: [{key: "id", value: "{{.value.cid}}"}], name: "c") + c: C @graphQL(args: [{key: "id", value: "{{.value.cid}}"}], url: "http://upstream/graphql", name: "c") cid: Int! id: Int! } @@ -27,5 +25,5 @@ type C { } type Query { - a: [A] @graphQL(name: "a") + a: [A] @graphQL(url: "http://upstream/graphql", name: "a") } diff --git a/tests/core/snapshots/grpc-batch.md_merged.snap b/tests/core/snapshots/grpc-batch.md_merged.snap index 1c2d740920..eba7964e99 100644 --- a/tests/core/snapshots/grpc-batch.md_merged.snap +++ b/tests/core/snapshots/grpc-batch.md_merged.snap @@ -28,10 +28,10 @@ type NewsData { } type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") newsById(news: NewsInput!): News! @grpc( - baseURL: "http://localhost:50051" + url: "http://localhost:50051" body: "{{.args.news}}" batchKey: ["news", "id"] method: "news.NewsService.GetMultipleNews" diff --git a/tests/core/snapshots/grpc-error.md_merged.snap b/tests/core/snapshots/grpc-error.md_merged.snap index 5471ae0974..c5d81eb03d 100644 --- a/tests/core/snapshots/grpc-error.md_merged.snap +++ b/tests/core/snapshots/grpc-error.md_merged.snap @@ -28,7 +28,7 @@ type NewsData { } type Query { - news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") newsById(news: NewsInput!): News! - @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } diff --git a/tests/core/snapshots/grpc-json.md_merged.snap b/tests/core/snapshots/grpc-json.md_merged.snap index 68c32fb712..9400e1eee4 100644 --- a/tests/core/snapshots/grpc-json.md_merged.snap +++ b/tests/core/snapshots/grpc-json.md_merged.snap @@ -2,10 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051") - @link(id: "news", src: "news.proto", type: Protobuf) { +schema @server(port: 8000) @upstream @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } @@ -21,8 +18,9 @@ type News { } type Query { - newsById: News! @grpc(body: {id: 2}, method: "news.NewsService.GetNews") - newsByIdMustache(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + newsById: News! @grpc(url: "http://localhost:50051", body: {id: 2}, method: "news.NewsService.GetNews") + newsByIdMustache(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") newsByIdMustacheAndJson(news: NewsInput!): News! - @grpc(body: {id: "{{.args.news.id}}"}, method: "news.NewsService.GetNews") + @grpc(url: "http://localhost:50051", body: {id: "{{.args.news.id}}"}, method: "news.NewsService.GetNews") } diff --git a/tests/core/snapshots/grpc-map.md_merged.snap b/tests/core/snapshots/grpc-map.md_merged.snap index 04dad312e5..a9522031c4 100644 --- a/tests/core/snapshots/grpc-map.md_merged.snap +++ b/tests/core/snapshots/grpc-map.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: 42) + @upstream(batch: {delay: 10, headers: []}, httpCache: 42) @link(src: "map.proto", type: Protobuf) { query: Query } @@ -15,7 +15,7 @@ input map__MapRequest { type Query { map__MapService__GetMap(mapRequest: map__MapRequest!): map__MapResponse! - @grpc(body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") + @grpc(url: "http://localhost:50051", body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") } type map__MapResponse { diff --git a/tests/core/snapshots/grpc-oneof.md_merged.snap b/tests/core/snapshots/grpc-oneof.md_merged.snap index 679c54ba45..e5527598c6 100644 --- a/tests/core/snapshots/grpc-oneof.md_merged.snap +++ b/tests/core/snapshots/grpc-oneof.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: 42) + @upstream(batch: {delay: 10, headers: []}, httpCache: 42) @link(src: "oneof.proto", type: Protobuf) { query: Query } @@ -73,23 +73,23 @@ union oneof__Response = oneof__Response__Var | oneof__Response__Var0 | oneof__Re type Query { oneof__OneOfService__GetOneOfVar0(request: oneof__Request__Var0__Var!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar1(request: oneof__Request__Var0__Var0!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar2(request: oneof__Request__Var0__Var1!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar3(request: oneof__Request__Var1__Var!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar4(request: oneof__Request__Var1__Var0!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar5(request: oneof__Request__Var1__Var1!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar6(request: oneof__Request__Var__Var!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar7(request: oneof__Request__Var__Var0!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar8(request: oneof__Request__Var__Var1!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") } type oneof__Command { 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 deleted file mode 100644 index f4f2990d59..0000000000 --- a/tests/core/snapshots/grpc-override-url-from-upstream.md_0.snap +++ /dev/null @@ -1,24 +0,0 @@ ---- -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 deleted file mode 100644 index 0e51757fea..0000000000 --- a/tests/core/snapshots/grpc-override-url-from-upstream.md_client.snap +++ /dev/null @@ -1,30 +0,0 @@ ---- -source: tests/core/spec.rs -expression: formatted ---- -type News { - body: String - id: Int - postImage: String - title: String -} - -type NewsData { - news: [News] -} - -input NewsInput { - body: String - id: Int - postImage: String - title: String -} - -type Query { - news: NewsData! - newsById(news: NewsInput!): News! -} - -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 deleted file mode 100644 index 5883f06ad2..0000000000 --- a/tests/core/snapshots/grpc-override-url-from-upstream.md_merged.snap +++ /dev/null @@ -1,34 +0,0 @@ ---- -source: tests/core/spec.rs -expression: formatter ---- -schema - @server(port: 8000) - @upstream(baseURL: "http://not-a-valid-grpc-url.com", batch: {delay: 10, headers: []}, httpCache: 42) - @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_merged.snap b/tests/core/snapshots/grpc-proto-with-same-package.md_merged.snap index 36c170df71..3cd137670d 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,11 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051") - @link(src: "foo.proto", type: Protobuf) - @link(src: "bar.proto", type: Protobuf) { +schema @server(port: 8000) @upstream @link(src: "foo.proto", type: Protobuf) @link(src: "bar.proto", type: Protobuf) { query: Query } @@ -19,6 +15,6 @@ type Foo { } type Query { - bar: Bar! @grpc(method: "test.BarService.GetBar") - foo: Foo! @grpc(method: "test.FooService.GetFoo") + bar: Bar! @grpc(url: "http://localhost:50051", method: "test.BarService.GetBar") + foo: Foo! @grpc(url: "http://localhost:50051", method: "test.FooService.GetFoo") } diff --git a/tests/core/snapshots/grpc-reflection.md_merged.snap b/tests/core/snapshots/grpc-reflection.md_merged.snap index 1b0ccfa90b..ec63b23f6f 100644 --- a/tests/core/snapshots/grpc-reflection.md_merged.snap +++ b/tests/core/snapshots/grpc-reflection.md_merged.snap @@ -2,10 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", httpCache: 42) - @link(src: "http://localhost:50051", type: Grpc) { +schema @server(port: 8000) @upstream(httpCache: 42) @link(src: "http://localhost:50051", type: Grpc) { query: Query } @@ -28,5 +25,5 @@ type NewsData { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") } diff --git a/tests/core/snapshots/grpc-simple.md_merged.snap b/tests/core/snapshots/grpc-simple.md_merged.snap index 94d5e18171..db8c337675 100644 --- a/tests/core/snapshots/grpc-simple.md_merged.snap +++ b/tests/core/snapshots/grpc-simple.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: 42) + @upstream(batch: {delay: 10, headers: []}, httpCache: 42) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } @@ -21,7 +21,8 @@ input NewsInput { } type Mutation { - deleteNews(news: NewsId!): Empty! @grpc(body: "{{.args.news}}", method: "news.NewsService.DeleteNews") + deleteNews(news: NewsId!): Empty! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.DeleteNews") } type News { @@ -36,6 +37,7 @@ type NewsData { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } 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 0163528d57..c5d81eb03d 100644 --- a/tests/core/snapshots/grpc-url-from-upstream.md_merged.snap +++ b/tests/core/snapshots/grpc-url-from-upstream.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: 42) + @upstream(batch: {delay: 10, headers: []}, httpCache: 42) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } @@ -28,6 +28,7 @@ type NewsData { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } diff --git a/tests/core/snapshots/http-select.md_merged.snap b/tests/core/snapshots/http-select.md_merged.snap index f3d4e3e2dc..49be827426 100644 --- a/tests/core/snapshots/http-select.md_merged.snap +++ b/tests/core/snapshots/http-select.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } @@ -14,9 +12,12 @@ type Company { } type Query { - userCompany(id: Int!): Company @http(path: "/users/{{.args.id}}", select: "{{.company}}") + userCompany(id: Int!): Company @http(url: "http://upstream/users/{{.args.id}}", select: "{{.company}}") userDetails(id: Int!): UserDetails - @http(path: "/users/{{.args.id}}", select: {id: "{{.id}}", city: "{{.address.city}}", phone: "{{.phone}}"}) + @http( + url: "http://upstream/users/{{.args.id}}" + select: {id: "{{.id}}", city: "{{.address.city}}", phone: "{{.phone}}"} + ) } type UserDetails { diff --git a/tests/core/snapshots/https.md_merged.snap b/tests/core/snapshots/https.md_merged.snap index 2d90243ede..8868c6973d 100644 --- a/tests/core/snapshots/https.md_merged.snap +++ b/tests/core/snapshots/https.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - firstUser: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") + firstUser: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/inline-field.md_merged.snap b/tests/core/snapshots/inline-field.md_merged.snap index 52f03d2b30..3b5dd5f9b3 100644 --- a/tests/core/snapshots/inline-field.md_merged.snap +++ b/tests/core/snapshots/inline-field.md_merged.snap @@ -15,7 +15,7 @@ type Geo { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User @addField(name: "address", path: ["address", "geo", "lat"]) { diff --git a/tests/core/snapshots/inline-index-list.md_merged.snap b/tests/core/snapshots/inline-index-list.md_merged.snap index dfe7e320c5..b321ecb476 100644 --- a/tests/core/snapshots/inline-index-list.md_merged.snap +++ b/tests/core/snapshots/inline-index-list.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query @addField(name: "username", path: ["username", "0", "name"]) { - username: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") @modify(omit: true) + username: [User] @http(url: "http://jsonplaceholder.typicode.com/users") @modify(omit: true) } type User { diff --git a/tests/core/snapshots/inline-many-list.md_merged.snap b/tests/core/snapshots/inline-many-list.md_merged.snap index 0815875a14..9174c51993 100644 --- a/tests/core/snapshots/inline-many-list.md_merged.snap +++ b/tests/core/snapshots/inline-many-list.md_merged.snap @@ -13,7 +13,7 @@ type A { } type Query { - u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") + u: U @http(url: "http://jsonplaceholder.typicode.com/us/1") } type U diff --git a/tests/core/snapshots/inline-many.md_merged.snap b/tests/core/snapshots/inline-many.md_merged.snap index 8b477cb9f1..0cdc230a82 100644 --- a/tests/core/snapshots/inline-many.md_merged.snap +++ b/tests/core/snapshots/inline-many.md_merged.snap @@ -13,7 +13,7 @@ type Address { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User diff --git a/tests/core/snapshots/introspection-query-with-disabled-introspection.md_merged.snap b/tests/core/snapshots/introspection-query-with-disabled-introspection.md_merged.snap index 9c90bca585..2c671cbd93 100644 --- a/tests/core/snapshots/introspection-query-with-disabled-introspection.md_merged.snap +++ b/tests/core/snapshots/introspection-query-with-disabled-introspection.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", introspection: false, port: 8001, queryValidation: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(hostname: "0.0.0.0", introspection: false, port: 8001, queryValidation: false) @upstream(httpCache: 42) { query: Query } type Query { - me: User! @http(path: "/me") + me: User! @http(url: "http://upstream/me") } type User { diff --git a/tests/core/snapshots/io-cache.md_merged.snap b/tests/core/snapshots/io-cache.md_merged.snap index a30fcb2e35..ceea8fa892 100644 --- a/tests/core/snapshots/io-cache.md_merged.snap +++ b/tests/core/snapshots/io-cache.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(httpCache: 42) { query: Query } @@ -12,12 +10,12 @@ type Post { body: String! id: Int! title: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { diff --git a/tests/core/snapshots/js-directive.md_merged.snap b/tests/core/snapshots/js-directive.md_merged.snap index 71b55618ec..36a6ff5048 100644 --- a/tests/core/snapshots/js-directive.md_merged.snap +++ b/tests/core/snapshots/js-directive.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") @link(src: "test.js", type: Script) { +schema @server @upstream @link(src: "test.js", type: Script) { query: Query } type Query { - hello: User! @http(path: "/users/1") + hello: User! @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap b/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap index ace551158a..827ad6ac0d 100644 --- a/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap +++ b/tests/core/snapshots/jsonplaceholder-call-post.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(hostname: "0.0.0.0", port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 100, headers: []}, httpCache: 42) { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream(batch: {delay: 100, headers: []}, httpCache: 42) { query: Query } @@ -16,9 +14,9 @@ type Post { } type Query { - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{.args.id}}") - users: [User] @http(path: "/users") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/core/snapshots/modified-field.md_merged.snap b/tests/core/snapshots/modified-field.md_merged.snap index b2f5817497..43b1759025 100644 --- a/tests/core/snapshots/modified-field.md_merged.snap +++ b/tests/core/snapshots/modified-field.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/mutation-put.md_merged.snap b/tests/core/snapshots/mutation-put.md_merged.snap index f22ce38c91..399f8de825 100644 --- a/tests/core/snapshots/mutation-put.md_merged.snap +++ b/tests/core/snapshots/mutation-put.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query mutation: Mutation } @@ -15,7 +15,8 @@ input PostInput { } type Mutation { - insertPost(input: PostInput!): Post @http(body: "{{.args.input}}", method: "PUT", path: "/posts/{{.args.input.id}}") + insertPost(input: PostInput!): Post + @http(url: "http://jsonplaceholder.typicode.com/posts/{{.args.input.id}}", body: "{{.args.input}}", method: "PUT") } type Post { @@ -26,7 +27,7 @@ type Post { } type Query { - firstUser: User @http(path: "/users/1") + firstUser: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/mutation.md_merged.snap b/tests/core/snapshots/mutation.md_merged.snap index de50d58cad..81e5c4c893 100644 --- a/tests/core/snapshots/mutation.md_merged.snap +++ b/tests/core/snapshots/mutation.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query mutation: Mutation } @@ -14,7 +14,8 @@ input PostInput { } type Mutation { - insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post + @http(url: "http://jsonplaceholder.typicode.com/posts", body: "{{.args.input}}", method: "POST") } type Post { @@ -25,7 +26,7 @@ type Post { } type Query { - firstUser: User @http(path: "/users/1") + firstUser: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/n-plus-one-list.md_merged.snap b/tests/core/snapshots/n-plus-one-list.md_merged.snap index e7b1215736..3b11a2cea8 100644 --- a/tests/core/snapshots/n-plus-one-list.md_merged.snap +++ b/tests/core/snapshots/n-plus-one-list.md_merged.snap @@ -2,23 +2,23 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { +schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { query: Query } type Bar { - foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}]) + foo: [Foo] @http(url: "http://example.com/foos", batchKey: ["id"], 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}}"}]) + bar: Bar @http(url: "http://example.com/bars", batchKey: ["fooId"], query: [{key: "fooId", value: "{{.value.id}}"}]) id: Int! name: String! } type Query { - bars: [Bar] @http(path: "/bars") - foos: [Foo] @http(path: "/foos") + bars: [Bar] @http(url: "http://example.com/bars") + foos: [Foo] @http(url: "http://example.com/foos") } diff --git a/tests/core/snapshots/n-plus-one.md_merged.snap b/tests/core/snapshots/n-plus-one.md_merged.snap index e7b1215736..3b11a2cea8 100644 --- a/tests/core/snapshots/n-plus-one.md_merged.snap +++ b/tests/core/snapshots/n-plus-one.md_merged.snap @@ -2,23 +2,23 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, headers: [], maxSize: 1000}) { +schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { query: Query } type Bar { - foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}]) + foo: [Foo] @http(url: "http://example.com/foos", batchKey: ["id"], 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}}"}]) + bar: Bar @http(url: "http://example.com/bars", batchKey: ["fooId"], query: [{key: "fooId", value: "{{.value.id}}"}]) id: Int! name: String! } type Query { - bars: [Bar] @http(path: "/bars") - foos: [Foo] @http(path: "/foos") + bars: [Bar] @http(url: "http://example.com/bars") + foos: [Foo] @http(url: "http://example.com/foos") } diff --git a/tests/core/snapshots/nested-objects.md_merged.snap b/tests/core/snapshots/nested-objects.md_merged.snap index 10fb7673eb..1d098fabf2 100644 --- a/tests/core/snapshots/nested-objects.md_merged.snap +++ b/tests/core/snapshots/nested-objects.md_merged.snap @@ -17,7 +17,7 @@ type Geo { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/nested-recursive-types.md_merged.snap b/tests/core/snapshots/nested-recursive-types.md_merged.snap index b23aef7a3a..e61ece34f7 100644 --- a/tests/core/snapshots/nested-recursive-types.md_merged.snap +++ b/tests/core/snapshots/nested-recursive-types.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query mutation: Mutation } @@ -17,7 +17,7 @@ input NestedUserInput { } input UserInput { - connections: [ConnectionInput] @http(path: "/connections/{{.value.id}}") + connections: [ConnectionInput] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") id: Int! name: String } @@ -28,7 +28,8 @@ type Connection { } type Mutation { - createUser(user: UserInput): User @http(body: "{{.args.user}}", method: "POST", path: "/user") + createUser(user: UserInput): User + @http(url: "http://jsonplaceholder.typicode.com/user", body: "{{.args.user}}", method: "POST") } type NestedUser { @@ -36,11 +37,11 @@ type NestedUser { } type Query { - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { - connections: [Connection] @http(path: "/connections/{{.value.id}}") + connections: [Connection] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") id: Int! name: String } diff --git a/tests/core/snapshots/nesting-level3.md_merged.snap b/tests/core/snapshots/nesting-level3.md_merged.snap index ce7d521680..fd3480ea1b 100644 --- a/tests/core/snapshots/nesting-level3.md_merged.snap +++ b/tests/core/snapshots/nesting-level3.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -10,12 +10,12 @@ type Post { body: String id: Int title: String - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! } type Query { - post: Post @http(path: "/posts/1") + post: Post @http(url: "http://jsonplaceholder.typicode.com/posts/1") } type Todo { @@ -27,7 +27,7 @@ type User { id: Int! name: String! phone: String - todos: [Todo] @http(path: "/users/{{.value.id}}/todos") + todos: [Todo] @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.id}}/todos") username: String! website: String } diff --git a/tests/core/snapshots/nullable-arg-query.md_merged.snap b/tests/core/snapshots/nullable-arg-query.md_merged.snap index fe601bc3fb..74427ecda9 100644 --- a/tests/core/snapshots/nullable-arg-query.md_merged.snap +++ b/tests/core/snapshots/nullable-arg-query.md_merged.snap @@ -8,7 +8,7 @@ schema @server @upstream { type Query { users(id: ID): [User] - @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) + @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/omit-index-list.md_merged.snap b/tests/core/snapshots/omit-index-list.md_merged.snap index dfe7e320c5..b321ecb476 100644 --- a/tests/core/snapshots/omit-index-list.md_merged.snap +++ b/tests/core/snapshots/omit-index-list.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query @addField(name: "username", path: ["username", "0", "name"]) { - username: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") @modify(omit: true) + username: [User] @http(url: "http://jsonplaceholder.typicode.com/users") @modify(omit: true) } type User { diff --git a/tests/core/snapshots/omit-many.md_merged.snap b/tests/core/snapshots/omit-many.md_merged.snap index 0cf54fc9f7..f583e86cff 100644 --- a/tests/core/snapshots/omit-many.md_merged.snap +++ b/tests/core/snapshots/omit-many.md_merged.snap @@ -14,7 +14,7 @@ type Address { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User diff --git a/tests/core/snapshots/omit-resolved-by-parent.md_merged.snap b/tests/core/snapshots/omit-resolved-by-parent.md_merged.snap index 81c66a3607..f823d4c745 100644 --- a/tests/core/snapshots/omit-resolved-by-parent.md_merged.snap +++ b/tests/core/snapshots/omit-resolved-by-parent.md_merged.snap @@ -11,7 +11,7 @@ type Address { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User @addField(name: "address", path: ["address", "street"]) { diff --git a/tests/core/snapshots/recursive-types-json.md_merged.snap b/tests/core/snapshots/recursive-types-json.md_merged.snap index fb53ea1237..7722b453d6 100644 --- a/tests/core/snapshots/recursive-types-json.md_merged.snap +++ b/tests/core/snapshots/recursive-types-json.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server @upstream(httpCache: 42) { query: Query mutation: Mutation } @@ -13,7 +13,7 @@ input ConnectionInput { } input UserInput { - connections: [ConnectionInput] @http(path: "/connections/{{.value.id}}") + connections: [ConnectionInput] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") id: Int! name: String! } @@ -24,15 +24,16 @@ type Connection { } type Mutation { - createUser(user: UserInput): User @http(body: "{{.args.user}}", method: "POST", path: "/user") + createUser(user: UserInput): User + @http(url: "http://jsonplaceholder.typicode.com/user", body: "{{.args.user}}", method: "POST") } type Query { - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { - connections: [Connection] @http(path: "/connections/{{.value.id}}") + connections: [Connection] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") id: Int! name: String! } diff --git a/tests/core/snapshots/recursive-types.md_merged.snap b/tests/core/snapshots/recursive-types.md_merged.snap index 19889254e3..02f7869077 100644 --- a/tests/core/snapshots/recursive-types.md_merged.snap +++ b/tests/core/snapshots/recursive-types.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query mutation: Mutation } @@ -13,7 +13,7 @@ input ConnectionInput { } input UserInput { - connections: [ConnectionInput] @http(path: "/connections/{{.value.id}}") + connections: [ConnectionInput] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") id: Int! name: String } @@ -24,15 +24,16 @@ type Connection { } type Mutation { - createUser(user: UserInput): User @http(body: "{{.args.user}}", method: "POST", path: "/user") + createUser(user: UserInput): User + @http(url: "http://jsonplaceholder.typicode.com/user", body: "{{.args.user}}", method: "POST") } type Query { - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { - connections: [Connection] @http(path: "/connections/{{.value.id}}") + connections: [Connection] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") id: Int! name: String } diff --git a/tests/core/snapshots/ref-other-nested.md_merged.snap b/tests/core/snapshots/ref-other-nested.md_merged.snap index a6038b74d1..37acaf29d1 100644 --- a/tests/core/snapshots/ref-other-nested.md_merged.snap +++ b/tests/core/snapshots/ref-other-nested.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - firstUser: User1 @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") + firstUser: User1 @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { @@ -20,5 +20,5 @@ type User1 { } type User2 { - user2: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/1") + user2: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } diff --git a/tests/core/snapshots/ref-other.md_merged.snap b/tests/core/snapshots/ref-other.md_merged.snap index 146c5757f4..3b8283aac8 100644 --- a/tests/core/snapshots/ref-other.md_merged.snap +++ b/tests/core/snapshots/ref-other.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -16,5 +16,5 @@ type User { } type User1 { - user1: User @http(path: "/users/1") + user1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } diff --git a/tests/core/snapshots/related-fields-recursive.md_merged.snap b/tests/core/snapshots/related-fields-recursive.md_merged.snap index a5643e4b80..6b50ea16eb 100644 --- a/tests/core/snapshots/related-fields-recursive.md_merged.snap +++ b/tests/core/snapshots/related-fields-recursive.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(hostname: "0.0.0.0", port: 8000) @upstream(baseURL: "http://localhost:8083/graphql") { +schema @server(hostname: "0.0.0.0", port: 8000) @upstream { query: Query } @@ -17,5 +17,5 @@ type NodeB { } type Query { - queryNodeA: [NodeA] @graphQL(name: "queryNodeA") + queryNodeA: [NodeA] @graphQL(url: "http://localhost:8083/graphql", name: "queryNodeA") } diff --git a/tests/core/snapshots/rename-field.md_merged.snap b/tests/core/snapshots/rename-field.md_merged.snap index 126ea59c15..053ccccd19 100644 --- a/tests/core/snapshots/rename-field.md_merged.snap +++ b/tests/core/snapshots/rename-field.md_merged.snap @@ -7,8 +7,8 @@ schema @server @upstream { } 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") + person1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") @modify(name: "user1") + person2: User @http(url: "http://jsonplaceholder.typicode.com/users/2") @modify(name: "user2") } type User { diff --git a/tests/core/snapshots/request-to-upstream-batching.md_merged.snap b/tests/core/snapshots/request-to-upstream-batching.md_merged.snap index 94404e77e9..935f6d2017 100644 --- a/tests/core/snapshots/request-to-upstream-batching.md_merged.snap +++ b/tests/core/snapshots/request-to-upstream-batching.md_merged.snap @@ -9,9 +9,8 @@ schema @server(batchRequests: true) @upstream(batch: {delay: 1, headers: [], max type Query { user(id: Int!): User @http( - baseURL: "http://jsonplaceholder.typicode.com" + url: "http://jsonplaceholder.typicode.com/users" batchKey: ["id"] - path: "/users" query: [{key: "id", value: "{{.args.id}}"}] ) } diff --git a/tests/core/snapshots/resolve-with-headers.md_merged.snap b/tests/core/snapshots/resolve-with-headers.md_merged.snap index b382420ea5..07a5cb1763 100644 --- a/tests/core/snapshots/resolve-with-headers.md_merged.snap +++ b/tests/core/snapshots/resolve-with-headers.md_merged.snap @@ -14,5 +14,5 @@ type Post { } type Query { - post1: Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{.headers.authorization}}") + post1: Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.headers.authorization}}") } diff --git a/tests/core/snapshots/resolve-with-vars.md_merged.snap b/tests/core/snapshots/resolve-with-vars.md_merged.snap index 2ea04d7d21..d0113a3f37 100644 --- a/tests/core/snapshots/resolve-with-vars.md_merged.snap +++ b/tests/core/snapshots/resolve-with-vars.md_merged.snap @@ -7,8 +7,7 @@ schema @server(vars: [{key: "id", value: "1"}]) @upstream { } type Query { - user: [User] - @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.vars.id}}"}]) + user: [User] @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.vars.id}}"}]) } type User { diff --git a/tests/core/snapshots/resolved-by-parent.md_merged.snap b/tests/core/snapshots/resolved-by-parent.md_merged.snap index 81c66a3607..f823d4c745 100644 --- a/tests/core/snapshots/resolved-by-parent.md_merged.snap +++ b/tests/core/snapshots/resolved-by-parent.md_merged.snap @@ -11,7 +11,7 @@ type Address { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User @addField(name: "address", path: ["address", "street"]) { diff --git a/tests/core/snapshots/rest-api-error.md_merged.snap b/tests/core/snapshots/rest-api-error.md_merged.snap index eb5274189a..ceed6b8faf 100644 --- a/tests/core/snapshots/rest-api-error.md_merged.snap +++ b/tests/core/snapshots/rest-api-error.md_merged.snap @@ -2,15 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @link(src: "operation-user.graphql", type: Operation) { +schema @server @upstream @link(src: "operation-user.graphql", type: Operation) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/rest-api-post.md_merged.snap b/tests/core/snapshots/rest-api-post.md_merged.snap index eb5274189a..ceed6b8faf 100644 --- a/tests/core/snapshots/rest-api-post.md_merged.snap +++ b/tests/core/snapshots/rest-api-post.md_merged.snap @@ -2,15 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @link(src: "operation-user.graphql", type: Operation) { +schema @server @upstream @link(src: "operation-user.graphql", type: Operation) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/rest-api.md_merged.snap b/tests/core/snapshots/rest-api.md_merged.snap index eb5274189a..ceed6b8faf 100644 --- a/tests/core/snapshots/rest-api.md_merged.snap +++ b/tests/core/snapshots/rest-api.md_merged.snap @@ -2,15 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @link(src: "operation-user.graphql", type: Operation) { +schema @server @upstream @link(src: "operation-user.graphql", type: Operation) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/routes-param-on-server-directive.md_merged.snap b/tests/core/snapshots/routes-param-on-server-directive.md_merged.snap index bbb4a061d2..96f8185f8a 100644 --- a/tests/core/snapshots/routes-param-on-server-directive.md_merged.snap +++ b/tests/core/snapshots/routes-param-on-server-directive.md_merged.snap @@ -7,7 +7,7 @@ schema @server(port: 8000, routes: {status: "/health", graphQL: "/tailcall-gql"} } type Query { - users: [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/core/snapshots/showcase.md_merged.snap b/tests/core/snapshots/showcase.md_merged.snap index 4429777dd7..b43ac5ec33 100644 --- a/tests/core/snapshots/showcase.md_merged.snap +++ b/tests/core/snapshots/showcase.md_merged.snap @@ -7,7 +7,7 @@ schema @server(showcase: true) @upstream { } type Query { - not_user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + not_user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/simple-graphql.md_merged.snap b/tests/core/snapshots/simple-graphql.md_merged.snap index e12fd345b7..9a8bef2a99 100644 --- a/tests/core/snapshots/simple-graphql.md_merged.snap +++ b/tests/core/snapshots/simple-graphql.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/simple-query.md_merged.snap b/tests/core/snapshots/simple-query.md_merged.snap index 0b9490066b..8868c6973d 100644 --- a/tests/core/snapshots/simple-query.md_merged.snap +++ b/tests/core/snapshots/simple-query.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - firstUser: User @http(path: "/users/1") + firstUser: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/test-add-field-list.md_merged.snap b/tests/core/snapshots/test-add-field-list.md_merged.snap index 2ed9f55299..50190e214b 100644 --- a/tests/core/snapshots/test-add-field-list.md_merged.snap +++ b/tests/core/snapshots/test-add-field-list.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,5 +19,5 @@ type Foo { } type Query @addField(name: "b", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") + foo: [Foo] @http(url: "http://jsonplaceholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-add-field.md_merged.snap b/tests/core/snapshots/test-add-field.md_merged.snap index 50ff0d207a..8cae36924b 100644 --- a/tests/core/snapshots/test-add-field.md_merged.snap +++ b/tests/core/snapshots/test-add-field.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,5 +19,5 @@ type Foo { } type Query @addField(name: "b", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") } 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 index 372c36acf2..958855f115 100644 --- 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 @@ -2,11 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @link(src: "link-expr.graphql", type: Config) - @link(src: "link-enum.graphql", type: Config) { +schema @server @upstream @link(src: "link-expr.graphql", type: Config) @link(src: "link-enum.graphql", type: Config) { query: Query } @@ -16,6 +12,6 @@ enum Foo { } type Query { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") hello: String @expr(body: "Hello from server") } diff --git a/tests/core/snapshots/test-batching-group-by.md_merged.snap b/tests/core/snapshots/test-batching-group-by.md_merged.snap index 43b9786957..fea8f0aafc 100644 --- a/tests/core/snapshots/test-batching-group-by.md_merged.snap +++ b/tests/core/snapshots/test-batching-group-by.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 4000) @upstream(baseURL: "http://abc.com", batch: {delay: 1, headers: [], maxSize: 1000}) { +schema @server(port: 4000) @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { query: Query } @@ -10,12 +10,12 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) + user: User @http(url: "http://abc.com/users", batchKey: ["id"], query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } type Query { - posts: [Post] @http(path: "/posts?id=1&id=11") + posts: [Post] @http(url: "http://abc.com/posts?id=1&id=11") } type User { diff --git a/tests/core/snapshots/test-cache.md_merged.snap b/tests/core/snapshots/test-cache.md_merged.snap index 9f54087e77..60b95dc3a6 100644 --- a/tests/core/snapshots/test-cache.md_merged.snap +++ b/tests/core/snapshots/test-cache.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - user: User @http(path: "/foo") @cache(maxAge: 300) + user: User @http(url: "http://jsonplaceholder.typicode.com/foo") @cache(maxAge: 300) } type User @cache(maxAge: 900) { diff --git a/tests/core/snapshots/test-call-operator-errors.md_error.snap b/tests/core/snapshots/test-call-operator-errors.md_error.snap index 98a5f21455..7c64620082 100644 --- a/tests/core/snapshots/test-call-operator-errors.md_error.snap +++ b/tests/core/snapshots/test-call-operator-errors.md_error.snap @@ -4,58 +4,20 @@ expression: errors --- [ { - "message": "No resolver has been found in the schema", + "message": "Parsing failed because of missing field `url`", "trace": [ "Query", - "userWithoutResolver" + "userWithGraphQLResolver", + "@graphQL" ], "description": null }, { - "message": "no argument 'id' found", + "message": "Parsing failed because of missing field `url`", "trace": [ - "Post", - "argumentMismatchGraphQL", - "@call", - "userWithGraphQLResolver" - ], - "description": null - }, - { - "message": "no argument 'id' found", - "trace": [ - "Post", - "headersMismatchGraphQL", - "@call", - "userWithGraphQLResolver" - ], - "description": null - }, - { - "message": "no argument 'id' found", - "trace": [ - "Post", - "urlMismatchHttp", - "@call", - "user" - ], - "description": null - }, - { - "message": "call must have query or mutation", - "trace": [ - "Post", - "withoutOperator", - "@call" - ], - "description": null - }, - { - "message": "userWithoutResolver field has no resolver", - "trace": [ - "Post", - "withoutResolver", - "@call" + "Query", + "userWithGraphQLHeaders", + "@graphQL" ], "description": null } diff --git a/tests/core/snapshots/test-custom-scalar.md_merged.snap b/tests/core/snapshots/test-custom-scalar.md_merged.snap index 4353d6868e..2fa5fda505 100644 --- a/tests/core/snapshots/test-custom-scalar.md_merged.snap +++ b/tests/core/snapshots/test-custom-scalar.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } scalar Json type Query { - foo: [Json] @http(path: "/foo") + foo: [Json] @http(url: "http://jsonplacheholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-custom-types.md_merged.snap b/tests/core/snapshots/test-custom-types.md_merged.snap index a72ed4f7f8..85914edbb4 100644 --- a/tests/core/snapshots/test-custom-types.md_merged.snap +++ b/tests/core/snapshots/test-custom-types.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Que mutation: Mut } @@ -14,7 +14,8 @@ input PostInput { } type Mut { - insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post + @http(url: "http://jsonplaceholder.typicode.com/posts", body: "{{.args.input}}", method: "POST") } type Post { diff --git a/tests/core/snapshots/test-dbl-usage-many.md_merged.snap b/tests/core/snapshots/test-dbl-usage-many.md_merged.snap index 340f69b687..e688d2e90a 100644 --- a/tests/core/snapshots/test-dbl-usage-many.md_merged.snap +++ b/tests/core/snapshots/test-dbl-usage-many.md_merged.snap @@ -22,8 +22,8 @@ type Post { } type Query { - post(input: PostInput!): Post @http(baseURL: "http://localhost:8080", path: "/user/{{.args.input.id}}") - user(input: UserInput!): User @http(baseURL: "http://localhost:8080", path: "/user/{{.args.input.id}}") + post(input: PostInput!): Post @http(url: "http://localhost:8080/user/{{.args.input.id}}") + user(input: UserInput!): User @http(url: "http://localhost:8080/user/{{.args.input.id}}") } type User { diff --git a/tests/core/snapshots/test-description-many.md_merged.snap b/tests/core/snapshots/test-description-many.md_merged.snap index 54f64a636a..d20caf5b81 100644 --- a/tests/core/snapshots/test-description-many.md_merged.snap +++ b/tests/core/snapshots/test-description-many.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -17,5 +17,5 @@ type Query { """ This is test """ - foo: Bar @http(path: "/foo") + foo: Bar @http(url: "http://jsonplacheholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-enable-jit.md_merged.snap b/tests/core/snapshots/test-enable-jit.md_merged.snap index f4a7a4d3da..c79d7ac501 100644 --- a/tests/core/snapshots/test-enable-jit.md_merged.snap +++ b/tests/core/snapshots/test-enable-jit.md_merged.snap @@ -2,21 +2,19 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(enableJIT: true, hostname: "0.0.0.0", port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(enableJIT: true, hostname: "0.0.0.0", port: 8000) @upstream { query: Query } type Post { id: Int! title: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") userId: Int! } type Query @cache(maxAge: 30000) { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { diff --git a/tests/core/snapshots/test-enum-aliases.md_merged.snap b/tests/core/snapshots/test-enum-aliases.md_merged.snap index ac7bbc5d78..5034710372 100644 --- a/tests/core/snapshots/test-enum-aliases.md_merged.snap +++ b/tests/core/snapshots/test-enum-aliases.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://localhost:8080") { +schema @server @upstream { 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 index 79a95bb7c4..827f9e3471 100644 --- a/tests/core/snapshots/test-enum-as-argument.md_merged.snap +++ b/tests/core/snapshots/test-enum-as-argument.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -12,7 +12,11 @@ enum Test { } type Query { - user(id: Int!, test: Test): User @http(path: "/users/{{.args.id}}", query: [{key: "enum", value: "{{.args.test}}"}]) + user(id: Int!, test: Test): User + @http( + url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}" + query: [{key: "enum", value: "{{.args.test}}"}] + ) } type User { diff --git a/tests/core/snapshots/test-enum-default.md_merged.snap b/tests/core/snapshots/test-enum-default.md_merged.snap index 762729d31e..b85ad2e9e1 100644 --- a/tests/core/snapshots/test-enum-default.md_merged.snap +++ b/tests/core/snapshots/test-enum-default.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(port: 8080) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: []}, httpCache: 42) + @upstream(batch: {delay: 10, headers: []}, httpCache: 42) @link(id: "news", src: "./service.proto", type: Protobuf) { query: Query } @@ -29,5 +29,5 @@ type NewsInput { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") } diff --git a/tests/core/snapshots/test-enum-description.md_merged.snap b/tests/core/snapshots/test-enum-description.md_merged.snap index 17ab731669..7adb432c3e 100644 --- a/tests/core/snapshots/test-enum-description.md_merged.snap +++ b/tests/core/snapshots/test-enum-description.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://localhost:8080") { +schema @server @upstream { query: Query } diff --git a/tests/core/snapshots/test-enum-merge.md_merged.snap b/tests/core/snapshots/test-enum-merge.md_merged.snap index 4247d010f5..b89d9c3e49 100644 --- a/tests/core/snapshots/test-enum-merge.md_merged.snap +++ b/tests/core/snapshots/test-enum-merge.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -13,5 +13,5 @@ enum Foo { } type Query { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-enum.md_merged.snap b/tests/core/snapshots/test-enum.md_merged.snap index 41249bb98e..437f2b1be7 100644 --- a/tests/core/snapshots/test-enum.md_merged.snap +++ b/tests/core/snapshots/test-enum.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://localhost:8080") { +schema @server @upstream { query: Query } diff --git a/tests/core/snapshots/test-field-already-implemented-from-Interface.md_error.snap b/tests/core/snapshots/test-field-already-implemented-from-Interface.md_error.snap index e0af5a9a50..137b3ce721 100644 --- a/tests/core/snapshots/test-field-already-implemented-from-Interface.md_error.snap +++ b/tests/core/snapshots/test-field-already-implemented-from-Interface.md_error.snap @@ -4,30 +4,12 @@ expression: errors --- [ { - "message": "no argument 'input' found", + "message": "Parsing failed because of unknown field `baseURL`, expected one of `onRequest`, `url`, `body`, `encoding`, `batchKey`, `headers`, `input`, `method`, `output`, `query`, `dedupe`, `select`", "trace": [ "Query", "user", "@http", - "path" - ], - "description": null - }, - { - "message": "Field is already implemented from interface", - "trace": [ - "User", - "userId", - "@modify" - ], - "description": null - }, - { - "message": "Field is already implemented from interface", - "trace": [ - "User", - "userName", - "@modify" + "baseURL" ], "description": null } diff --git a/tests/core/snapshots/test-graphqlsource-no-base-url.md_error.snap b/tests/core/snapshots/test-graphqlsource-no-base-url.md_error.snap index 852880f9b7..a1a4d2f8d8 100644 --- a/tests/core/snapshots/test-graphqlsource-no-base-url.md_error.snap +++ b/tests/core/snapshots/test-graphqlsource-no-base-url.md_error.snap @@ -4,7 +4,7 @@ expression: errors --- [ { - "message": "No base URL defined", + "message": "Parsing failed because of missing field `url`", "trace": [ "Post", "user", diff --git a/tests/core/snapshots/test-graphqlsource.md_merged.snap b/tests/core/snapshots/test-graphqlsource.md_merged.snap index fd97e98dee..b150aba580 100644 --- a/tests/core/snapshots/test-graphqlsource.md_merged.snap +++ b/tests/core/snapshots/test-graphqlsource.md_merged.snap @@ -2,18 +2,19 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://localhost:8000/graphql") { +schema @server @upstream { query: Query } type Post { id: Int! - user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") + user: User + @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], url: "http://localhost:8000/graphql", 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(url: "http://jsonplaceholder.typicode.com/posts/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/test-grpc.md_merged.snap b/tests/core/snapshots/test-grpc.md_merged.snap index 0266ac839f..c28e68f243 100644 --- a/tests/core/snapshots/test-grpc.md_merged.snap +++ b/tests/core/snapshots/test-grpc.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 1000}) + @upstream(batch: {delay: 10, headers: [], maxSize: 1000}) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } @@ -28,8 +28,14 @@ type NewsData { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") newsByIdBatch(news: NewsInput!): News! - @grpc(body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") + @grpc( + url: "http://localhost:50051" + body: "{{.args.news}}" + batchKey: ["news", "id"] + method: "news.NewsService.GetMultipleNews" + ) } diff --git a/tests/core/snapshots/test-hostname-faliure.md_error.snap b/tests/core/snapshots/test-hostname-faliure.md_error.snap index 2c6ac4d613..b09c446cc7 100644 --- a/tests/core/snapshots/test-hostname-faliure.md_error.snap +++ b/tests/core/snapshots/test-hostname-faliure.md_error.snap @@ -4,11 +4,12 @@ expression: errors --- [ { - "message": "Parsing failed because of invalid IP address syntax", + "message": "Parsing failed because of unknown field `path`, expected one of `onRequest`, `url`, `body`, `encoding`, `batchKey`, `headers`, `input`, `method`, `output`, `query`, `dedupe`, `select`", "trace": [ - "schema", - "@server", - "hostname" + "Query", + "user", + "@http", + "path" ], "description": null } diff --git a/tests/core/snapshots/test-http-baseurl.md_merged.snap b/tests/core/snapshots/test-http-baseurl.md_merged.snap index b4cb4e7ff2..392fb06d80 100644 --- a/tests/core/snapshots/test-http-baseurl.md_merged.snap +++ b/tests/core/snapshots/test-http-baseurl.md_merged.snap @@ -2,11 +2,11 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://abc.com") { +schema @server @upstream { query: Query } type Query { - bar: String @http(path: "/bar") - foo: String @http(baseURL: "http://foo.com", path: "/foo") + bar: String @http(url: "http://abc.com/bar") + foo: String @http(url: "http://foo.com/foo") } diff --git a/tests/core/snapshots/test-http-batchKey.md_merged.snap b/tests/core/snapshots/test-http-batchKey.md_merged.snap index 5667323ff2..9758dc57e8 100644 --- a/tests/core/snapshots/test-http-batchKey.md_merged.snap +++ b/tests/core/snapshots/test-http-batchKey.md_merged.snap @@ -2,9 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {delay: 10, headers: [], maxSize: 1000}) { +schema @server(port: 8000) @upstream(batch: {delay: 10, headers: [], maxSize: 1000}) { query: Query } @@ -17,8 +15,8 @@ type Foo { barId: String! bars: [Bar!]! @http( + url: "http://jsonplaceholder.typicode.com/bar" batchKey: ["bars", "id"] - path: "/bar" query: [{key: "baz", value: "static_value"}, {key: "barId[]", value: "{{.value.barId}}"}] ) fooName: String! @@ -30,5 +28,5 @@ type FooResponse { } type Query { - foos: FooResponse @http(path: "/foo") + foos: FooResponse @http(url: "http://jsonplaceholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-http-headers.md_merged.snap b/tests/core/snapshots/test-http-headers.md_merged.snap index 84b1c8e9a7..b092d6ce5e 100644 --- a/tests/core/snapshots/test-http-headers.md_merged.snap +++ b/tests/core/snapshots/test-http-headers.md_merged.snap @@ -2,10 +2,10 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://localhost:4000") { +schema @server @upstream { query: Query } type Query { - foo: String @http(headers: [{key: "foo", value: "bar"}], path: "/foo") + foo: String @http(url: "http://localhost:4000/foo", headers: [{key: "foo", value: "bar"}]) } diff --git a/tests/core/snapshots/test-http-tmpl.md_merged.snap b/tests/core/snapshots/test-http-tmpl.md_merged.snap index d01676880f..a6e50217a9 100644 --- a/tests/core/snapshots/test-http-tmpl.md_merged.snap +++ b/tests/core/snapshots/test-http-tmpl.md_merged.snap @@ -2,18 +2,18 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Post { id: Int - user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) + user: User @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { 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 index 21bcae482f..e5edab4670 100644 --- a/tests/core/snapshots/test-http-with-mustache-expr.md_merged.snap +++ b/tests/core/snapshots/test-http-with-mustache-expr.md_merged.snap @@ -22,5 +22,5 @@ type D { } type Query { - a: A @http(baseURL: "http://localhost:3000", path: "/a") + a: A @http(url: "http://localhost:3000/a") } diff --git a/tests/core/snapshots/test-http.md_merged.snap b/tests/core/snapshots/test-http.md_merged.snap index 447d7e4ad1..f8f0de135b 100644 --- a/tests/core/snapshots/test-http.md_merged.snap +++ b/tests/core/snapshots/test-http.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - foo: [User] @http(path: "/users") + foo: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/core/snapshots/test-inline-list.md_merged.snap b/tests/core/snapshots/test-inline-list.md_merged.snap index 262a192e99..1d80e282fe 100644 --- a/tests/core/snapshots/test-inline-list.md_merged.snap +++ b/tests/core/snapshots/test-inline-list.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,5 +19,5 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") @modify(omit: true) + foo: [Foo] @http(url: "http://jsonplaceholder.typicode.com/foo") @modify(omit: true) } diff --git a/tests/core/snapshots/test-inline.md_merged.snap b/tests/core/snapshots/test-inline.md_merged.snap index 3b0ce68918..277d53aae3 100644 --- a/tests/core/snapshots/test-inline.md_merged.snap +++ b/tests/core/snapshots/test-inline.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,5 +19,5 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") @modify(omit: true) + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") @modify(omit: true) } diff --git a/tests/core/snapshots/test-input-documentation.md_merged.snap b/tests/core/snapshots/test-input-documentation.md_merged.snap index f3dc3b8bc1..e43065e953 100644 --- a/tests/core/snapshots/test-input-documentation.md_merged.snap +++ b/tests/core/snapshots/test-input-documentation.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query mutation: Mutation } @@ -18,7 +18,8 @@ input Foo { } type Mutation { - testDocumentation(input: Foo!): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") + testDocumentation(input: Foo!): Post + @http(url: "http://jsonplaceholder.typicode.com/posts", body: "{{.args.input}}", method: "POST") } type Post { @@ -30,6 +31,6 @@ type Post { Some Documentation """ type Query { - foo: String @http(path: "/foo") - postFromFoo(id: Int!): Post @http(path: "/posts?id={{.args.id}}") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") + postFromFoo(id: Int!): Post @http(url: "http://jsonplaceholder.typicode.com/posts?id={{.args.id}}") } diff --git a/tests/core/snapshots/test-input-out.md_merged.snap b/tests/core/snapshots/test-input-out.md_merged.snap index 4c0d01274f..7e4b4b24ad 100644 --- a/tests/core/snapshots/test-input-out.md_merged.snap +++ b/tests/core/snapshots/test-input-out.md_merged.snap @@ -17,9 +17,5 @@ type MyType { type Query { queryTest(filter: Filter): [MyType] - @graphQL( - args: [{key: "filter", value: "{{.args.filter}}"}] - baseURL: "http://localhost:8083/mesh" - name: "getMyType" - ) + @graphQL(args: [{key: "filter", value: "{{.args.filter}}"}], url: "http://localhost:8083/mesh", name: "getMyType") } diff --git a/tests/core/snapshots/test-input-with-arg-out.md_merged.snap b/tests/core/snapshots/test-input-with-arg-out.md_merged.snap index a7ee131c40..c542bcf4b2 100644 --- a/tests/core/snapshots/test-input-with-arg-out.md_merged.snap +++ b/tests/core/snapshots/test-input-with-arg-out.md_merged.snap @@ -22,9 +22,5 @@ type MyType { type Query { queryTest(filter: StringFilter): [MyType] - @graphQL( - args: [{key: "filter", value: "{{.args.filter}}"}] - baseURL: "http://localhost:8083/mesh" - name: "getMyType" - ) + @graphQL(args: [{key: "filter", value: "{{.args.filter}}"}], url: "http://localhost:8083/mesh", name: "getMyType") } diff --git a/tests/core/snapshots/test-interface-from-json.md_merged.snap b/tests/core/snapshots/test-interface-from-json.md_merged.snap index cb46028480..862f3e1cf3 100644 --- a/tests/core/snapshots/test-interface-from-json.md_merged.snap +++ b/tests/core/snapshots/test-interface-from-json.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -16,5 +16,5 @@ type B implements IA { } type Query { - bar: B @http(path: "/posts") + bar: B @http(url: "http://jsonplaceholder.typicode.com/posts") } diff --git a/tests/core/snapshots/test-interface-result.md_merged.snap b/tests/core/snapshots/test-interface-result.md_merged.snap index 08ea12c1bb..98bcdf6616 100644 --- a/tests/core/snapshots/test-interface-result.md_merged.snap +++ b/tests/core/snapshots/test-interface-result.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -16,5 +16,5 @@ type B implements IA { } type Query { - bar: IA @http(path: "/user") + bar: IA @http(url: "http://jsonplaceholder.typicode.com/user") } diff --git a/tests/core/snapshots/test-interface.md_merged.snap b/tests/core/snapshots/test-interface.md_merged.snap index 1459c6697b..a501bc8b26 100644 --- a/tests/core/snapshots/test-interface.md_merged.snap +++ b/tests/core/snapshots/test-interface.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -16,5 +16,5 @@ type B implements IA { } type Query { - bar: B @http(path: "/user") + bar: B @http(url: "http://jsonplaceholder.typicode.com/user") } diff --git a/tests/core/snapshots/test-js-multi-onRequest-handlers.md_merged.snap b/tests/core/snapshots/test-js-multi-onRequest-handlers.md_merged.snap index caa7ebe40f..1a8a1467d8 100644 --- a/tests/core/snapshots/test-js-multi-onRequest-handlers.md_merged.snap +++ b/tests/core/snapshots/test-js-multi-onRequest-handlers.md_merged.snap @@ -2,11 +2,11 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(onRequest: "foo", baseURL: "http://localhost:3000") @link(src: "test1.js", type: Script) { +schema @server @upstream(onRequest: "foo") @link(src: "test1.js", type: Script) { query: Query } type Query { - bar: String @http(onRequest: "bar", baseURL: "http://localhost:3000", path: "/bar") - foo: String @http(baseURL: "http://localhost:3000", path: "/foo") + bar: String @http(onRequest: "bar", url: "http://localhost:3000/bar") + foo: String @http(url: "http://localhost:3000/foo") } diff --git a/tests/core/snapshots/test-js-request-response-2.md_merged.snap b/tests/core/snapshots/test-js-request-response-2.md_merged.snap index d29c8f77a6..adc0aea1a2 100644 --- a/tests/core/snapshots/test-js-request-response-2.md_merged.snap +++ b/tests/core/snapshots/test-js-request-response-2.md_merged.snap @@ -7,6 +7,6 @@ schema @server @upstream(onRequest: "onRequest") @link(src: "test.js", type: Scr } type Query { - hello: String @http(baseURL: "http://localhost:3000", path: "/hello") - hi: String @http(baseURL: "http://localhost:3000", path: "/hi") + hello: String @http(url: "http://localhost:3000/hello") + hi: String @http(url: "http://localhost:3000/hi") } diff --git a/tests/core/snapshots/test-js-request-response.md_merged.snap b/tests/core/snapshots/test-js-request-response.md_merged.snap index d29c8f77a6..adc0aea1a2 100644 --- a/tests/core/snapshots/test-js-request-response.md_merged.snap +++ b/tests/core/snapshots/test-js-request-response.md_merged.snap @@ -7,6 +7,6 @@ schema @server @upstream(onRequest: "onRequest") @link(src: "test.js", type: Scr } type Query { - hello: String @http(baseURL: "http://localhost:3000", path: "/hello") - hi: String @http(baseURL: "http://localhost:3000", path: "/hi") + hello: String @http(url: "http://localhost:3000/hello") + hi: String @http(url: "http://localhost:3000/hi") } diff --git a/tests/core/snapshots/test-link-support.md_merged.snap b/tests/core/snapshots/test-link-support.md_merged.snap index b0c2cce6d2..77a0d25bd1 100644 --- a/tests/core/snapshots/test-link-support.md_merged.snap +++ b/tests/core/snapshots/test-link-support.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 1000}) + @upstream(batch: {delay: 10, headers: [], maxSize: 1000}) @link(id: "news", src: "news.proto", meta: {description: "Test"}, type: Protobuf) { query: Query } @@ -22,5 +22,6 @@ type NewsData { } type Query { - newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } diff --git a/tests/core/snapshots/test-list-args.md_merged.snap b/tests/core/snapshots/test-list-args.md_merged.snap index d5f569a781..fc12f058d8 100644 --- a/tests/core/snapshots/test-list-args.md_merged.snap +++ b/tests/core/snapshots/test-list-args.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(queryValidation: true) @upstream(baseURL: "http://localhost:3000") { +schema @server(queryValidation: true) @upstream { query: Query } type Query { - f1(q: [Int!]!): T1 @http(path: "/api", query: [{key: "q", value: "{{.args.q}}"}]) + f1(q: [Int!]!): T1 @http(url: "http://localhost:3000/api", query: [{key: "q", value: "{{.args.q}}"}]) } type T1 { diff --git a/tests/core/snapshots/test-merge-input.md_merged.snap b/tests/core/snapshots/test-merge-input.md_merged.snap index 9811970ff7..6e4b03023c 100644 --- a/tests/core/snapshots/test-merge-input.md_merged.snap +++ b/tests/core/snapshots/test-merge-input.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -11,5 +11,5 @@ input Test { } type Query { - foo(x: Test): Boolean @http(path: "/foo") + foo(x: Test): Boolean @http(url: "http://jsonplaceholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-merge-nested.md_merged.snap b/tests/core/snapshots/test-merge-nested.md_merged.snap index da67f22015..52a0dab842 100644 --- a/tests/core/snapshots/test-merge-nested.md_merged.snap +++ b/tests/core/snapshots/test-merge-nested.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://abc.com") { +schema @server @upstream { query: Query } diff --git a/tests/core/snapshots/test-merge-query.md_merged.snap b/tests/core/snapshots/test-merge-query.md_merged.snap index dfe3d72ef6..6f9a054135 100644 --- a/tests/core/snapshots/test-merge-query.md_merged.snap +++ b/tests/core/snapshots/test-merge-query.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000) @upstream(baseURL: "http://abc.com", proxy: {url: "http://localhost:3000"}) { +schema @server(port: 8000) @upstream(proxy: {url: "http://localhost:3000"}) { 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 index 447d7e4ad1..f8f0de135b 100644 --- a/tests/core/snapshots/test-merge-server-sdl.md_merged.snap +++ b/tests/core/snapshots/test-merge-server-sdl.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - foo: [User] @http(path: "/users") + foo: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/core/snapshots/test-merge-union.md_merged.snap b/tests/core/snapshots/test-merge-union.md_merged.snap index 0086dae7e8..5e2242004a 100644 --- a/tests/core/snapshots/test-merge-union.md_merged.snap +++ b/tests/core/snapshots/test-merge-union.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,5 +22,5 @@ type Foo { } type Query { - foo: FooBar @http(path: "/foo") + foo: FooBar @http(url: "http://jsonplaceholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-missing-argument-on-all-resolvers.md_error.snap b/tests/core/snapshots/test-missing-argument-on-all-resolvers.md_error.snap index bd0885307f..7588998d5c 100644 --- a/tests/core/snapshots/test-missing-argument-on-all-resolvers.md_error.snap +++ b/tests/core/snapshots/test-missing-argument-on-all-resolvers.md_error.snap @@ -4,57 +4,7 @@ expression: errors --- [ { - "message": "no argument 'id' found", - "trace": [ - "Query", - "newsGrpcBody", - "@grpc", - "body" - ], - "description": null - }, - { - "message": "no argument 'id' found", - "trace": [ - "Query", - "newsGrpcHeaders", - "@grpc", - "headers" - ], - "description": null - }, - { - "message": "no argument 'url' found", - "trace": [ - "Query", - "newsGrpcUrl", - "@grpc", - "path" - ], - "description": null - }, - { - "message": "no argument 'id' found", - "trace": [ - "Query", - "postGraphQLArgs", - "@graphQL", - "args" - ], - "description": null - }, - { - "message": "no argument 'id' found", - "trace": [ - "Query", - "postGraphQLHeaders", - "@graphQL", - "headers" - ], - "description": null - }, - { - "message": "no argument 'id' found", + "message": "Parsing failed because of unknown field `path`, expected one of `onRequest`, `url`, `body`, `encoding`, `batchKey`, `headers`, `input`, `method`, `output`, `query`, `dedupe`, `select`", "trace": [ "Query", "postHttp", diff --git a/tests/core/snapshots/test-modify.md_merged.snap b/tests/core/snapshots/test-modify.md_merged.snap index bb3ba9551e..0d1e56bd20 100644 --- a/tests/core/snapshots/test-modify.md_merged.snap +++ b/tests/core/snapshots/test-modify.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -11,5 +11,5 @@ input Foo { } type Query { - foo(input: Foo): String @http(path: "/foo") @modify(name: "data") + foo(input: Foo): String @http(url: "http://jsonplaceholder.typicode.com/foo") @modify(name: "data") } diff --git a/tests/core/snapshots/test-multi-interface.md_merged.snap b/tests/core/snapshots/test-multi-interface.md_merged.snap index 3c56a1e572..f02eeafe4b 100644 --- a/tests/core/snapshots/test-multi-interface.md_merged.snap +++ b/tests/core/snapshots/test-multi-interface.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -20,5 +20,5 @@ type B implements IA & IB { } type Query { - bar: B @http(path: "/user") + bar: B @http(url: "http://jsonplaceholder.typicode.com/user") } diff --git a/tests/core/snapshots/test-nested-link.md_merged.snap b/tests/core/snapshots/test-nested-link.md_merged.snap index d7c84aeccc..02fdc7e986 100644 --- a/tests/core/snapshots/test-nested-link.md_merged.snap +++ b/tests/core/snapshots/test-nested-link.md_merged.snap @@ -4,7 +4,7 @@ expression: formatter --- schema @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") + @upstream @link(src: "graphql-with-link.graphql", type: Config) @link(src: "link-enum.graphql", type: Config) @link(src: "link-enum.graphql", type: Config) { @@ -18,13 +18,14 @@ enum Foo { type Post { id: Int! - user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") + user: User + @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], url: "http://jsonplaceholder.typicode.com", name: "user") userId: Int! } type Query { - foo: Foo @http(path: "/foo") - post(id: Int!): Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{.args.id}}") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") + post(id: Int!): Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/test-nested-value.md_merged.snap b/tests/core/snapshots/test-nested-value.md_merged.snap index bdb998bb50..dba926a18b 100644 --- a/tests/core/snapshots/test-nested-value.md_merged.snap +++ b/tests/core/snapshots/test-nested-value.md_merged.snap @@ -2,17 +2,17 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Post { id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.id}}"}]) + user: User! @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.value.user.id}}"}]) } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { diff --git a/tests/core/snapshots/test-no-base-url.md_error.snap b/tests/core/snapshots/test-no-base-url.md_error.snap index 0414d880a4..7cd87d8050 100644 --- a/tests/core/snapshots/test-no-base-url.md_error.snap +++ b/tests/core/snapshots/test-no-base-url.md_error.snap @@ -4,12 +4,8 @@ expression: errors --- [ { - "message": "No base URL defined", - "trace": [ - "Query", - "user", - "@http" - ], + "message": " --> 10:20\n |\n10 | user: User @http()\n | ^---\n |\n = expected name", + "trace": [], "description": null } ] diff --git a/tests/core/snapshots/test-null-in-array.md_merged.snap b/tests/core/snapshots/test-null-in-array.md_merged.snap index 45b9614dd5..e79c3bf609 100644 --- a/tests/core/snapshots/test-null-in-array.md_merged.snap +++ b/tests/core/snapshots/test-null-in-array.md_merged.snap @@ -12,5 +12,5 @@ type Company { } type Query { - hi(id: ID!): [Company] @http(baseURL: "http://localhost:3000", path: "/hi") + hi(id: ID!): [Company] @http(url: "http://localhost:3000/hi") } diff --git a/tests/core/snapshots/test-null-in-object.md_merged.snap b/tests/core/snapshots/test-null-in-object.md_merged.snap index ec2f9297ce..71358c0856 100644 --- a/tests/core/snapshots/test-null-in-object.md_merged.snap +++ b/tests/core/snapshots/test-null-in-object.md_merged.snap @@ -12,5 +12,5 @@ type Company { } type Query { - hi(id: ID!): Company @http(baseURL: "http://localhost:3000", path: "/hi") + hi(id: ID!): Company @http(url: "http://localhost:3000/hi") } diff --git a/tests/core/snapshots/test-omit-list.md_merged.snap b/tests/core/snapshots/test-omit-list.md_merged.snap index e8f05c459a..45b11d9668 100644 --- a/tests/core/snapshots/test-omit-list.md_merged.snap +++ b/tests/core/snapshots/test-omit-list.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,5 +19,5 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") @omit + foo: [Foo] @http(url: "http://jsonplaceholder.typicode.com/foo") @omit } diff --git a/tests/core/snapshots/test-omit.md_merged.snap b/tests/core/snapshots/test-omit.md_merged.snap index fff11d37d0..3d585c67a6 100644 --- a/tests/core/snapshots/test-omit.md_merged.snap +++ b/tests/core/snapshots/test-omit.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,5 +19,5 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") @omit + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") @omit } diff --git a/tests/core/snapshots/test-optional-key-skip-empty.md_merged.snap b/tests/core/snapshots/test-optional-key-skip-empty.md_merged.snap index e6ce3d91d8..33fe93e046 100644 --- a/tests/core/snapshots/test-optional-key-skip-empty.md_merged.snap +++ b/tests/core/snapshots/test-optional-key-skip-empty.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000) @upstream(baseURL: "http://example.com") { +schema @server(port: 8000) @upstream { query: Query } @@ -13,7 +13,7 @@ type Bar { type Foo { bar: Bar @http( - path: "/bar" + url: "http://example.com/bar" query: [{key: "tagEmpty", value: "{{.value.tag}}", skipEmpty: true}, {key: "tag", value: "{{.value.tag}}"}] ) id: Int! @@ -21,5 +21,5 @@ type Foo { } type Query { - foos: [Foo] @http(path: "/foos") + foos: [Foo] @http(url: "http://example.com/foos") } 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 4d17b597f8..3dbe617929 100644 --- a/tests/core/snapshots/test-params-as-body.md_merged.snap +++ b/tests/core/snapshots/test-params-as-body.md_merged.snap @@ -2,12 +2,13 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) @upstream { query: Query } type Query { - firstUser(id: Int, name: String): User @http(body: "{{.args}}", method: "POST", path: "/users") + firstUser(id: Int, name: String): User + @http(url: "http://jsonplaceholder.typicode.com/users", body: "{{.args}}", method: "POST") } type User { diff --git a/tests/core/snapshots/test-query-documentation.md_merged.snap b/tests/core/snapshots/test-query-documentation.md_merged.snap index 6572b1be71..fcbdb7fae6 100644 --- a/tests/core/snapshots/test-query-documentation.md_merged.snap +++ b/tests/core/snapshots/test-query-documentation.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -10,5 +10,5 @@ type Query { """ This is test """ - foo: String @http(path: "/foo") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-query.md_merged.snap b/tests/core/snapshots/test-query.md_merged.snap index e76a0f2774..93e8e8a71a 100644 --- a/tests/core/snapshots/test-query.md_merged.snap +++ b/tests/core/snapshots/test-query.md_merged.snap @@ -2,10 +2,10 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - foo: String @http(path: "/foo") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") } diff --git a/tests/core/snapshots/test-ref-other.md_merged.snap b/tests/core/snapshots/test-ref-other.md_merged.snap index 79779bc253..48e7f7cc1d 100644 --- a/tests/core/snapshots/test-ref-other.md_merged.snap +++ b/tests/core/snapshots/test-ref-other.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) @upstream { query: Query } type InPost { - get: [Post] @http(path: "/posts") + get: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type Post { diff --git a/tests/core/snapshots/test-required-fields.md_merged.snap b/tests/core/snapshots/test-required-fields.md_merged.snap index d4c5a67bb7..8bbe4199e1 100644 --- a/tests/core/snapshots/test-required-fields.md_merged.snap +++ b/tests/core/snapshots/test-required-fields.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(enableJIT: true) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(enableJIT: true) @upstream { query: Query } @@ -12,26 +12,26 @@ type Foo { } type Query { - basicFieldMissing: Foo! @http(path: "/basic-field-missing") - basicMissing: Foo! @http(path: "/basic-missing") - basicPresent: Foo! @http(path: "/basic-present") - fullEntryMissing: [Foo!]! @http(path: "/full-entry-missing") - fullFieldMissing: [Foo!]! @http(path: "/full-field-missing") - fullMissing: [Foo!]! @http(path: "/full-missing") - fullPresent: [Foo!]! @http(path: "/full-present") - innerEntryMissing: [Foo!] @http(path: "/inner-entry-missing") - innerFieldMissing: [Foo!] @http(path: "/inner-field-missing") - innerMissing: [Foo!] @http(path: "/inner-missing") - innerPresent: [Foo!] @http(path: "/inner-present") - noneEntryMissing: [Foo] @http(path: "/none-entry-missing") - noneFieldMissing: [Foo] @http(path: "/none-field-missing") - noneMissing: [Foo] @http(path: "/none-missing") - nonePresent: [Foo] @http(path: "/none-present") - outerEntryMissing: [Foo]! @http(path: "/outer-entry-missing") - outerFieldMissing: [Foo]! @http(path: "/outer-field-missing") - outerMissing: [Foo]! @http(path: "/outer-missing") - outerPresent: [Foo]! @http(path: "/outer-present") - relaxedFieldMissing: Foo @http(path: "/relaxed-field-missing") - relaxedMissing: Foo @http(path: "/relaxed-missing") - relaxedPresent: Foo @http(path: "/relaxed-present") + basicFieldMissing: Foo! @http(url: "http://jsonplaceholder.typicode.com/basic-field-missing") + basicMissing: Foo! @http(url: "http://jsonplaceholder.typicode.com/basic-missing") + basicPresent: Foo! @http(url: "http://jsonplaceholder.typicode.com/basic-present") + fullEntryMissing: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-entry-missing") + fullFieldMissing: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-field-missing") + fullMissing: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-missing") + fullPresent: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-present") + innerEntryMissing: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-entry-missing") + innerFieldMissing: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-field-missing") + innerMissing: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-missing") + innerPresent: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-present") + noneEntryMissing: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-entry-missing") + noneFieldMissing: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-field-missing") + noneMissing: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-missing") + nonePresent: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-present") + outerEntryMissing: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-entry-missing") + outerFieldMissing: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-field-missing") + outerMissing: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-missing") + outerPresent: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-present") + relaxedFieldMissing: Foo @http(url: "http://jsonplaceholder.typicode.com/relaxed-field-missing") + relaxedMissing: Foo @http(url: "http://jsonplaceholder.typicode.com/relaxed-missing") + relaxedPresent: Foo @http(url: "http://jsonplaceholder.typicode.com/relaxed-present") } diff --git a/tests/core/snapshots/test-server-base-types.md_merged.snap b/tests/core/snapshots/test-server-base-types.md_merged.snap index 3eeefd92f2..28376478fc 100644 --- a/tests/core/snapshots/test-server-base-types.md_merged.snap +++ b/tests/core/snapshots/test-server-base-types.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(port: 8000) @upstream(baseURL: "http://abc.com", proxy: {url: "http://localhost:3000"}) { +schema @server(port: 8000) @upstream(proxy: {url: "http://localhost:3000"}) { query: Query } diff --git a/tests/core/snapshots/test-server-vars.md_merged.snap b/tests/core/snapshots/test-server-vars.md_merged.snap index a1dbdc9cf1..c321e56517 100644 --- a/tests/core/snapshots/test-server-vars.md_merged.snap +++ b/tests/core/snapshots/test-server-vars.md_merged.snap @@ -2,10 +2,10 @@ source: tests/core/spec.rs expression: formatter --- -schema @server(vars: [{key: "foo", value: "bar"}]) @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server(vars: [{key: "foo", value: "bar"}]) @upstream { query: Query } type Query { - foo: String @http(path: "/foo") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") } 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 c88f3e4b3a..963ab3bb14 100644 --- a/tests/core/snapshots/test-set-cookie-headers.md_merged.snap +++ b/tests/core/snapshots/test-set-cookie-headers.md_merged.snap @@ -2,14 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema - @server(headers: {setCookies: 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 { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/test-static-value.md_merged.snap b/tests/core/snapshots/test-static-value.md_merged.snap index 2e76b7a821..8868c6973d 100644 --- a/tests/core/snapshots/test-static-value.md_merged.snap +++ b/tests/core/snapshots/test-static-value.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - firstUser: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + firstUser: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/test-union-ambiguous.md_merged.snap b/tests/core/snapshots/test-union-ambiguous.md_merged.snap index 51cfb79d9d..0aeaeec408 100644 --- a/tests/core/snapshots/test-union-ambiguous.md_merged.snap +++ b/tests/core/snapshots/test-union-ambiguous.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -27,11 +27,11 @@ type Nested { } type Query { - arr: [FooBarBaz] @http(path: "/arr") - bar: FooBarBaz @http(path: "/bar") - foo: FooBarBaz @http(path: "/foo") - nested: Nested @http(path: "/nested") - string: FooBarBaz @http(path: "/string") - unknown: FooBarBaz @http(path: "/unknown") - wrong: FooBarBaz @http(path: "/wrong") + arr: [FooBarBaz] @http(url: "http://jsonplaceholder.typicode.com/arr") + bar: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/bar") + foo: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/foo") + nested: Nested @http(url: "http://jsonplaceholder.typicode.com/nested") + string: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/string") + unknown: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/unknown") + wrong: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/wrong") } diff --git a/tests/core/snapshots/test-union.md_merged.snap b/tests/core/snapshots/test-union.md_merged.snap index 185b8c96be..b1a3657093 100644 --- a/tests/core/snapshots/test-union.md_merged.snap +++ b/tests/core/snapshots/test-union.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,9 +22,9 @@ type Nested { } type Query { - arr: [FooBar] @http(path: "/arr") - bar: FooBar @http(path: "/bar") - foo: FooBar @http(path: "/foo") - nested: Nested @http(path: "/nested") - unknown: FooBar @http(path: "/unknown") + arr: [FooBar] @http(url: "http://jsonplaceholder.typicode.com/arr") + bar: FooBar @http(url: "http://jsonplaceholder.typicode.com/bar") + foo: FooBar @http(url: "http://jsonplaceholder.typicode.com/foo") + nested: Nested @http(url: "http://jsonplaceholder.typicode.com/nested") + unknown: FooBar @http(url: "http://jsonplaceholder.typicode.com/unknown") } diff --git a/tests/core/snapshots/test-upstream-headers.md_merged.snap b/tests/core/snapshots/test-upstream-headers.md_merged.snap index 1a0e9bfa1c..5f295cf41b 100644 --- a/tests/core/snapshots/test-upstream-headers.md_merged.snap +++ b/tests/core/snapshots/test-upstream-headers.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(allowedHeaders: ["X-bar", "x-foo"], baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream(allowedHeaders: ["X-bar", "x-foo"]) { query: Query } @@ -11,5 +11,5 @@ type Post { } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } diff --git a/tests/core/snapshots/test-upstream.md_merged.snap b/tests/core/snapshots/test-upstream.md_merged.snap index 9faeb9dade..7ff7dd576d 100644 --- a/tests/core/snapshots/test-upstream.md_merged.snap +++ b/tests/core/snapshots/test-upstream.md_merged.snap @@ -7,5 +7,5 @@ schema @server @upstream(proxy: {url: "http://localhost:8085"}) { } type Query { - hello: String @http(baseURL: "http://localhost:8000", path: "/hello") + hello: String @http(url: "http://localhost:8000/hello") } diff --git a/tests/core/snapshots/undeclared-type-no-base-url.md_error.snap b/tests/core/snapshots/undeclared-type-no-base-url.md_error.snap index ac8d461198..fe591d2f33 100644 --- a/tests/core/snapshots/undeclared-type-no-base-url.md_error.snap +++ b/tests/core/snapshots/undeclared-type-no-base-url.md_error.snap @@ -10,14 +10,5 @@ expression: errors "users" ], "description": null - }, - { - "message": "No base URL defined", - "trace": [ - "Query", - "users", - "@http" - ], - "description": null } ] diff --git a/tests/core/snapshots/upstream-batching.md_merged.snap b/tests/core/snapshots/upstream-batching.md_merged.snap index b1cc966d58..dba73d283f 100644 --- a/tests/core/snapshots/upstream-batching.md_merged.snap +++ b/tests/core/snapshots/upstream-batching.md_merged.snap @@ -9,9 +9,8 @@ schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { type Query { user(id: Int): User @http( - baseURL: "http://jsonplaceholder.typicode.com" + url: "http://jsonplaceholder.typicode.com/users" batchKey: ["id"] - path: "/users" query: [{key: "id", value: "{{.args.id}}"}] ) } diff --git a/tests/core/snapshots/upstream-fail-request.md_merged.snap b/tests/core/snapshots/upstream-fail-request.md_merged.snap index e12fd345b7..9a8bef2a99 100644 --- a/tests/core/snapshots/upstream-fail-request.md_merged.snap +++ b/tests/core/snapshots/upstream-fail-request.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/core/snapshots/with-args-url.md_merged.snap b/tests/core/snapshots/with-args-url.md_merged.snap index 8ae9dcc576..69c4cb9235 100644 --- a/tests/core/snapshots/with-args-url.md_merged.snap +++ b/tests/core/snapshots/with-args-url.md_merged.snap @@ -2,12 +2,12 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/core/snapshots/with-args.md_merged.snap b/tests/core/snapshots/with-args.md_merged.snap index b73ee87968..990055f2aa 100644 --- a/tests/core/snapshots/with-args.md_merged.snap +++ b/tests/core/snapshots/with-args.md_merged.snap @@ -8,7 +8,7 @@ schema @server @upstream { type Query { user(id: Int!): [User] - @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) + @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/core/snapshots/with-nesting.md_merged.snap b/tests/core/snapshots/with-nesting.md_merged.snap index c6d1d7e333..2c33d69af6 100644 --- a/tests/core/snapshots/with-nesting.md_merged.snap +++ b/tests/core/snapshots/with-nesting.md_merged.snap @@ -2,7 +2,7 @@ source: tests/core/spec.rs expression: formatter --- -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -14,7 +14,7 @@ type Post { } type Query { - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { @@ -22,7 +22,7 @@ type User { id: Int! name: String! phone: String - posts: [Post] @http(path: "/users/{{.value.id}}/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.id}}/posts") username: String! website: String } diff --git a/tests/core/snapshots/yaml-nested-unions.md_merged.snap b/tests/core/snapshots/yaml-nested-unions.md_merged.snap index 83cce7ef35..e9ebca71ad 100644 --- a/tests/core/snapshots/yaml-nested-unions.md_merged.snap +++ b/tests/core/snapshots/yaml-nested-unions.md_merged.snap @@ -34,11 +34,11 @@ union U1 = T1 | T2 | T3 union U2 = T3 | T4 type Query { - testVar0(u: T1Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar1(u: T2Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar2(u: T3Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar3(u: T4Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") - testVar4(u: T5Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}") + testVar0(u: T1Input!): U @http(url: "http://localhost/users/{{args.u}}") + testVar1(u: T2Input!): U @http(url: "http://localhost/users/{{args.u}}") + testVar2(u: T3Input!): U @http(url: "http://localhost/users/{{args.u}}") + testVar3(u: T4Input!): U @http(url: "http://localhost/users/{{args.u}}") + testVar4(u: T5Input!): U @http(url: "http://localhost/users/{{args.u}}") } type T1 { diff --git a/tests/core/snapshots/yaml-union-in-type.md_merged.snap b/tests/core/snapshots/yaml-union-in-type.md_merged.snap index 75f49f1e71..6d07e24486 100644 --- a/tests/core/snapshots/yaml-union-in-type.md_merged.snap +++ b/tests/core/snapshots/yaml-union-in-type.md_merged.snap @@ -66,15 +66,15 @@ type NU { } type Query { - testVar0Var0(nu: NU__u0!, nnu: NNU__nu0): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar0Var1(nu: NU__u0!, nnu: NNU__nu1): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar0Var2(nu: NU__u0!, nnu: NNU__nu2): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar1Var0(nu: NU__u1!, nnu: NNU__nu0): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar1Var1(nu: NU__u1!, nnu: NNU__nu1): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar1Var2(nu: NU__u1!, nnu: NNU__nu2): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar2Var0(nu: NU__u2!, nnu: NNU__nu0): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar2Var1(nu: NU__u2!, nnu: NNU__nu1): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") - testVar2Var2(nu: NU__u2!, nnu: NNU__nu2): U @http(baseURL: "http://localhost", path: "/users/{{args.nu.u}}") + testVar0Var0(nu: NU__u0!, nnu: NNU__nu0): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar0Var1(nu: NU__u0!, nnu: NNU__nu1): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar0Var2(nu: NU__u0!, nnu: NNU__nu2): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar1Var0(nu: NU__u1!, nnu: NNU__nu0): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar1Var1(nu: NU__u1!, nnu: NNU__nu1): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar1Var2(nu: NU__u1!, nnu: NNU__nu2): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar2Var0(nu: NU__u2!, nnu: NNU__nu0): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar2Var1(nu: NU__u2!, nnu: NNU__nu1): U @http(url: "http://localhost/users/{{args.nu.u}}") + testVar2Var2(nu: NU__u2!, nnu: NNU__nu2): U @http(url: "http://localhost/users/{{args.nu.u}}") } type T1 { diff --git a/tests/core/snapshots/yaml-union.md_merged.snap b/tests/core/snapshots/yaml-union.md_merged.snap index 176c4970dc..b2288bc17a 100644 --- a/tests/core/snapshots/yaml-union.md_merged.snap +++ b/tests/core/snapshots/yaml-union.md_merged.snap @@ -30,9 +30,9 @@ type NU { } type Query { - testVar0(u: T1Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}/") - testVar1(u: T2Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}/") - testVar2(u: T3Input!): U @http(baseURL: "http://localhost", path: "/users/{{args.u}}/") + testVar0(u: T1Input!): U @http(url: "http://localhost/users/{{args.u}}/") + testVar1(u: T2Input!): U @http(url: "http://localhost/users/{{args.u}}/") + testVar2(u: T3Input!): U @http(url: "http://localhost/users/{{args.u}}/") } type T1 { diff --git a/tests/execution/add-field-index-list.md b/tests/execution/add-field-index-list.md index 3985b7ae5d..da99c87b88 100644 --- a/tests/execution/add-field-index-list.md +++ b/tests/execution/add-field-index-list.md @@ -10,7 +10,7 @@ type User { } type Query @addField(name: "username", path: ["users", "0", "name"]) { - users: [User] @http(path: "/users", baseURL: "http://jsonplaceholder.typicode.com") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } ``` diff --git a/tests/execution/add-field-many-list.md b/tests/execution/add-field-many-list.md index 8720f0ee4a..26116300b9 100644 --- a/tests/execution/add-field-many-list.md +++ b/tests/execution/add-field-many-list.md @@ -16,7 +16,7 @@ type A { } type Query { - u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") + u: U @http(url: "http://jsonplaceholder.typicode.com/us/1") } type U diff --git a/tests/execution/add-field-many.md b/tests/execution/add-field-many.md index 588afa186e..659262f768 100644 --- a/tests/execution/add-field-many.md +++ b/tests/execution/add-field-many.md @@ -18,7 +18,7 @@ type Foo } type Query { - user: Foo @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: Foo @http(url: "http://jsonplaceholder.typicode.com/users/1") } type X { diff --git a/tests/execution/add-field-modify.md b/tests/execution/add-field-modify.md index f444c623e8..3f70a90066 100644 --- a/tests/execution/add-field-modify.md +++ b/tests/execution/add-field-modify.md @@ -20,7 +20,7 @@ type Address { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/add-field-with-composition.md b/tests/execution/add-field-with-composition.md index a098cb0aab..64979661e8 100644 --- a/tests/execution/add-field-with-composition.md +++ b/tests/execution/add-field-with-composition.md @@ -22,7 +22,7 @@ type Geo { type Query @addField(name: "lat", path: ["user", "address", "geo", "lat"]) @addField(name: "lng", path: ["user", "address", "geo", "lng"]) { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/add-field-with-modify.md b/tests/execution/add-field-with-modify.md index 933e921ae1..8bce563368 100644 --- a/tests/execution/add-field-with-modify.md +++ b/tests/execution/add-field-with-modify.md @@ -9,8 +9,8 @@ type User { name: String } type Query @addField(name: "user1", path: ["person1", "name"]) @addField(name: "user2", path: ["person2", "name"]) { - person1: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") - person2: User @http(path: "/users/2", baseURL: "http://jsonplaceholder.typicode.com") + person1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") + person2: User @http(url: "http://jsonplaceholder.typicode.com/users/2") } ``` diff --git a/tests/execution/add-field.md b/tests/execution/add-field.md index 754c70fc1e..e25e63cf3d 100644 --- a/tests/execution/add-field.md +++ b/tests/execution/add-field.md @@ -18,7 +18,7 @@ type Geo { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/apollo-federation-entities-batch.md b/tests/execution/apollo-federation-entities-batch.md index fcedf30e18..ce3d2549af 100644 --- a/tests/execution/apollo-federation-entities-batch.md +++ b/tests/execution/apollo-federation-entities-batch.md @@ -1,23 +1,26 @@ # Apollo federation query for batching resolvers ```graphql @config -schema - @server(port: 8000, enableFederation: true) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000, enableFederation: true) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } -type User @http(path: "/users", query: [{key: "id", value: "{{.value.id}}"}], batchKey: ["id"]) { +type User + @http( + url: "http://jsonplaceholder.typicode.com/users" + query: [{key: "id", value: "{{.value.id}}"}] + batchKey: ["id"] + ) { id: Int! name: String! } type Post - @graphQL(baseURL: "http://upstream/graphql", batch: true, name: "post", args: [{key: "id", value: "{{.value.id}}"}]) { + @graphQL(url: "http://upstream/graphql", batch: true, name: "post", args: [{key: "id", value: "{{.value.id}}"}]) { id: Int! title: String! } diff --git a/tests/execution/apollo-federation-entities-validation.md b/tests/execution/apollo-federation-entities-validation.md index facf7058d9..ff964ba958 100644 --- a/tests/execution/apollo-federation-entities-validation.md +++ b/tests/execution/apollo-federation-entities-validation.md @@ -5,14 +5,12 @@ error: true # Apollo federation query validation ```graphql @config -schema - @server(port: 8000, enableFederation: true) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000, enableFederation: true) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User @call(steps: [{query: "user", args: {id: "{{.args.id}}"}}]) { @@ -20,7 +18,7 @@ type User @call(steps: [{query: "user", args: {id: "{{.args.id}}"}}]) { name: String! } -type Post @http(path: "/posts", query: [{key: "id", value: "{{.args.id}}"}]) { +type Post @http(url: "http://jsonplaceholder.typicode.com/posts", query: [{key: "id", value: "{{.args.id}}"}]) { id: Int! title: String! } diff --git a/tests/execution/apollo-federation-entities.md b/tests/execution/apollo-federation-entities.md index 2bd70d6ffe..d4f15f348c 100644 --- a/tests/execution/apollo-federation-entities.md +++ b/tests/execution/apollo-federation-entities.md @@ -3,13 +3,13 @@ ```graphql @config schema @server(port: 8000, enableFederation: true) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) + @upstream(httpCache: 42, batch: {delay: 100}) @link(src: "./posts.graphql") { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User @call(steps: [{query: "user", args: {id: "{{.value.id}}"}}]) { diff --git a/tests/execution/apollo-tracing.md b/tests/execution/apollo-tracing.md index 8d49d91742..e13fc7d460 100644 --- a/tests/execution/apollo-tracing.md +++ b/tests/execution/apollo-tracing.md @@ -8,7 +8,7 @@ schema } type Query { - hello: String! @http(path: "/", baseURL: "http://api.com") + hello: String! @http(url: "http://api.com/") } ``` diff --git a/tests/execution/async-cache-disabled.md b/tests/execution/async-cache-disabled.md index f5d299822e..9abd1a626c 100644 --- a/tests/execution/async-cache-disabled.md +++ b/tests/execution/async-cache-disabled.md @@ -1,12 +1,12 @@ # Async Cache Disabled ```graphql @config -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) { query: Query } type Query { - posts: Post @http(path: "/post?id=1") + posts: Post @http(url: "http://jsonplaceholder.typicode.com/post?id=1") } type Post { @@ -14,7 +14,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } type User { diff --git a/tests/execution/async-cache-enable-multiple-resolvers.md b/tests/execution/async-cache-enable-multiple-resolvers.md index 8722629446..00d2830902 100644 --- a/tests/execution/async-cache-enable-multiple-resolvers.md +++ b/tests/execution/async-cache-enable-multiple-resolvers.md @@ -1,12 +1,12 @@ # Async Cache Enabled ```graphql @config -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type Post { @@ -14,8 +14,8 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{.value.userId}}", dedupe: true) - taggedUsers: [User] @http(path: "/taggedUsers/{{.value.id}}", dedupe: true) + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}", dedupe: true) + taggedUsers: [User] @http(url: "http://jsonplaceholder.typicode.com/taggedUsers/{{.value.id}}", dedupe: true) } type User { diff --git a/tests/execution/async-cache-enabled.md b/tests/execution/async-cache-enabled.md index f0a2544751..668b915ca6 100644 --- a/tests/execution/async-cache-enabled.md +++ b/tests/execution/async-cache-enabled.md @@ -1,12 +1,12 @@ # Async Cache Enabled ```graphql @config -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type Post { @@ -14,7 +14,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{.value.userId}}", dedupe: true) + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}", dedupe: true) } type User { diff --git a/tests/execution/async-cache-global.md b/tests/execution/async-cache-global.md index ee9744100d..eed25e3497 100644 --- a/tests/execution/async-cache-global.md +++ b/tests/execution/async-cache-global.md @@ -1,12 +1,12 @@ # Async Cache Inflight Enabled ```graphql @config -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type Post { diff --git a/tests/execution/async-cache-inflight-request.md b/tests/execution/async-cache-inflight-request.md index 0f10e19fb6..56e28bd3b6 100644 --- a/tests/execution/async-cache-inflight-request.md +++ b/tests/execution/async-cache-inflight-request.md @@ -1,12 +1,12 @@ # Async Cache Inflight and InRequest ```graphql @config -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type Post { @@ -14,7 +14,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{.value.userId}}", dedupe: true) + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}", dedupe: true) } type User { diff --git a/tests/execution/auth-basic.md b/tests/execution/auth-basic.md index e0abc43c27..a1d370a42b 100644 --- a/tests/execution/auth-basic.md +++ b/tests/execution/auth-basic.md @@ -14,7 +14,7 @@ type Query { } type Mutation { - protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") + protectedType: ProtectedType @http(url: "http://upstream/protected") } type Nested { diff --git a/tests/execution/auth-jwt.md b/tests/execution/auth-jwt.md index 0fa2951011..4cc16e1f76 100644 --- a/tests/execution/auth-jwt.md +++ b/tests/execution/auth-jwt.md @@ -14,7 +14,7 @@ type Query { } type Mutation { - protectedType: ProtectedType @http(baseURL: "http://upstream", path: "/protected") + protectedType: ProtectedType @http(url: "http://upstream/protected") } type Nested { diff --git a/tests/execution/batching-default.md b/tests/execution/batching-default.md index 83f8225d05..0b1271c631 100644 --- a/tests/execution/batching-default.md +++ b/tests/execution/batching-default.md @@ -1,12 +1,12 @@ # Batching default ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 10}) { +schema @server @upstream(httpCache: 42, batch: {delay: 10}) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type Post { @@ -16,7 +16,7 @@ type Post { userId: Int! user: User @http( - path: "/users" + url: "http://jsonplaceholder.typicode.com/users" query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] batchKey: ["id"] ) diff --git a/tests/execution/batching-disabled.md b/tests/execution/batching-disabled.md index e14029cc6d..d95145be48 100644 --- a/tests/execution/batching-disabled.md +++ b/tests/execution/batching-disabled.md @@ -4,7 +4,6 @@ { "server": {}, "upstream": { - "baseURL": "http://jsonplaceholder.typicode.com", "httpCache": 42, "batch": { "maxSize": 100, @@ -31,7 +30,7 @@ } }, "http": { - "path": "/users/{{.args.id}}" + "url": "http://jsonplaceholder.typicode.com/users/{{.args.id}}" }, "cache": null } diff --git a/tests/execution/batching-group-by-default.md b/tests/execution/batching-group-by-default.md index ec369b70e2..178fb487df 100644 --- a/tests/execution/batching-group-by-default.md +++ b/tests/execution/batching-group-by-default.md @@ -1,14 +1,12 @@ # Batching group by default ```graphql @config -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 1, maxSize: 1000}) { +schema @server @upstream(httpCache: 42, batch: {delay: 1, maxSize: 1000}) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type Post { @@ -19,7 +17,7 @@ type Post { user: User @http( batchKey: ["id"] - path: "/users" + url: "http://jsonplaceholder.typicode.com/users" query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] ) } diff --git a/tests/execution/batching-group-by-optional-key.md b/tests/execution/batching-group-by-optional-key.md index a07fddb9ab..6bb613d256 100644 --- a/tests/execution/batching-group-by-optional-key.md +++ b/tests/execution/batching-group-by-optional-key.md @@ -1,14 +1,12 @@ # Batching group by ```graphql @config -schema - @server(port: 8000, queryValidation: false) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 1, maxSize: 1000}) { +schema @server(port: 8000, queryValidation: false) @upstream(httpCache: 42, batch: {delay: 1, maxSize: 1000}) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type Post { @@ -18,7 +16,7 @@ type Post { userId: Int user: User @http( - path: "/users" + url: "http://jsonplaceholder.typicode.com/users" query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] batchKey: ["id"] ) diff --git a/tests/execution/batching-group-by.md b/tests/execution/batching-group-by.md index c2469cae71..a7775f6470 100644 --- a/tests/execution/batching-group-by.md +++ b/tests/execution/batching-group-by.md @@ -1,14 +1,12 @@ # Batching group by ```graphql @config -schema - @server(port: 8000, queryValidation: false) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 1, maxSize: 1000}) { +schema @server(port: 8000, queryValidation: false) @upstream(httpCache: 42, batch: {delay: 1, maxSize: 1000}) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=11&id=3&foo=1") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=11&id=3&foo=1") } type Post { @@ -18,7 +16,7 @@ type Post { userId: Int! user: User @http( - path: "/users" + url: "http://jsonplaceholder.typicode.com/users" query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] batchKey: ["id"] ) diff --git a/tests/execution/batching-post.md b/tests/execution/batching-post.md index b2426a32fd..336f61287d 100644 --- a/tests/execution/batching-post.md +++ b/tests/execution/batching-post.md @@ -3,16 +3,12 @@ ```graphql @config schema @server(port: 8000, queryValidation: false) - @upstream( - httpCache: 42 - batch: {maxSize: 1000, delay: 1, headers: []} - baseURL: "http://jsonplaceholder.typicode.com" - ) { + @upstream(httpCache: 42, batch: {maxSize: 1000, delay: 1, headers: []}) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=1") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1") } type Post { @@ -20,7 +16,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } type User { diff --git a/tests/execution/batching.md b/tests/execution/batching.md index 5dd3b44e57..648266d6bc 100644 --- a/tests/execution/batching.md +++ b/tests/execution/batching.md @@ -17,8 +17,7 @@ "name": "User" }, "http": { - "path": "/users/1", - "baseURL": "http://jsonplaceholder.typicode.com" + "url": "http://jsonplaceholder.typicode.com/users/1" }, "cache": null } diff --git a/tests/execution/cache-control.md b/tests/execution/cache-control.md index e974722e5f..130452cd04 100644 --- a/tests/execution/cache-control.md +++ b/tests/execution/cache-control.md @@ -26,14 +26,13 @@ } }, "http": { - "path": "/users", + "url": "http://jsonplaceholder.typicode.com/users", "query": [ { "key": "id", "value": "{{.args.id}}" } - ], - "baseURL": "http://jsonplaceholder.typicode.com" + ] }, "cache": null } diff --git a/tests/execution/caching-collision.md b/tests/execution/caching-collision.md index 3aeb69ee4c..fa378cfcac 100644 --- a/tests/execution/caching-collision.md +++ b/tests/execution/caching-collision.md @@ -1,12 +1,12 @@ # Caching Collision ```graphql @config -schema @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) { +schema @upstream(batch: {delay: 1, maxSize: 1000}) { query: Query } type Query @cache(maxAge: 100) { - bars: [Bar] @http(path: "/bars") + bars: [Bar] @http(url: "http://example.com/bars") } type Foo { @@ -15,7 +15,7 @@ type Foo { type Bar { id: String! - foo: Foo @http(path: "/foo?id={{.value.id}}") @cache(maxAge: 300) + foo: Foo @http(url: "http://example.com/foo?id={{.value.id}}") @cache(maxAge: 300) } ``` diff --git a/tests/execution/caching.md b/tests/execution/caching.md index 04e57f382f..96d56aaaca 100644 --- a/tests/execution/caching.md +++ b/tests/execution/caching.md @@ -1,13 +1,13 @@ # Caching ```graphql @config -schema @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) { +schema @upstream(batch: {delay: 1, 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) + fieldCache: Type @http(url: "http://example.com/field-cache") @cache(maxAge: 30000) + fieldCacheList: [Type] @http(url: "http://example.com/field-cache-list") @cache(maxAge: 30000) typeCache: TypeCache } @@ -16,9 +16,9 @@ type Type { } 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") + a: Type @http(url: "http://example.com/type-cache-a") + b: Type @http(url: "http://example.com/type-cache-b") + list: [Type] @http(url: "http://example.com/type-cache-list") } ``` diff --git a/tests/execution/call-graphql-datasource.md b/tests/execution/call-graphql-datasource.md index 4a840b5b64..06fca0df99 100644 --- a/tests/execution/call-graphql-datasource.md +++ b/tests/execution/call-graphql-datasource.md @@ -1,16 +1,14 @@ # Call operator with graphQL datasource ```graphql @config -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") user(id: Int!): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/call-mutation.md b/tests/execution/call-mutation.md index cf68e14028..109a86eee2 100644 --- a/tests/execution/call-mutation.md +++ b/tests/execution/call-mutation.md @@ -1,7 +1,7 @@ # Call mutation ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query mutation: Mutation } @@ -22,14 +22,23 @@ type Mutation { attachPostToFirstUser(postId: Int!): User @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" + url: "http://jsonplaceholder.typicode.com/users/{{.args.userId}}" + ) + insertPost(input: PostInput): Post + @http(body: "{{.args.input}}", method: "POST", url: "http://jsonplaceholder.typicode.com/posts") insertPostToFirstUser(input: PostInputWithoutUserId): Post @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" + url: "http://jsonplaceholder.typicode.com/users/{{.args.userId}}/posts" + ) } type Post { @@ -40,8 +49,8 @@ type Post { } type Query { - firstUser: User @http(method: "GET", path: "/users/1") - postFromUser(userId: Int!): Post @http(path: "/posts?userId={{.args.userId}}") + firstUser: User @http(method: "GET", url: "http://jsonplaceholder.typicode.com/users/1") + postFromUser(userId: Int!): Post @http(url: "http://jsonplaceholder.typicode.com/posts?userId={{.args.userId}}") } type User { diff --git a/tests/execution/call-operator.md b/tests/execution/call-operator.md index be78183c38..ce1a1bde90 100644 --- a/tests/execution/call-operator.md +++ b/tests/execution/call-operator.md @@ -39,28 +39,31 @@ message NewsList { ```graphql @config schema @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) + @upstream(httpCache: 42) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } 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}}"}]) - 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}}"}]) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") + userPosts(id: ID!): [Post] + @http(url: "http://jsonplaceholder.typicode.com/posts", query: [{key: "userId", value: "{{.args.id}}"}]) + user1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") + userFromValue: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") + userHttpHeaders(id: ID!): User + @http(url: "http://jsonplaceholder.typicode.com/users", headers: [{key: "id", value: "{{.args.id}}"}]) + userHttpQuery(id: ID!): User + @http(url: "http://jsonplaceholder.typicode.com/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(url: "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}}"}]) - userWithPosts: UserWithPosts @http(path: "/users/1") - news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") + @graphQL(url: "http://upstream/graphql", name: "user", headers: [{key: "id", value: "{{.args.id}}"}]) + userWithPosts: UserWithPosts @http(url: "http://jsonplaceholder.typicode.com/users/1") + news: NewsData! @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:50051") newsWithPortArg(port: Int!): NewsData! - @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:{{.args.port}}") + @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:{{.args.port}}") } type NewsData { diff --git a/tests/execution/cors-allow-cred-false.md b/tests/execution/cors-allow-cred-false.md index 055beac4ff..c99f979190 100644 --- a/tests/execution/cors-allow-cred-false.md +++ b/tests/execution/cors-allow-cred-false.md @@ -2,7 +2,7 @@ ```graphql @config schema - @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) + @upstream(batch: {delay: 1, maxSize: 1000}) @server( headers: { cors: { diff --git a/tests/execution/cors-allow-cred-true.md b/tests/execution/cors-allow-cred-true.md index 1c570f6b14..4afbed4c5e 100644 --- a/tests/execution/cors-allow-cred-true.md +++ b/tests/execution/cors-allow-cred-true.md @@ -2,7 +2,7 @@ ```graphql @config schema - @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) + @upstream(batch: {delay: 1, maxSize: 1000}) @server( headers: { cors: { diff --git a/tests/execution/cors-allow-cred-vary.md b/tests/execution/cors-allow-cred-vary.md index cfc2f33e1b..cf67c41d68 100644 --- a/tests/execution/cors-allow-cred-vary.md +++ b/tests/execution/cors-allow-cred-vary.md @@ -2,7 +2,7 @@ ```graphql @config schema - @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) + @upstream(batch: {delay: 1, maxSize: 1000}) @server( headers: { cors: { diff --git a/tests/execution/cors-invalid-expose-headers.md b/tests/execution/cors-invalid-expose-headers.md index 6eb6c58a17..ca84768eb2 100644 --- a/tests/execution/cors-invalid-expose-headers.md +++ b/tests/execution/cors-invalid-expose-headers.md @@ -6,7 +6,7 @@ error: true ```graphql @config schema - @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) + @upstream(batch: {delay: 1, maxSize: 1000}) @server(headers: {cors: {allowCredentials: true, exposeHeaders: ["*"], allowMethods: [POST, OPTIONS]}}) { query: Query } diff --git a/tests/execution/cors-invalid-headers.md b/tests/execution/cors-invalid-headers.md index 23e5d03e11..d303b23608 100644 --- a/tests/execution/cors-invalid-headers.md +++ b/tests/execution/cors-invalid-headers.md @@ -6,7 +6,7 @@ error: true ```graphql @config schema - @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) + @upstream(batch: {delay: 1, maxSize: 1000}) @server(headers: {cors: {allowCredentials: true, allowHeaders: ["*"], allowMethods: [POST, OPTIONS]}}) { query: Query } diff --git a/tests/execution/cors-invalid-methods.md b/tests/execution/cors-invalid-methods.md index ed1eeddb7d..8a21a3ba4e 100644 --- a/tests/execution/cors-invalid-methods.md +++ b/tests/execution/cors-invalid-methods.md @@ -5,9 +5,7 @@ error: true # Cors invalid allowMethods ```graphql @config -schema - @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) - @server(headers: {cors: {allowCredentials: true}}) { +schema @upstream(batch: {delay: 1, maxSize: 1000}) @server(headers: {cors: {allowCredentials: true}}) { query: Query } diff --git a/tests/execution/cors-invalid-origins.md b/tests/execution/cors-invalid-origins.md index 8c11efe4f8..e0aab6a8e5 100644 --- a/tests/execution/cors-invalid-origins.md +++ b/tests/execution/cors-invalid-origins.md @@ -6,7 +6,7 @@ error: true ```graphql @config schema - @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) + @upstream(batch: {delay: 1, maxSize: 1000}) @server(headers: {cors: {allowCredentials: true, allowOrigins: ["*"], allowMethods: [POST, OPTIONS]}}) { query: Query } diff --git a/tests/execution/dedupe_batch_query_execution.md b/tests/execution/dedupe_batch_query_execution.md index ee9744100d..eed25e3497 100644 --- a/tests/execution/dedupe_batch_query_execution.md +++ b/tests/execution/dedupe_batch_query_execution.md @@ -1,12 +1,12 @@ # Async Cache Inflight Enabled ```graphql @config -schema @server(port: 8000, queryValidation: false) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, queryValidation: false) { query: Query } type Query { - posts: [Post] @http(path: "/posts?id=1", dedupe: true) + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts?id=1", dedupe: true) } type Post { diff --git a/tests/execution/default-value-arg.md b/tests/execution/default-value-arg.md index a1735e2929..b7af7aa22a 100644 --- a/tests/execution/default-value-arg.md +++ b/tests/execution/default-value-arg.md @@ -1,12 +1,12 @@ # default value for input Type ```graphql @config -schema @upstream(baseURL: "http://abc.com") { +schema { query: Query } type Query { - bar(input: Input = {id: 1}): Int @http(path: "/bar/{{.args.input.id}}") + bar(input: Input = {id: 1}): Int @http(url: "http://abc.com/bar/{{.args.input.id}}") } input Input { diff --git a/tests/execution/default-value-config.md b/tests/execution/default-value-config.md index 865a2a4ff7..e64167835b 100644 --- a/tests/execution/default-value-config.md +++ b/tests/execution/default-value-config.md @@ -1,13 +1,13 @@ # default value for input Type ```graphql @config -schema @upstream(baseURL: "http://abc.com") { +schema { query: Query } type Query { - foo(input: Input!): Int @http(path: "/foo/{{.args.input.id}}") - bar(input: Input = {id: 3}): Int @http(path: "/foo/{{.args.input.id}}") + foo(input: Input!): Int @http(url: "http://abc.com/foo/{{.args.input.id}}") + bar(input: Input = {id: 3}): Int @http(url: "http://abc.com/foo/{{.args.input.id}}") } input Input { diff --git a/tests/execution/env-value.md b/tests/execution/env-value.md index 6f9b412a2d..15a1ee7862 100644 --- a/tests/execution/env-value.md +++ b/tests/execution/env-value.md @@ -3,9 +3,6 @@ ```json @config { "server": {}, - "upstream": { - "baseURL": "http://jsonplaceholder.typicode.com" - }, "schema": { "query": "Query" }, @@ -47,7 +44,7 @@ "name": "Post" }, "http": { - "path": "/posts/{{.env.ID}}" + "url": "http://jsonplaceholder.typicode.com/posts/{{.env.ID}}" }, "cache": null }, @@ -56,7 +53,7 @@ "name": "Post" }, "http": { - "path": "/posts/{{.env.POST_ID}}" + "url": "http://jsonplaceholder.typicode.com/posts/{{.env.POST_ID}}" }, "cache": null }, @@ -65,7 +62,7 @@ "name": "Post" }, "http": { - "path": "/posts/{{.env.NESTED_POST_ID}}" + "url": "http://jsonplaceholder.typicode.com/posts/{{.env.NESTED_POST_ID}}" }, "cache": null } diff --git a/tests/execution/experimental-headers.md b/tests/execution/experimental-headers.md index b6d4ad3e00..ee2f046ced 100644 --- a/tests/execution/experimental-headers.md +++ b/tests/execution/experimental-headers.md @@ -6,7 +6,7 @@ schema @server(headers: {experimental: ["x-tailcall", "X-experimental"]}) { } type Query { - users: [User] @http(path: "/users", baseURL: "http://jsonplaceholder.typicode.com") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/execution/federation-subgraph-force-disabled.md b/tests/execution/federation-subgraph-force-disabled.md index 9dacf4f395..0872380477 100644 --- a/tests/execution/federation-subgraph-force-disabled.md +++ b/tests/execution/federation-subgraph-force-disabled.md @@ -1,14 +1,12 @@ # Federation subgraph with no entities in the config ```graphql @config -schema - @server(port: 8000, enableFederation: false) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000, enableFederation: false) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User @call(steps: [{query: "user", args: {id: "{{.value.id}}"}}]) { diff --git a/tests/execution/federation-subgraph-force-enabled.md b/tests/execution/federation-subgraph-force-enabled.md index 5e0a6f0719..741c2966ec 100644 --- a/tests/execution/federation-subgraph-force-enabled.md +++ b/tests/execution/federation-subgraph-force-enabled.md @@ -1,14 +1,12 @@ # Federation subgraph with no entities in the config and enableFederation=true ```graphql @config -schema - @server(port: 8000, enableFederation: true) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000, enableFederation: true) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User @tag(name: "team-accounts") { diff --git a/tests/execution/federation-subgraph-no-entities.md b/tests/execution/federation-subgraph-no-entities.md index 241ba6b0e8..c5388b0135 100644 --- a/tests/execution/federation-subgraph-no-entities.md +++ b/tests/execution/federation-subgraph-no-entities.md @@ -1,14 +1,12 @@ # Federation subgraph with no entities in the config ```graphql @config -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/execution/graphql-conformance-001.md b/tests/execution/graphql-conformance-001.md index eaf8cbb478..d7b9b0ade5 100644 --- a/tests/execution/graphql-conformance-001.md +++ b/tests/execution/graphql-conformance-001.md @@ -1,14 +1,13 @@ # Basic queries with field ordering check ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-002.md b/tests/execution/graphql-conformance-002.md index 5125688cb2..5f9123db3c 100644 --- a/tests/execution/graphql-conformance-002.md +++ b/tests/execution/graphql-conformance-002.md @@ -7,14 +7,13 @@ skip: true TODO: Skipped because Tailcall does not send the whole query to the remote server. It sends a shallow version of the query. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-003.md b/tests/execution/graphql-conformance-003.md index 32101024bb..ca9ea18187 100644 --- a/tests/execution/graphql-conformance-003.md +++ b/tests/execution/graphql-conformance-003.md @@ -1,14 +1,13 @@ # Test field inputs query ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-004.md b/tests/execution/graphql-conformance-004.md index 02a67eb1db..a3d5dadbdf 100644 --- a/tests/execution/graphql-conformance-004.md +++ b/tests/execution/graphql-conformance-004.md @@ -7,14 +7,13 @@ skip: true TODO: Skipped because Tailcall does not send the alias to the remote server. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-005.md b/tests/execution/graphql-conformance-005.md index a698488471..f14694bf6c 100644 --- a/tests/execution/graphql-conformance-005.md +++ b/tests/execution/graphql-conformance-005.md @@ -7,14 +7,13 @@ skip: true TODO: Skipped because Tailcall does not send the alias to the remote server. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-006.md b/tests/execution/graphql-conformance-006.md index fac3987a84..f3fa413c96 100644 --- a/tests/execution/graphql-conformance-006.md +++ b/tests/execution/graphql-conformance-006.md @@ -7,14 +7,13 @@ skip: true TODO: Skipped because Tailcall does not send the whole query with the **fragments** to the remote server. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-007.md b/tests/execution/graphql-conformance-007.md index 6f6f7528da..6ad7dcd8dd 100644 --- a/tests/execution/graphql-conformance-007.md +++ b/tests/execution/graphql-conformance-007.md @@ -7,15 +7,13 @@ skip: true TODO: Skipped because Tailcall does not send the whole query with the **fragments** to the remote server. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { profiles(handles: [ID!]!): [Profile!]! - @graphQL(name: "profiles", args: [{key: "handles", value: "{{.args.handles}}"}]) + @graphQL(url: "http://upstream/graphql", name: "profiles", args: [{key: "handles", value: "{{.args.handles}}"}]) } interface Profile { diff --git a/tests/execution/graphql-conformance-008.md b/tests/execution/graphql-conformance-008.md index c57cd35982..68dda9176f 100644 --- a/tests/execution/graphql-conformance-008.md +++ b/tests/execution/graphql-conformance-008.md @@ -7,15 +7,13 @@ skip: true TODO: Skipped because Tailcall does not send the whole query with the **fragments** to the remote server. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { profiles(handles: [ID!]!): [Profile!]! - @graphQL(name: "profiles", args: [{key: "handles", value: "{{.args.handles}}"}]) + @graphQL(url: "http://upstream/graphql", name: "profiles", args: [{key: "handles", value: "{{.args.handles}}"}]) } interface Profile { diff --git a/tests/execution/graphql-conformance-009.md b/tests/execution/graphql-conformance-009.md index 827d967891..97d4b36627 100644 --- a/tests/execution/graphql-conformance-009.md +++ b/tests/execution/graphql-conformance-009.md @@ -7,15 +7,13 @@ skip: true TODO: Skipped because Tailcall does not construct the query correctly. Moreover it does not validate the query that is invalid (contains a missing field). ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { profiles(handles: [ID!]!): [Profile!]! - @graphQL(name: "profiles", args: [{key: "handles", value: "{{.args.handles}}"}]) + @graphQL(url: "http://upstream/graphql", name: "profiles", args: [{key: "handles", value: "{{.args.handles}}"}]) } interface Profile { diff --git a/tests/execution/graphql-conformance-010.md b/tests/execution/graphql-conformance-010.md index 1bd1633b4d..772c971319 100644 --- a/tests/execution/graphql-conformance-010.md +++ b/tests/execution/graphql-conformance-010.md @@ -1,14 +1,13 @@ # Test ordering of input fields ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - nearby(location: Location): Point @graphQL(name: "nearby", args: [{key: "location", value: "{{.args.location}}"}]) + nearby(location: Location): Point + @graphQL(url: "http://upstream/graphql", name: "nearby", args: [{key: "location", value: "{{.args.location}}"}]) } type Location { diff --git a/tests/execution/graphql-conformance-011.md b/tests/execution/graphql-conformance-011.md index c64b2934d1..009280306e 100644 --- a/tests/execution/graphql-conformance-011.md +++ b/tests/execution/graphql-conformance-011.md @@ -7,14 +7,13 @@ skip: true TODO: Skipped because tailcall does not send the `@log` directive to the remote server. Moreover it does not correctly format the scalar to string value. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - nearby(location: Location): Point @graphQL(name: "nearby", args: [{key: "location", value: "{{.args.location}}"}]) + nearby(location: Location): Point + @graphQL(url: "http://upstream/graphql", name: "nearby", args: [{key: "location", value: "{{.args.location}}"}]) } type Location { diff --git a/tests/execution/graphql-conformance-012.md b/tests/execution/graphql-conformance-012.md index 779fbc9e0f..ef500bff0f 100644 --- a/tests/execution/graphql-conformance-012.md +++ b/tests/execution/graphql-conformance-012.md @@ -7,14 +7,12 @@ skip: true TODO: Skipped because Tailcall does not send the whole query with the **fragments** to the remote server. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - search: [SearchResult!]! @graphQL(name: "search") + search: [SearchResult!]! @graphQL(url: "http://upstream/graphql", name: "search") } union SearchResult = Photo | Person diff --git a/tests/execution/graphql-conformance-013.md b/tests/execution/graphql-conformance-013.md index 8fe22c6bdb..174e6e4e3f 100644 --- a/tests/execution/graphql-conformance-013.md +++ b/tests/execution/graphql-conformance-013.md @@ -1,14 +1,12 @@ # Test schema inspection ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - me: User! @graphQL(name: "me") + me: User! @graphQL(url: "http://upstream/graphql", name: "me") } type User { diff --git a/tests/execution/graphql-conformance-014.md b/tests/execution/graphql-conformance-014.md index 93b3e05bcf..de6667b571 100644 --- a/tests/execution/graphql-conformance-014.md +++ b/tests/execution/graphql-conformance-014.md @@ -1,14 +1,13 @@ # Test double query ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-015.md b/tests/execution/graphql-conformance-015.md index 761f9f687d..4d15fce3f7 100644 --- a/tests/execution/graphql-conformance-015.md +++ b/tests/execution/graphql-conformance-015.md @@ -1,14 +1,13 @@ # Optional input fields ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-017.md b/tests/execution/graphql-conformance-017.md index 2f2875fa41..52f42047b0 100644 --- a/tests/execution/graphql-conformance-017.md +++ b/tests/execution/graphql-conformance-017.md @@ -7,15 +7,13 @@ skip: true TODO: Skipped because Tailcall does not send the whole query with the **fragments** to the remote server. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - edibleAnimals: [EdibleAnimals] @graphQL(name: "edibleAnimals") - allAnimals: [Animal] @graphQL(name: "allAnimals") + edibleAnimals: [EdibleAnimals] @graphQL(url: "http://upstream/graphql", name: "edibleAnimals") + allAnimals: [Animal] @graphQL(url: "http://upstream/graphql", name: "allAnimals") } interface Animal { diff --git a/tests/execution/graphql-conformance-018.md b/tests/execution/graphql-conformance-018.md index f5ea02a66f..3fcea4bb7c 100644 --- a/tests/execution/graphql-conformance-018.md +++ b/tests/execution/graphql-conformance-018.md @@ -1,14 +1,13 @@ # Basic queries with field modify check ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! + @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-http-001.md b/tests/execution/graphql-conformance-http-001.md index 559445269c..810140bafd 100644 --- a/tests/execution/graphql-conformance-http-001.md +++ b/tests/execution/graphql-conformance-http-001.md @@ -1,14 +1,12 @@ # Basic queries with field ordering check ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-http-002.md b/tests/execution/graphql-conformance-http-002.md index fab132311d..ad54906a97 100644 --- a/tests/execution/graphql-conformance-http-002.md +++ b/tests/execution/graphql-conformance-http-002.md @@ -1,14 +1,12 @@ # Test complex nested query ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-http-003.md b/tests/execution/graphql-conformance-http-003.md index 3cbda307af..cea81685ca 100644 --- a/tests/execution/graphql-conformance-http-003.md +++ b/tests/execution/graphql-conformance-http-003.md @@ -1,14 +1,12 @@ # Test field inputs query ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -16,7 +14,7 @@ type User { name: String! profilePic(size: Int, width: Int, height: Int): String! @http( - path: "/pic" + url: "http://upstream/pic" query: [ {key: "id", value: "{{.value.id}}"} {key: "size", value: "{{.args.size}}"} diff --git a/tests/execution/graphql-conformance-http-004.md b/tests/execution/graphql-conformance-http-004.md index 4c70cc0925..fe7f465026 100644 --- a/tests/execution/graphql-conformance-http-004.md +++ b/tests/execution/graphql-conformance-http-004.md @@ -1,14 +1,12 @@ # Test complex aliasing ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -16,7 +14,7 @@ type User { name: String! profilePic(size: Int, width: Int, height: Int): String! @http( - path: "/pic" + url: "http://upstream/pic" query: [ {key: "id", value: "{{.value.id}}"} {key: "size", value: "{{.args.size}}"} diff --git a/tests/execution/graphql-conformance-http-005.md b/tests/execution/graphql-conformance-http-005.md index be05bc9c83..95206090d4 100644 --- a/tests/execution/graphql-conformance-http-005.md +++ b/tests/execution/graphql-conformance-http-005.md @@ -1,14 +1,12 @@ # Test field aliasing ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-http-006.md b/tests/execution/graphql-conformance-http-006.md index 66665829fb..dda1223b85 100644 --- a/tests/execution/graphql-conformance-http-006.md +++ b/tests/execution/graphql-conformance-http-006.md @@ -1,14 +1,12 @@ # Test complex nested query ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -17,10 +15,13 @@ type User { profilePic(size: Int, width: Int, height: Int): String! @expr(body: "{{.value.id}}_{{.args.size}}_{{.args.width}}_{{.args.height}}") friends(first: Int): [User!]! - @http(path: "/friends", query: [{key: "id", value: "{{.value.id}}"}, {key: "first", value: "{{.args.first}}"}]) + @http( + url: "http://upstream/friends" + query: [{key: "id", value: "{{.value.id}}"}, {key: "first", value: "{{.args.first}}"}] + ) mutualFriends(first: Int): [User!]! @http( - path: "/mutual-friends" + url: "http://upstream/mutual-friends" query: [{key: "id", value: "{{.value.id}}"}, {key: "first", value: "{{.args.first}}"}] ) } diff --git a/tests/execution/graphql-conformance-http-007.md b/tests/execution/graphql-conformance-http-007.md index 66ffb6b62c..e450e8f3c6 100644 --- a/tests/execution/graphql-conformance-http-007.md +++ b/tests/execution/graphql-conformance-http-007.md @@ -1,14 +1,13 @@ # Test named fragments. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - profiles(handles: [ID!]!): [Profile!]! @http(path: "/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) + profiles(handles: [ID!]!): [Profile!]! + @http(url: "http://upstream/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) } interface Profile { diff --git a/tests/execution/graphql-conformance-http-008.md b/tests/execution/graphql-conformance-http-008.md index 64f679be5d..8ec93c61e0 100644 --- a/tests/execution/graphql-conformance-http-008.md +++ b/tests/execution/graphql-conformance-http-008.md @@ -1,14 +1,13 @@ # Test inline fragments. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - profiles(handles: [ID!]!): [Profile!]! @http(path: "/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) + profiles(handles: [ID!]!): [Profile!]! + @http(url: "http://upstream/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) } interface Profile { diff --git a/tests/execution/graphql-conformance-http-009.md b/tests/execution/graphql-conformance-http-009.md index e007dad854..5460ffde97 100644 --- a/tests/execution/graphql-conformance-http-009.md +++ b/tests/execution/graphql-conformance-http-009.md @@ -7,14 +7,13 @@ skip: true TODO: Skipped because we do not check that variables are defined ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - profiles(handles: [ID!]!): [Profile!]! @http(path: "/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) + profiles(handles: [ID!]!): [Profile!]! + @http(url: "http://upstream/profiles", query: [{key: "handles", value: "{{.args.handles}}"}]) } interface Profile { diff --git a/tests/execution/graphql-conformance-http-010.md b/tests/execution/graphql-conformance-http-010.md index 2aa36a5b6c..53ca9c24e2 100644 --- a/tests/execution/graphql-conformance-http-010.md +++ b/tests/execution/graphql-conformance-http-010.md @@ -1,16 +1,14 @@ # Test ordering of input fields ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { nearby(location: Location): Point @http( - path: "/nearby" + url: "http://upstream/nearby" query: [{key: "lon", value: "{{.args.location.lon}}"}, {key: "lat", value: "{{.args.location.lat}}"}] ) } diff --git a/tests/execution/graphql-conformance-http-011.md b/tests/execution/graphql-conformance-http-011.md index 12fd331e43..7b2736d59c 100644 --- a/tests/execution/graphql-conformance-http-011.md +++ b/tests/execution/graphql-conformance-http-011.md @@ -7,16 +7,14 @@ skip: true TODO: Skipped because Tailcall does not parse the scalar type correctly into a string. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { nearby(location: Location): Point @http( - path: "/nearby" + url: "http://upstream/nearby" query: [{key: "lon", value: "{{.args.location.lon}}"}, {key: "lat", value: "{{.args.location.lat}}"}] ) } diff --git a/tests/execution/graphql-conformance-http-012.md b/tests/execution/graphql-conformance-http-012.md index eebf5e23a1..a7886629a1 100644 --- a/tests/execution/graphql-conformance-http-012.md +++ b/tests/execution/graphql-conformance-http-012.md @@ -1,14 +1,12 @@ # Test unions ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - search: [SearchResult!]! @http(path: "/search") + search: [SearchResult!]! @http(url: "http://upstream/search") } union SearchResult = Photo | Person diff --git a/tests/execution/graphql-conformance-http-013.md b/tests/execution/graphql-conformance-http-013.md index 1d328fd624..40be3a0103 100644 --- a/tests/execution/graphql-conformance-http-013.md +++ b/tests/execution/graphql-conformance-http-013.md @@ -1,14 +1,12 @@ # Test schema inspection ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - me: User! @http(path: "/me") + me: User! @http(url: "http://upstream/me") } type User { diff --git a/tests/execution/graphql-conformance-http-014.md b/tests/execution/graphql-conformance-http-014.md index e00e5a0f24..e590b6c641 100644 --- a/tests/execution/graphql-conformance-http-014.md +++ b/tests/execution/graphql-conformance-http-014.md @@ -1,14 +1,12 @@ # Test double query ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-http-015.md b/tests/execution/graphql-conformance-http-015.md index 81089c9309..5bcb908a0f 100644 --- a/tests/execution/graphql-conformance-http-015.md +++ b/tests/execution/graphql-conformance-http-015.md @@ -1,14 +1,12 @@ # Optional input fields ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - user(id: ID!): User! @http(path: "/user", query: [{key: "id", value: "{{.args.id}}"}]) + user(id: ID!): User! @http(url: "http://upstream/user", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/graphql-conformance-http-017.md b/tests/execution/graphql-conformance-http-017.md index 5140739ea5..7e4d21cf9e 100644 --- a/tests/execution/graphql-conformance-http-017.md +++ b/tests/execution/graphql-conformance-http-017.md @@ -1,15 +1,13 @@ # Complex fragments. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - edibleAnimals: [EdibleAnimals] @http(path: "/edible-animals") - allAnimals: [Animal] @http(path: "/all-animals") + edibleAnimals: [EdibleAnimals] @http(url: "http://upstream/edible-animals") + allAnimals: [Animal] @http(url: "http://upstream/all-animals") } interface Animal { diff --git a/tests/execution/graphql-conformance-nested-lists-fragment.md b/tests/execution/graphql-conformance-nested-lists-fragment.md index 0bae05c593..0d308a0e64 100644 --- a/tests/execution/graphql-conformance-nested-lists-fragment.md +++ b/tests/execution/graphql-conformance-nested-lists-fragment.md @@ -1,20 +1,18 @@ # List of lists. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - users: [[Role!]!]! @http(path: "/users") + users: [[Role!]!]! @http(url: "http://upstream/users") } type User { id: ID! name: String! - accountRef: String! @http(path: "/refs/{{.value.id}}") + accountRef: String! @http(url: "http://upstream/refs/{{.value.id}}") } type Admin { diff --git a/tests/execution/graphql-conformance-nested-lists-http.md b/tests/execution/graphql-conformance-nested-lists-http.md index ede5b1697e..2e204a8978 100644 --- a/tests/execution/graphql-conformance-nested-lists-http.md +++ b/tests/execution/graphql-conformance-nested-lists-http.md @@ -1,15 +1,14 @@ # List of lists. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - userGroups: [[User!]!]! @http(path: "/users") - addUsers(userNames: [[String!]!]!): Boolean @http(path: "/users", method: POST, body: "{{.args.userNames}}") + userGroups: [[User!]!]! @http(url: "http://upstream/users") + addUsers(userNames: [[String!]!]!): Boolean + @http(url: "http://upstream/users", method: POST, body: "{{.args.userNames}}") } type User { diff --git a/tests/execution/graphql-conformance-nested-lists.md b/tests/execution/graphql-conformance-nested-lists.md index addef681ba..999f1ae38d 100644 --- a/tests/execution/graphql-conformance-nested-lists.md +++ b/tests/execution/graphql-conformance-nested-lists.md @@ -1,16 +1,14 @@ # List of lists. ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - userGroups: [[User!]!]! @graphQL(name: "users") + userGroups: [[User!]!]! @graphQL(url: "http://upstream/graphql", name: "users") addUsers(userNames: [[String!]!]!): Boolean - @graphQL(name: "addUsers", args: [{key: "userNames", value: "{{.args.userNames}}"}]) + @graphQL(url: "http://upstream/graphql", name: "addUsers", args: [{key: "userNames", value: "{{.args.userNames}}"}]) } type User { diff --git a/tests/execution/graphql-dataloader-batch-request.md b/tests/execution/graphql-dataloader-batch-request.md index d47b1975ce..02542cbfa2 100644 --- a/tests/execution/graphql-dataloader-batch-request.md +++ b/tests/execution/graphql-dataloader-batch-request.md @@ -10,12 +10,7 @@ type Post { title: String userId: Int user: User - @graphQL( - args: [{key: "id", value: "{{.value.userId}}"}] - baseURL: "http://upstream/graphql" - batch: true - name: "user" - ) + @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], url: "http://upstream/graphql", batch: true, name: "user") } type User { @@ -24,7 +19,7 @@ type User { } type Query { - posts: [Post] @http(path: "/posts", baseURL: "http://jsonplaceholder.typicode.com") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } ``` diff --git a/tests/execution/graphql-dataloader-no-batch-request.md b/tests/execution/graphql-dataloader-no-batch-request.md index 0492fe7054..8c7eeb94f2 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(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type User { @@ -18,7 +18,7 @@ type User { } type Query { - posts: [Post] @http(path: "/posts", baseURL: "http://jsonplaceholder.typicode.com") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } ``` diff --git a/tests/execution/graphql-datasource-errors.md b/tests/execution/graphql-datasource-errors.md index 1859761bc9..51fedd473e 100644 --- a/tests/execution/graphql-datasource-errors.md +++ b/tests/execution/graphql-datasource-errors.md @@ -11,8 +11,7 @@ type User { } type Query { - user(id: Int): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + user(id: Int): User @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } ``` diff --git a/tests/execution/graphql-datasource-mutation.md b/tests/execution/graphql-datasource-mutation.md index 0c9ef8f9c4..8a1c1d30cb 100644 --- a/tests/execution/graphql-datasource-mutation.md +++ b/tests/execution/graphql-datasource-mutation.md @@ -12,12 +12,12 @@ type User { } type Query { - users: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") + users: [User] @graphQL(url: "http://upstream/graphql", name: "users") } type Mutation { createUser(user: UserInput!): User - @graphQL(baseURL: "http://upstream/graphql", name: "createUser", args: [{key: "user", value: "{{.args.user}}"}]) + @graphQL(url: "http://upstream/graphql", name: "createUser", args: [{key: "user", value: "{{.args.user}}"}]) } type UserInput { diff --git a/tests/execution/graphql-datasource-no-args.md b/tests/execution/graphql-datasource-no-args.md index b9c958dac2..18feb29f84 100644 --- a/tests/execution/graphql-datasource-no-args.md +++ b/tests/execution/graphql-datasource-no-args.md @@ -11,7 +11,7 @@ type User { } type Query { - users_list: [User] @graphQL(baseURL: "http://upstream/graphql", name: "users") + users_list: [User] @graphQL(url: "http://upstream/graphql", name: "users") } ``` diff --git a/tests/execution/graphql-datasource-query-directives.md b/tests/execution/graphql-datasource-query-directives.md index 0c08c75296..f56b4b6a16 100644 --- a/tests/execution/graphql-datasource-query-directives.md +++ b/tests/execution/graphql-datasource-query-directives.md @@ -13,7 +13,7 @@ type User { } type Query { - user: User @graphQL(baseURL: "http://upstream/graphql", name: "user") + user: User @graphQL(url: "http://upstream/graphql", name: "user") } ``` diff --git a/tests/execution/graphql-datasource-with-args.md b/tests/execution/graphql-datasource-with-args.md index d5c5f6b5d7..c3c6b58fa5 100644 --- a/tests/execution/graphql-datasource-with-args.md +++ b/tests/execution/graphql-datasource-with-args.md @@ -16,10 +16,8 @@ type Post { } type Query { - user(id: Int): User - @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}}"}]) + user(id: Int): User @graphQL(url: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + post(id: Int): Post @graphQL(url: "http://upstream/graphql", name: "post", args: [{key: "id", value: "{{.args.id}}"}]) } ``` diff --git a/tests/execution/graphql-nested-datasource.md b/tests/execution/graphql-nested-datasource.md index 393a84ad13..2816e3874a 100644 --- a/tests/execution/graphql-nested-datasource.md +++ b/tests/execution/graphql-nested-datasource.md @@ -1,22 +1,20 @@ # GraphQL datasource inside another graphQL datasource ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream/graphql", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - a: [A] @graphQL(name: "a") + a: [A] @graphQL(url: "http://upstream/graphql", name: "a") } type A { id: Int! bid: Int! cid: Int! - b: B @graphQL(name: "b", args: [{key: "id", value: "{{.value.bid}}"}]) - c: C @graphQL(name: "c", args: [{key: "id", value: "{{.value.cid}}"}]) + b: B @graphQL(url: "http://upstream/graphql", name: "b", args: [{key: "id", value: "{{.value.bid}}"}]) + c: C @graphQL(url: "http://upstream/graphql", name: "c", args: [{key: "id", value: "{{.value.cid}}"}]) } type B { diff --git a/tests/execution/grpc-batch.md b/tests/execution/grpc-batch.md index ef15af62aa..a14ef78937 100644 --- a/tests/execution/grpc-batch.md +++ b/tests/execution/grpc-batch.md @@ -45,11 +45,11 @@ schema } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") + news: NewsData! @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:50051") newsById(news: NewsInput!): News! @grpc( method: "news.NewsService.GetMultipleNews" - baseURL: "http://localhost:50051" + url: "http://localhost:50051" body: "{{.args.news}}" batchKey: ["news", "id"] ) diff --git a/tests/execution/grpc-error.md b/tests/execution/grpc-error.md index 7360b86957..ecbea4039f 100644 --- a/tests/execution/grpc-error.md +++ b/tests/execution/grpc-error.md @@ -45,9 +45,9 @@ schema } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") + news: NewsData! @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:50051") newsById(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") + @grpc(method: "news.NewsService.GetNews", url: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/grpc-json.md b/tests/execution/grpc-json.md index fa80cd023a..6302c8f62d 100644 --- a/tests/execution/grpc-json.md +++ b/tests/execution/grpc-json.md @@ -37,18 +37,16 @@ message NewsList { ``` ```graphql @config -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051") - @link(id: "news", src: "news.proto", type: Protobuf) { +schema @server(port: 8000) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } type Query { - newsById: News! @grpc(method: "news.NewsService.GetNews", body: {id: 2}) - newsByIdMustache(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{.args.news}}") + newsById: News! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetNews", body: {id: 2}) + newsByIdMustache(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", method: "news.NewsService.GetNews", body: "{{.args.news}}") newsByIdMustacheAndJson(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", body: {id: "{{.args.news.id}}"}) + @grpc(url: "http://localhost:50051", method: "news.NewsService.GetNews", body: {id: "{{.args.news.id}}"}) } input NewsInput { diff --git a/tests/execution/grpc-map.md b/tests/execution/grpc-map.md index 70049b195d..eb0a6a88bc 100644 --- a/tests/execution/grpc-map.md +++ b/tests/execution/grpc-map.md @@ -20,10 +20,7 @@ service MapService { ``` ```graphql @config -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", httpCache: 42, batch: {delay: 10}) - @link(src: "map.proto", type: Protobuf) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 10}) @link(src: "map.proto", type: Protobuf) { query: Query } @@ -37,7 +34,7 @@ input map__MapRequest { type Query { map__MapService__GetMap(mapRequest: map__MapRequest!): map__MapResponse! - @grpc(body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") + @grpc(url: "http://localhost:50051", body: "{{.args.mapRequest}}", method: "map.MapService.GetMap") } type map__MapResponse { diff --git a/tests/execution/grpc-oneof.md b/tests/execution/grpc-oneof.md index 71636d469e..b9c8f31415 100644 --- a/tests/execution/grpc-oneof.md +++ b/tests/execution/grpc-oneof.md @@ -39,10 +39,7 @@ service OneOfService { ``` ```graphql @config -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", httpCache: 42, batch: {delay: 10}) - @link(src: "oneof.proto", type: Protobuf) { +schema @server(port: 8000) @upstream(httpCache: 42, batch: {delay: 10}) @link(src: "oneof.proto", type: Protobuf) { query: Query } @@ -110,23 +107,23 @@ union oneof__Response = oneof__Response__Var | oneof__Response__Var0 | oneof__Re type Query { oneof__OneOfService__GetOneOfVar0(request: oneof__Request__Var0__Var!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar1(request: oneof__Request__Var0__Var0!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar2(request: oneof__Request__Var0__Var1!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar3(request: oneof__Request__Var1__Var!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar4(request: oneof__Request__Var1__Var0!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar5(request: oneof__Request__Var1__Var1!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar6(request: oneof__Request__Var__Var!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar7(request: oneof__Request__Var__Var0!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") oneof__OneOfService__GetOneOfVar8(request: oneof__Request__Var__Var1!): oneof__Response! - @grpc(body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") + @grpc(url: "http://localhost:50051", body: "{{.args.request}}", method: "oneof.OneOfService.GetOneOf") } type oneof__Command { diff --git a/tests/execution/grpc-override-url-from-upstream.md b/tests/execution/grpc-override-url-from-upstream.md deleted file mode 100644 index b5dad64357..0000000000 --- a/tests/execution/grpc-override-url-from-upstream.md +++ /dev/null @@ -1,84 +0,0 @@ -# Grpc datasource - -```protobuf @file:news.proto -syntax = "proto3"; - -import "google/protobuf/empty.proto"; - -package news; - -message News { - int32 id = 1; - string title = 2; - string body = 3; - string postImage = 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; -} -``` - -```graphql @config -schema - @server(port: 8000) - @upstream(httpCache: 42, batch: {delay: 10}, baseURL: "http://not-a-valid-grpc-url.com") - @link(id: "news", src: "news.proto", type: Protobuf) { - query: Query -} - -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") -} -input NewsInput { - id: Int - title: String - body: String - postImage: String -} -type NewsData { - news: [News] -} - -type News { - id: Int - title: String - body: String - postImage: String -} -``` - -```yml @mock -- 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-proto-with-same-package.md b/tests/execution/grpc-proto-with-same-package.md index 247b50a385..2a3984bfbe 100644 --- a/tests/execution/grpc-proto-with-same-package.md +++ b/tests/execution/grpc-proto-with-same-package.md @@ -34,17 +34,13 @@ service BarService { ``` ```graphql @config -schema - @server(port: 8000) - @upstream(baseURL: "http://localhost:50051") - @link(src: "foo.proto", type: Protobuf) - @link(src: "bar.proto", type: Protobuf) { +schema @server(port: 8000) @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") + foo: Foo! @grpc(url: "http://localhost:50051", method: "test.FooService.GetFoo") + bar: Bar! @grpc(url: "http://localhost:50051", method: "test.BarService.GetBar") } type Foo { diff --git a/tests/execution/grpc-reflection.md b/tests/execution/grpc-reflection.md index 65cc528531..8b0f747662 100644 --- a/tests/execution/grpc-reflection.md +++ b/tests/execution/grpc-reflection.md @@ -1,15 +1,12 @@ # Grpc datasource ```graphql @config -schema - @server(port: 8000) - @upstream(httpCache: 42, baseURL: "http://localhost:50051") - @link(src: "http://localhost:50051", type: Grpc) { +schema @server(port: 8000) @upstream(httpCache: 42) @link(src: "http://localhost:50051", type: Grpc) { query: Query } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") } type NewsData { diff --git a/tests/execution/grpc-simple.md b/tests/execution/grpc-simple.md index 8ca6258010..44b0484826 100644 --- a/tests/execution/grpc-simple.md +++ b/tests/execution/grpc-simple.md @@ -39,18 +39,20 @@ message NewsList { ```graphql @config schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", httpCache: 42, batch: {delay: 10}) + @upstream(httpCache: 42, batch: {delay: 10}) @link(id: "news", src: "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}}") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", method: "news.NewsService.GetNews", body: "{{.args.news}}") } type Mutation { - deleteNews(news: NewsId!): Empty! @grpc(method: "news.NewsService.DeleteNews", body: "{{.args.news}}") + deleteNews(news: NewsId!): Empty! + @grpc(url: "http://localhost:50051", method: "news.NewsService.DeleteNews", body: "{{.args.news}}") } input NewsId { diff --git a/tests/execution/grpc-url-from-upstream.md b/tests/execution/grpc-url-from-upstream.md index bbfaf28a0a..57bf2169de 100644 --- a/tests/execution/grpc-url-from-upstream.md +++ b/tests/execution/grpc-url-from-upstream.md @@ -39,14 +39,15 @@ message NewsList { ```graphql @config schema @server(port: 8000) - @upstream(httpCache: 42, batch: {delay: 10}, baseURL: "http://localhost:50051") + @upstream(httpCache: 42, batch: {delay: 10}) @link(id: "news", src: "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}}") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", method: "news.NewsService.GetNews", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/http-select.md b/tests/execution/http-select.md index 74ad46b02b..d36cbeb361 100644 --- a/tests/execution/http-select.md +++ b/tests/execution/http-select.md @@ -1,16 +1,17 @@ # Basic queries with field ordering check ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") - @upstream(baseURL: "http://upstream", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - userCompany(id: Int!): Company @http(path: "/users/{{.args.id}}", select: "{{.company}}") + userCompany(id: Int!): Company @http(url: "http://upstream/users/{{.args.id}}", select: "{{.company}}") userDetails(id: Int!): UserDetails - @http(path: "/users/{{.args.id}}", select: {id: "{{.id}}", city: "{{.address.city}}", phone: "{{.phone}}"}) + @http( + url: "http://upstream/users/{{.args.id}}" + select: {id: "{{.id}}", city: "{{.address.city}}", phone: "{{.phone}}"} + ) } type UserDetails { diff --git a/tests/execution/https.md b/tests/execution/https.md index d6442bb0ce..93b418be13 100644 --- a/tests/execution/https.md +++ b/tests/execution/https.md @@ -3,9 +3,6 @@ ```json @config { "server": {}, - "upstream": { - "baseURL": "https://jsonplaceholder.typicode.com" - }, "schema": { "query": "Query" }, @@ -17,8 +14,7 @@ "name": "User" }, "http": { - "path": "/users/1", - "baseURL": "https://jsonplaceholder.typicode.com" + "url": "http://jsonplaceholder.typicode.com/users/1" }, "cache": null } @@ -49,7 +45,7 @@ ```yml @mock - request: method: GET - url: https://jsonplaceholder.typicode.com/users/1 + url: http://jsonplaceholder.typicode.com/users/1 response: status: 200 body: diff --git a/tests/execution/inline-field.md b/tests/execution/inline-field.md index af33249c17..25e91254dc 100644 --- a/tests/execution/inline-field.md +++ b/tests/execution/inline-field.md @@ -18,7 +18,7 @@ type Geo { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/inline-index-list.md b/tests/execution/inline-index-list.md index c4d639f250..1bef22e400 100644 --- a/tests/execution/inline-index-list.md +++ b/tests/execution/inline-index-list.md @@ -10,7 +10,7 @@ type User { } type Query @addField(name: "username", path: ["username", "0", "name"]) { - username: [User] @http(path: "/users", baseURL: "http://jsonplaceholder.typicode.com") @modify(omit: true) + username: [User] @http(url: "http://jsonplaceholder.typicode.com/users") @modify(omit: true) } ``` diff --git a/tests/execution/inline-many-list.md b/tests/execution/inline-many-list.md index b18a755d36..521a922217 100644 --- a/tests/execution/inline-many-list.md +++ b/tests/execution/inline-many-list.md @@ -16,7 +16,7 @@ type A { } type Query { - u: U @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/us/1") + u: U @http(url: "http://jsonplaceholder.typicode.com/us/1") } type U diff --git a/tests/execution/inline-many.md b/tests/execution/inline-many.md index 4360a8d38f..1bb8f3cba4 100644 --- a/tests/execution/inline-many.md +++ b/tests/execution/inline-many.md @@ -16,7 +16,7 @@ type Address { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User diff --git a/tests/execution/input-type-protected-error.md b/tests/execution/input-type-protected-error.md index 9617dda88f..46f655b9bb 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(url: "/posts", method: POST, body: "{{.args.post}}") } input Input @protected { diff --git a/tests/execution/introspection-query-with-disabled-introspection.md b/tests/execution/introspection-query-with-disabled-introspection.md index 31a85d39c3..0120d8213d 100644 --- a/tests/execution/introspection-query-with-disabled-introspection.md +++ b/tests/execution/introspection-query-with-disabled-introspection.md @@ -1,14 +1,12 @@ # Test schema inspection with false flag ```graphql @config -schema - @server(port: 8001, queryValidation: false, hostname: "0.0.0.0", introspection: false) - @upstream(baseURL: "http://upstream/", httpCache: 42) { +schema @server(port: 8001, queryValidation: false, hostname: "0.0.0.0", introspection: false) @upstream(httpCache: 42) { query: Query } type Query { - me: User! @http(path: "/me") + me: User! @http(url: "http://upstream/me") } type User { diff --git a/tests/execution/io-cache.md b/tests/execution/io-cache.md index f32585cf6a..20e4a962c8 100644 --- a/tests/execution/io-cache.md +++ b/tests/execution/io-cache.md @@ -1,14 +1,12 @@ # Call operator with GraphQL data source ```graphql @config -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42) { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { @@ -21,7 +19,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } ``` diff --git a/tests/execution/js-directive.md b/tests/execution/js-directive.md index f66368e879..f8d7213e63 100644 --- a/tests/execution/js-directive.md +++ b/tests/execution/js-directive.md @@ -12,12 +12,12 @@ function name(val) { ``` ```graphql @config -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") @link(type: Script, src: "test.js") { +schema @server @link(type: Script, src: "test.js") { query: Query } type Query { - hello: User! @http(path: "/users/1") + hello: User! @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { @@ -29,7 +29,7 @@ type User { ```yml @mock - request: method: GET - url: https://jsonplaceholder.typicode.com/users/1 + url: http://jsonplaceholder.typicode.com/users/1 response: status: 200 body: diff --git a/tests/execution/jsonplaceholder-call-post.md b/tests/execution/jsonplaceholder-call-post.md index 27eebe6d95..5e00e0a3d0 100644 --- a/tests/execution/jsonplaceholder-call-post.md +++ b/tests/execution/jsonplaceholder-call-post.md @@ -1,16 +1,14 @@ # jsonplaceholder-call-post ```graphql @config -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - posts: [Post] @http(path: "/posts") - users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/execution/modified-field.md b/tests/execution/modified-field.md index 6268490796..ec58787210 100644 --- a/tests/execution/modified-field.md +++ b/tests/execution/modified-field.md @@ -10,7 +10,7 @@ type User { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/mutation-put.md b/tests/execution/mutation-put.md index 88337983f5..2c2d30ca85 100644 --- a/tests/execution/mutation-put.md +++ b/tests/execution/mutation-put.md @@ -1,7 +1,7 @@ # Mutation put ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query mutation: Mutation } @@ -14,7 +14,8 @@ 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", url: "http://jsonplaceholder.typicode.com/posts/{{.args.input.id}}") } type Post { @@ -25,7 +26,7 @@ type Post { } type Query { - firstUser: User @http(method: "GET", path: "/users/1") + firstUser: User @http(method: "GET", url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/execution/mutation.md b/tests/execution/mutation.md index 5d05e89923..34e4e72087 100644 --- a/tests/execution/mutation.md +++ b/tests/execution/mutation.md @@ -1,7 +1,7 @@ # Mutation ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query mutation: Mutation } @@ -13,7 +13,8 @@ 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", url: "http://jsonplaceholder.typicode.com/posts") } type Post { @@ -24,7 +25,7 @@ type Post { } type Query { - firstUser: User @http(method: "GET", path: "/users/1") + firstUser: User @http(method: "GET", url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/execution/n-plus-one-list.md b/tests/execution/n-plus-one-list.md index 156f7169f7..36319928ea 100644 --- a/tests/execution/n-plus-one-list.md +++ b/tests/execution/n-plus-one-list.md @@ -1,25 +1,25 @@ # n + 1 Request List ```graphql @config -schema @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) { +schema @upstream(batch: {delay: 1, maxSize: 1000}) { query: Query } type Query { - foos: [Foo] @http(path: "/foos") - bars: [Bar] @http(path: "/bars") + foos: [Foo] @http(url: "http://example.com/foos") + bars: [Bar] @http(url: "http://example.com/bars") } type Foo { id: Int! name: String! - bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}], batchKey: ["fooId"]) + bar: Bar @http(url: "http://example.com/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(url: "http://example.com/foos", query: [{key: "id", value: "{{.value.fooId}}"}], batchKey: ["id"]) } ``` diff --git a/tests/execution/n-plus-one.md b/tests/execution/n-plus-one.md index 90c67f48d7..8123b64f51 100644 --- a/tests/execution/n-plus-one.md +++ b/tests/execution/n-plus-one.md @@ -1,25 +1,25 @@ # n + 1 Request ```graphql @config -schema @upstream(baseURL: "http://example.com", batch: {delay: 1, maxSize: 1000}) { +schema @upstream(batch: {delay: 1, maxSize: 1000}) { query: Query } type Query { - foos: [Foo] @http(path: "/foos") - bars: [Bar] @http(path: "/bars") + foos: [Foo] @http(url: "http://example.com/foos") + bars: [Bar] @http(url: "http://example.com/bars") } type Foo { id: Int! name: String! - bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}], batchKey: ["fooId"]) + bar: Bar @http(url: "http://example.com/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(url: "http://example.com/foos", query: [{key: "id", value: "{{.value.fooId}}"}], batchKey: ["id"]) } ``` diff --git a/tests/execution/nested-objects.md b/tests/execution/nested-objects.md index ffd0571beb..9441d47664 100644 --- a/tests/execution/nested-objects.md +++ b/tests/execution/nested-objects.md @@ -20,7 +20,7 @@ type Geo { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/nested-recursive-types.md b/tests/execution/nested-recursive-types.md index f5546e6dca..260c514eb0 100644 --- a/tests/execution/nested-recursive-types.md +++ b/tests/execution/nested-recursive-types.md @@ -1,7 +1,7 @@ # Nested Recursive Type ```graphql @config -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema { query: Query mutation: Mutation } @@ -9,7 +9,7 @@ schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { type User { name: String id: Int! - connections: [Connection] @http(path: "/connections/{{.value.id}}") + connections: [Connection] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") } type Connection { @@ -22,18 +22,19 @@ type NestedUser { } type Query { - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type Mutation { - createUser(user: User): User @http(path: "/user", method: "POST", body: "{{.args.user}}") + createUser(user: User): User + @http(url: "http://jsonplaceholder.typicode.com/user", method: "POST", body: "{{.args.user}}") } ``` ```yml @mock - request: method: GET - url: https://jsonplaceholder.typicode.com/users/1 + url: http://jsonplaceholder.typicode.com/users/1 response: status: 200 body: @@ -41,7 +42,7 @@ type Mutation { name: User1 - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/1 + url: http://jsonplaceholder.typicode.com/connections/1 response: status: 200 body: @@ -53,7 +54,7 @@ type Mutation { - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/2 + url: http://jsonplaceholder.typicode.com/connections/2 response: status: 200 body: diff --git a/tests/execution/nesting-level3.md b/tests/execution/nesting-level3.md index 5d22d0ab5b..34ec2c1f05 100644 --- a/tests/execution/nesting-level3.md +++ b/tests/execution/nesting-level3.md @@ -1,12 +1,12 @@ # Nesting level 3 ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema { query: Query } type Query { - post: Post @http(path: "/posts/1") + post: Post @http(url: "http://jsonplaceholder.typicode.com/posts/1") } type Todo { completed: Boolean @@ -19,7 +19,7 @@ type User { email: String! phone: String website: String - todos: [Todo] @http(path: "/users/{{.value.id}}/todos") + todos: [Todo] @http(url: "http://jsonplaceholder.typicode.com/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(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } ``` diff --git a/tests/execution/nullable-arg-query.md b/tests/execution/nullable-arg-query.md index e413b297d8..86f7351032 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(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/execution/omit-index-list.md b/tests/execution/omit-index-list.md index c4d639f250..1bef22e400 100644 --- a/tests/execution/omit-index-list.md +++ b/tests/execution/omit-index-list.md @@ -10,7 +10,7 @@ type User { } type Query @addField(name: "username", path: ["username", "0", "name"]) { - username: [User] @http(path: "/users", baseURL: "http://jsonplaceholder.typicode.com") @modify(omit: true) + username: [User] @http(url: "http://jsonplaceholder.typicode.com/users") @modify(omit: true) } ``` diff --git a/tests/execution/omit-many.md b/tests/execution/omit-many.md index da89d847e5..0c0a9aff51 100644 --- a/tests/execution/omit-many.md +++ b/tests/execution/omit-many.md @@ -17,7 +17,7 @@ type Address { } type Query { - user: User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User diff --git a/tests/execution/omit-resolved-by-parent.md b/tests/execution/omit-resolved-by-parent.md index ed66207db6..cb138de78e 100644 --- a/tests/execution/omit-resolved-by-parent.md +++ b/tests/execution/omit-resolved-by-parent.md @@ -10,7 +10,7 @@ type Address { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User @addField(name: "address", path: ["address", "street"]) { diff --git a/tests/execution/recursive-types-json.md b/tests/execution/recursive-types-json.md index 114abaf3ad..3c3431047e 100644 --- a/tests/execution/recursive-types-json.md +++ b/tests/execution/recursive-types-json.md @@ -4,7 +4,6 @@ { "$schema": "./.tailcallrc.schema.json", "upstream": { - "baseURL": "https://jsonplaceholder.typicode.com", "httpCache": 42 }, "schema": { @@ -19,7 +18,7 @@ "name": "User" }, "http": { - "path": "/users/1" + "url": "http://jsonplaceholder.typicode.com/users/1" } } } @@ -38,7 +37,7 @@ "name": "User" }, "http": { - "path": "/user", + "url": "http://jsonplaceholder.typicode.com/user", "method": "POST", "body": "{{.args.user}}" } @@ -66,7 +65,7 @@ } }, "http": { - "path": "/connections/{{.value.id}}" + "url": "http://jsonplaceholder.typicode.com/connections/{{.value.id}}" } } } @@ -92,7 +91,7 @@ ```yml @mock - request: method: GET - url: https://jsonplaceholder.typicode.com/users/1 + url: http://jsonplaceholder.typicode.com/users/1 response: status: 200 body: @@ -100,7 +99,7 @@ name: User1 - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/1 + url: http://jsonplaceholder.typicode.com/connections/1 response: status: 200 body: @@ -111,7 +110,7 @@ - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/2 + url: http://jsonplaceholder.typicode.com/connections/2 response: status: 200 body: @@ -126,7 +125,7 @@ - request: method: POST - url: https://jsonplaceholder.typicode.com/user + url: http://jsonplaceholder.typicode.com/user body: id: 111 name: NewUser @@ -143,7 +142,7 @@ - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/111 + url: http://jsonplaceholder.typicode.com/connections/111 response: status: 200 body: diff --git a/tests/execution/recursive-types-no-resolver.md b/tests/execution/recursive-types-no-resolver.md index 8c82742e94..36f3b31962 100644 --- a/tests/execution/recursive-types-no-resolver.md +++ b/tests/execution/recursive-types-no-resolver.md @@ -7,7 +7,7 @@ error: true Should throw error about missing resolver without panicking with stack overflow error. ```graphql @config -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server { query: Query } diff --git a/tests/execution/recursive-types.md b/tests/execution/recursive-types.md index 0bc1d70633..d9f2d063a2 100644 --- a/tests/execution/recursive-types.md +++ b/tests/execution/recursive-types.md @@ -1,7 +1,7 @@ # Recursive Type ```graphql @config -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server { query: Query mutation: Mutation } @@ -9,7 +9,7 @@ schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { type User { name: String id: Int! - connections: [Connection] @http(path: "/connections/{{.value.id}}") + connections: [Connection] @http(url: "http://jsonplaceholder.typicode.com/connections/{{.value.id}}") } type Connection { @@ -18,18 +18,19 @@ type Connection { } type Query { - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type Mutation { - createUser(user: User): User @http(path: "/user", method: "POST", body: "{{.args.user}}") + createUser(user: User): User + @http(url: "http://jsonplaceholder.typicode.com/user", method: "POST", body: "{{.args.user}}") } ``` ```yml @mock - request: method: GET - url: https://jsonplaceholder.typicode.com/users/1 + url: http://jsonplaceholder.typicode.com/users/1 response: status: 200 body: @@ -37,7 +38,7 @@ type Mutation { name: User1 - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/1 + url: http://jsonplaceholder.typicode.com/connections/1 response: status: 200 body: @@ -48,7 +49,7 @@ type Mutation { - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/2 + url: http://jsonplaceholder.typicode.com/connections/2 response: status: 200 body: @@ -63,7 +64,7 @@ type Mutation { - request: method: POST - url: https://jsonplaceholder.typicode.com/user + url: http://jsonplaceholder.typicode.com/user body: id: 111 name: NewUser @@ -80,7 +81,7 @@ type Mutation { - request: method: GET - url: https://jsonplaceholder.typicode.com/connections/111 + url: http://jsonplaceholder.typicode.com/connections/111 response: status: 200 body: diff --git a/tests/execution/ref-other-nested.md b/tests/execution/ref-other-nested.md index 0bd8a7c28c..9687d9177b 100644 --- a/tests/execution/ref-other-nested.md +++ b/tests/execution/ref-other-nested.md @@ -3,9 +3,6 @@ ```json @config { "server": {}, - "upstream": { - "baseURL": "https://jsonplaceholder.typicode.com" - }, "schema": { "query": "Query" }, @@ -17,8 +14,7 @@ "name": "User1" }, "http": { - "path": "/users/1", - "baseURL": "https://jsonplaceholder.typicode.com" + "url": "http://jsonplaceholder.typicode.com/users/1" }, "cache": null } @@ -60,8 +56,7 @@ "name": "User" }, "http": { - "path": "/users/1", - "baseURL": "https://jsonplaceholder.typicode.com" + "url": "http://jsonplaceholder.typicode.com/users/1" }, "cache": null } @@ -75,7 +70,7 @@ ```yml @mock - request: method: GET - url: https://jsonplaceholder.typicode.com/users/1 + url: http://jsonplaceholder.typicode.com/users/1 expectedHits: 2 response: status: 200 diff --git a/tests/execution/ref-other.md b/tests/execution/ref-other.md index 0dfce91017..6f432e89f3 100644 --- a/tests/execution/ref-other.md +++ b/tests/execution/ref-other.md @@ -1,7 +1,7 @@ # Ref other ```graphql @config -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server { query: Query } @@ -11,7 +11,7 @@ type User { } type User1 { - user1: User @http(path: "/users/1") + user1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type Query { @@ -22,7 +22,7 @@ type Query { ```yml @mock - request: method: GET - url: https://jsonplaceholder.typicode.com/users/1 + url: http://jsonplaceholder.typicode.com/users/1 response: status: 200 body: diff --git a/tests/execution/related-fields-recursive.md b/tests/execution/related-fields-recursive.md index fd38759309..031f922ebf 100644 --- a/tests/execution/related-fields-recursive.md +++ b/tests/execution/related-fields-recursive.md @@ -1,10 +1,10 @@ ```graphql @config -schema @server(port: 8000, hostname: "0.0.0.0") @upstream(baseURL: "http://localhost:8083/graphql") { +schema @server(port: 8000, hostname: "0.0.0.0") { query: Query } type Query { - queryNodeA: [NodeA] @graphQL(name: "queryNodeA", batch: false) + queryNodeA: [NodeA] @graphQL(url: "http://localhost:8083/graphql", name: "queryNodeA", batch: false) } type NodeA { diff --git a/tests/execution/rename-field.md b/tests/execution/rename-field.md index b42deb18b7..7672687fb8 100644 --- a/tests/execution/rename-field.md +++ b/tests/execution/rename-field.md @@ -9,8 +9,8 @@ type User { name: String } type Query { - person1: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") @modify(name: "user1") - person2: User @modify(name: "user2") @http(path: "/users/2", baseURL: "http://jsonplaceholder.typicode.com") + person1: User @http(url: "http://jsonplaceholder.typicode.com/users/1") @modify(name: "user1") + person2: User @modify(name: "user2") @http(url: "http://jsonplaceholder.typicode.com/users/2") } ``` diff --git a/tests/execution/request-to-upstream-batching.md b/tests/execution/request-to-upstream-batching.md index 552a5cb185..c065cbb881 100644 --- a/tests/execution/request-to-upstream-batching.md +++ b/tests/execution/request-to-upstream-batching.md @@ -31,14 +31,13 @@ } }, "http": { - "path": "/users", + "url": "http://jsonplaceholder.typicode.com/users", "query": [ { "key": "id", "value": "{{.args.id}}" } ], - "baseURL": "http://jsonplaceholder.typicode.com", "batchKey": ["id"] }, "cache": null diff --git a/tests/execution/resolve-with-headers.md b/tests/execution/resolve-with-headers.md index f80ec028a4..cae60c693a 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(url: "http://jsonplaceholder.typicode.com/posts/{{.headers.authorization}}") } ``` diff --git a/tests/execution/resolve-with-vars.md b/tests/execution/resolve-with-vars.md index 1e85f387e9..0270f57339 100644 --- a/tests/execution/resolve-with-vars.md +++ b/tests/execution/resolve-with-vars.md @@ -11,8 +11,7 @@ type User { } type Query { - user: [User] - @http(path: "/users", query: [{key: "id", value: "{{.vars.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") + user: [User] @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.vars.id}}"}]) } ``` diff --git a/tests/execution/resolved-by-parent.md b/tests/execution/resolved-by-parent.md index ed66207db6..cb138de78e 100644 --- a/tests/execution/resolved-by-parent.md +++ b/tests/execution/resolved-by-parent.md @@ -10,7 +10,7 @@ type Address { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User @addField(name: "address", path: ["address", "street"]) { diff --git a/tests/execution/rest-api-error.md b/tests/execution/rest-api-error.md index 360d80a69d..3dbcc09f08 100644 --- a/tests/execution/rest-api-error.md +++ b/tests/execution/rest-api-error.md @@ -10,15 +10,12 @@ query ($id: Int!) @rest(method: GET, path: "/user/$id") { ``` ```graphql @config -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @link(type: Operation, src: "operation-user.graphql") { +schema @server @link(type: Operation, src: "operation-user.graphql") { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/execution/rest-api-post.md b/tests/execution/rest-api-post.md index a52311a8e8..f0af5d19ff 100644 --- a/tests/execution/rest-api-post.md +++ b/tests/execution/rest-api-post.md @@ -10,15 +10,12 @@ query ($id: Int!) @rest(method: POST, path: "/user/$id") { ``` ```graphql @config -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @link(type: Operation, src: "operation-user.graphql") { +schema @server @link(type: Operation, src: "operation-user.graphql") { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/execution/rest-api.md b/tests/execution/rest-api.md index bbf2285ac5..a4bfba8d2f 100644 --- a/tests/execution/rest-api.md +++ b/tests/execution/rest-api.md @@ -10,15 +10,12 @@ query ($id: Int!) @rest(method: GET, path: "/user/$id") { ``` ```graphql @config -schema - @server - @upstream(baseURL: "http://jsonplaceholder.typicode.com") - @link(type: Operation, src: "operation-user.graphql") { +schema @server @link(type: Operation, src: "operation-user.graphql") { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { diff --git a/tests/execution/routes-param-on-server-directive.md b/tests/execution/routes-param-on-server-directive.md index 049a3dcffc..e923ff6563 100644 --- a/tests/execution/routes-param-on-server-directive.md +++ b/tests/execution/routes-param-on-server-directive.md @@ -10,7 +10,7 @@ type User { } type Query { - users: [User] @http(path: "/users", baseURL: "http://jsonplaceholder.typicode.com") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } ``` diff --git a/tests/execution/showcase.md b/tests/execution/showcase.md index 85b1505ff7..cb5c3407ab 100644 --- a/tests/execution/showcase.md +++ b/tests/execution/showcase.md @@ -11,7 +11,7 @@ type User { } type Query { - not_user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + not_user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` @@ -35,7 +35,7 @@ type Query { textBody: |2- schema { query: Query } type User { id: Int name: String } - type Query { user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") } + type Query { user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } - request: method: GET url: http://example.com/invalid.graphql diff --git a/tests/execution/simple-graphql.md b/tests/execution/simple-graphql.md index 487d7a7dc7..6b589653b3 100644 --- a/tests/execution/simple-graphql.md +++ b/tests/execution/simple-graphql.md @@ -11,7 +11,7 @@ type User { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/simple-query.md b/tests/execution/simple-query.md index a5c1e6de7e..f706289a95 100644 --- a/tests/execution/simple-query.md +++ b/tests/execution/simple-query.md @@ -3,9 +3,6 @@ ```json @config { "server": {}, - "upstream": { - "baseURL": "http://jsonplaceholder.typicode.com" - }, "schema": { "query": "Query" }, @@ -17,7 +14,7 @@ "name": "User" }, "http": { - "path": "/users/1" + "url": "http://jsonplaceholder.typicode.com/users/1" }, "cache": null } diff --git a/tests/execution/test-add-field-error.md b/tests/execution/test-add-field-error.md index c223d4bdec..a5678ba8a7 100644 --- a/tests/execution/test-add-field-error.md +++ b/tests/execution/test-add-field-error.md @@ -18,6 +18,6 @@ type Address { } type Query @addField(name: "street", path: ["user", "address", "street"]) { - user: User @http(path: "/user/1", baseURL: "http://localhost:8000") + user: User @http(url: "http://localhost:8000/user/1") } ``` diff --git a/tests/execution/test-add-field-list.md b/tests/execution/test-add-field-list.md index 21b0f9841c..66ff2af2ba 100644 --- a/tests/execution/test-add-field-list.md +++ b/tests/execution/test-add-field-list.md @@ -5,7 +5,7 @@ identity: true # test-add-field-list ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,6 +22,6 @@ type Foo { } type Query @addField(name: "b", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") + foo: [Foo] @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-add-field.md b/tests/execution/test-add-field.md index 0057dccbea..a37c071624 100644 --- a/tests/execution/test-add-field.md +++ b/tests/execution/test-add-field.md @@ -5,7 +5,7 @@ identity: true # test-add-field ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,6 +22,6 @@ type Foo { } type Query @addField(name: "b", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-add-link-to-empty-config.md b/tests/execution/test-add-link-to-empty-config.md index 2d8aa9b16a..5a7f326350 100644 --- a/tests/execution/test-add-link-to-empty-config.md +++ b/tests/execution/test-add-link-to-empty-config.md @@ -15,7 +15,7 @@ type Query { ``` ```graphql @file:link-enum.graphql -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } @@ -25,7 +25,7 @@ enum Foo { } type Query { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-batch-operator-post.md b/tests/execution/test-batch-operator-post.md index 6852794331..4cdb775a79 100644 --- a/tests/execution/test-batch-operator-post.md +++ b/tests/execution/test-batch-operator-post.md @@ -5,7 +5,7 @@ error: true # test-batch-operator-post ```graphql @config -schema @server @upstream(baseURL: "http://localhost:3000", batch: {delay: 1}) { +schema @server @upstream(batch: {delay: 1}) { query: Query } @@ -15,6 +15,6 @@ type User { } type Query { - user: User @http(path: "/posts/1", method: "POST", batchKey: ["id"]) + user: User @http(url: "http://localhost:3000/posts/1", method: "POST", batchKey: ["id"]) } ``` diff --git a/tests/execution/test-batching-group-by.md b/tests/execution/test-batching-group-by.md index 5b8d73d9e3..42cff377b8 100644 --- a/tests/execution/test-batching-group-by.md +++ b/tests/execution/test-batching-group-by.md @@ -5,7 +5,7 @@ identity: true # test-batching-group-by ```graphql @config -schema @server(port: 4000) @upstream(baseURL: "http://abc.com", batch: {delay: 1, headers: [], maxSize: 1000}) { +schema @server(port: 4000) @upstream(batch: {delay: 1, headers: [], maxSize: 1000}) { query: Query } @@ -13,12 +13,12 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) + user: User @http(url: "http://abc.com/users", batchKey: ["id"], query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } type Query { - posts: [Post] @http(path: "/posts?id=1&id=11") + posts: [Post] @http(url: "http://abc.com/posts?id=1&id=11") } type User { diff --git a/tests/execution/test-cache.md b/tests/execution/test-cache.md index 3c346b11a4..4fa0789c4d 100644 --- a/tests/execution/test-cache.md +++ b/tests/execution/test-cache.md @@ -5,12 +5,12 @@ identity: true # test-cache ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - user: User @http(path: "/foo") @cache(maxAge: 300) + user: User @http(url: "http://jsonplaceholder.typicode.com/foo") @cache(maxAge: 300) } type User @cache(maxAge: 900) { diff --git a/tests/execution/test-call-operator-errors.md b/tests/execution/test-call-operator-errors.md index 1147ee6381..3f70b83a89 100644 --- a/tests/execution/test-call-operator-errors.md +++ b/tests/execution/test-call-operator-errors.md @@ -5,14 +5,14 @@ error: true # test-call-operator ```graphql @config -schema @server @upstream(baseURL: "http://localhost:3000") { +schema @server { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://localhost:3000/posts") userWithoutResolver(id: Int!): User - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://localhost:3000/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}}"}]) } diff --git a/tests/execution/test-custom-scalar.md b/tests/execution/test-custom-scalar.md index 8ba8865ad0..327ef758b0 100644 --- a/tests/execution/test-custom-scalar.md +++ b/tests/execution/test-custom-scalar.md @@ -5,13 +5,13 @@ identity: true # test-custom-scalar ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } scalar Json type Query { - foo: [Json] @http(path: "/foo") + foo: [Json] @http(url: "http://jsonplacheholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-custom-types.md b/tests/execution/test-custom-types.md index 1fa841caff..6c725d06fd 100644 --- a/tests/execution/test-custom-types.md +++ b/tests/execution/test-custom-types.md @@ -5,7 +5,7 @@ identity: true # test-custom-types ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Que mutation: Mut } @@ -17,7 +17,8 @@ input PostInput { } type Mut { - insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post + @http(url: "http://jsonplaceholder.typicode.com/posts", body: "{{.args.input}}", method: "POST") } type Post { diff --git a/tests/execution/test-dbl-usage-many.md b/tests/execution/test-dbl-usage-many.md index 1ca28597a4..c4e88fe9fa 100644 --- a/tests/execution/test-dbl-usage-many.md +++ b/tests/execution/test-dbl-usage-many.md @@ -16,7 +16,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(url: "http://localhost:8080/user/{{.args.input.id}}") + post(input: Post!): Post @http(url: "http://localhost:8080/user/{{.args.input.id}}") } ``` diff --git a/tests/execution/test-description-many.md b/tests/execution/test-description-many.md index b061f27576..12f6243b92 100644 --- a/tests/execution/test-description-many.md +++ b/tests/execution/test-description-many.md @@ -5,7 +5,7 @@ identity: true # test-description-many ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -20,6 +20,6 @@ type Query { """ This is test """ - foo: Bar @http(path: "/foo") + foo: Bar @http(url: "http://jsonplacheholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-directives-undef-null-fields.md b/tests/execution/test-directives-undef-null-fields.md index 9f377da741..5db0b02de4 100644 --- a/tests/execution/test-directives-undef-null-fields.md +++ b/tests/execution/test-directives-undef-null-fields.md @@ -21,37 +21,33 @@ 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(url: "http://localhost:8080/user/{{.args.id}}/{{.headers.garbage}}/{{.vars.garbage}}") + userListArg(id: [ID]): User @http(url: "http://localhost:8080/user/{{.args.id}}") + userNullableArg(id: ID): User @http(url: "http://localhost:8080/user/{{.args.id}}") + userUndefinedArg(id: ID): User @http(url: "http://localhost:8080/user/{{.args.uid}}") } 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") - nestedUserNullable: User - @http(path: "/users/{{.value.nonNullableUser.nestedUser.id}}", baseURL: "http://localhost:8080") - nestedNonScalar: User - @http(path: "/users/{{.value.nonNullableUser.nonNullableNestedUser}}", baseURL: "http://localhost:8080") + user: User @http(url: "http://localhost:8080/users/{{.value.id}}") + nonNullableUser: User! @http(url: "http://localhost:8080/users/{{.value.id}}") + userArg: User @http(url: "http://localhost:8080/users/{{.args.id}}") + userInvalidDirective: User @http(url: "http://localhost:8080/users/{{.Vale.userId}}") + userNonScalar: User @http(url: "http://localhost:8080/users/{{.value.nonNullableUser}}") + userNullable: User @http(url: "http://localhost:8080/users/{{.value.user.id}}") + nestedUserNullable: User @http(url: "http://localhost:8080/users/{{.value.nonNullableUser.nestedUser.id}}") + nestedNonScalar: User @http(url: "http://localhost:8080/users/{{.value.nonNullableUser.nonNullableNestedUser}}") nestedUndefinedValue: User - @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(url: "http://localhost:8080/users/{{.value.nonNullableUser.nonNullableNestedUser.userId}}") + nestedNullable: User @http(url: "http://localhost:8080/users/{{.value.nonNullableUser.nonNullableNestedUser.id}}") + userNullValue: User @http(url: "http://localhost:8080/users/{{.value.userId}}") # 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") + userNullValueQuery: User @http(url: "http://localhost:8080/users", query: [{key: "id", value: "{{.value.id}}"}]) + userUndefinedValue: User @http(url: "http://localhost:8080/users/{{.value.userid}}") # 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(url: "http://localhost:8080/users", query: [{key: "id", value: "{{.value.userid}}"}]) + userVars: User @http(url: "http://localhost:8080/users/{{.vars.a}}") } ``` diff --git a/tests/execution/test-duplicated-link.md b/tests/execution/test-duplicated-link.md index 12b4697584..521197171b 100644 --- a/tests/execution/test-duplicated-link.md +++ b/tests/execution/test-duplicated-link.md @@ -5,16 +5,14 @@ error: true # test-duplicated-link ```graphql @file:jsonplaceholder.graphql -schema - @server(port: 8000, hostname: "0.0.0.0") - @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { +schema @server(port: 8000, hostname: "0.0.0.0") @upstream(httpCache: 42, batch: {delay: 100}) { query: Query } type Query { - posts: [Post] @http(path: "/posts") - users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { @@ -31,7 +29,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } ``` @@ -46,8 +44,8 @@ schema } type Query { - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { @@ -64,6 +62,6 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } ``` diff --git a/tests/execution/test-empty-link.md b/tests/execution/test-empty-link.md index 480c1615b2..3f23f3470a 100644 --- a/tests/execution/test-empty-link.md +++ b/tests/execution/test-empty-link.md @@ -5,13 +5,13 @@ error: true # test-empty-link ```graphql @config -schema @upstream(baseURL: "https://jsonplaceholder.typicode.com") @link(type: Config, src: "") @link(type: Config) { +schema @link(type: Config, src: "") @link(type: Config) { query: Query } type Query { - posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{.args.id}}") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/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(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } ``` diff --git a/tests/execution/test-enable-jit.md b/tests/execution/test-enable-jit.md index 5f889c6795..71b08311e7 100644 --- a/tests/execution/test-enable-jit.md +++ b/tests/execution/test-enable-jit.md @@ -1,14 +1,12 @@ # test-enable-jit ```graphql @config -schema - @server(port: 8000, hostname: "0.0.0.0", enableJIT: true) - @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000, hostname: "0.0.0.0", enableJIT: true) { query: Query } type Query @cache(maxAge: 30000) { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { @@ -21,7 +19,7 @@ type Post { id: Int! userId: Int! title: String! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } ``` diff --git a/tests/execution/test-enum-aliases.md b/tests/execution/test-enum-aliases.md index 2150205703..d45048b889 100644 --- a/tests/execution/test-enum-aliases.md +++ b/tests/execution/test-enum-aliases.md @@ -5,7 +5,7 @@ identity: true # test-enum-aliases ```graphql @config -schema @server @upstream(baseURL: "http://localhost:8080") { +schema @server @upstream { query: Query } diff --git a/tests/execution/test-enum-as-argument.md b/tests/execution/test-enum-as-argument.md index 917b0a7e4b..e7c03ae191 100644 --- a/tests/execution/test-enum-as-argument.md +++ b/tests/execution/test-enum-as-argument.md @@ -1,12 +1,16 @@ # test enum as argument ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } type Query { - user(id: Int!, test: Test): User @http(path: "/users/{{.args.id}}", query: [{key: "enum", value: "{{.args.test}}"}]) + user(id: Int!, test: Test): User + @http( + url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}" + query: [{key: "enum", value: "{{.args.test}}"}] + ) } enum Test { diff --git a/tests/execution/test-enum-default.md b/tests/execution/test-enum-default.md index 0b7d143267..d069982aac 100644 --- a/tests/execution/test-enum-default.md +++ b/tests/execution/test-enum-default.md @@ -32,13 +32,13 @@ message NewsList { # for test upstream server see [repo](https://github.com/tailcallhq/rust-grpc) schema @server(port: 8080) - @upstream(baseURL: "http://localhost:50051", httpCache: 42, batch: {delay: 10}) + @upstream(httpCache: 42, batch: {delay: 10}) @link(id: "news", src: "./service.proto", type: Protobuf) { query: Query } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") } enum Status { diff --git a/tests/execution/test-enum-description.md b/tests/execution/test-enum-description.md index 32045d6734..2e8deca038 100644 --- a/tests/execution/test-enum-description.md +++ b/tests/execution/test-enum-description.md @@ -5,7 +5,7 @@ identity: true # test-enum-description ```graphql @config -schema @server @upstream(baseURL: "http://localhost:8080") { +schema @server @upstream { query: Query } diff --git a/tests/execution/test-enum-empty.md b/tests/execution/test-enum-empty.md index adce03ea75..66fbac46c2 100644 --- a/tests/execution/test-enum-empty.md +++ b/tests/execution/test-enum-empty.md @@ -7,9 +7,6 @@ error: true ```json @config { "server": {}, - "upstream": { - "baseURL": "http://localhost:8080" - }, "schema": { "query": "Query" }, diff --git a/tests/execution/test-enum-merge.md b/tests/execution/test-enum-merge.md index 37f624198d..49f776448f 100644 --- a/tests/execution/test-enum-merge.md +++ b/tests/execution/test-enum-merge.md @@ -1,7 +1,7 @@ # test-enum-merge ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } @@ -11,12 +11,12 @@ enum Foo { } type Query { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } @@ -26,6 +26,6 @@ enum Foo { } type Query { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-enum.md b/tests/execution/test-enum.md index e09b2a45a1..7417e1b912 100644 --- a/tests/execution/test-enum.md +++ b/tests/execution/test-enum.md @@ -5,7 +5,7 @@ identity: true # test-enum ```graphql @config -schema @server @upstream(baseURL: "http://localhost:8080") { +schema @server @upstream { query: Query } diff --git a/tests/execution/test-expr-error.md b/tests/execution/test-expr-error.md index ab27b9a519..4967026f34 100644 --- a/tests/execution/test-expr-error.md +++ b/tests/execution/test-expr-error.md @@ -5,7 +5,7 @@ error: true # test-expr-error ```graphql @config -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server { query: Query } diff --git a/tests/execution/test-expr-with-add-field.md b/tests/execution/test-expr-with-add-field.md index 678a7cef9a..29a8f4ff56 100644 --- a/tests/execution/test-expr-with-add-field.md +++ b/tests/execution/test-expr-with-add-field.md @@ -5,12 +5,12 @@ error: true # test-expr-with-add-field ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } type Query @addField(name: "name", path: ["post", "user", "name"]) { - post: Post @http(path: "/posts/1") + post: Post @http(url: "http://jsonplaceholder.typicode.com/posts/1") } type Post { diff --git a/tests/execution/test-expr-with-inline.md b/tests/execution/test-expr-with-inline.md index d1ca322a5a..9e137d6c61 100644 --- a/tests/execution/test-expr-with-inline.md +++ b/tests/execution/test-expr-with-inline.md @@ -5,12 +5,12 @@ error: true # test-expr-with-inline ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } type Query @addField(name: "username", path: ["post", "user", "name"]) { - post: Post @http(path: "/posts/1") + post: Post @http(url: "http://jsonplaceholder.typicode.com/posts/1") } type Post { diff --git a/tests/execution/test-field-already-implemented-from-Interface.md b/tests/execution/test-field-already-implemented-from-Interface.md index 3bde65e8e9..06f5fbc223 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(url: "http://jsonplaceholder.typicode.com/user/{{.args.input.id}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-graphql-with-add-field.md b/tests/execution/test-graphql-with-add-field.md index 9c2ec25490..202b39d00d 100644 --- a/tests/execution/test-graphql-with-add-field.md +++ b/tests/execution/test-graphql-with-add-field.md @@ -5,12 +5,12 @@ error: true # test-graphql-with-add-field ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } type Query @addField(name: "name", path: ["post", "user", "name"]) { - post: Post @graphQL(name: "posts") + post: Post @graphQL(url: "http://jsonplaceholder.typicode.com", name: "posts") } type Post { @@ -18,7 +18,7 @@ type Post { title: String body: String userId: Int! - user: User @graphQL(name: "user") + user: User @graphQL(url: "http://jsonplaceholder.typicode.com", name: "user") } type User { diff --git a/tests/execution/test-graphqlsource-no-base-url.md b/tests/execution/test-graphqlsource-no-base-url.md index ff34233c55..d17f9bbffa 100644 --- a/tests/execution/test-graphqlsource-no-base-url.md +++ b/tests/execution/test-graphqlsource-no-base-url.md @@ -15,7 +15,7 @@ type Post { } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{.args.id}}") + post(id: Int!): Post @http(url: "http://jsonplaceholder.typicode.com/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-graphqlsource.md b/tests/execution/test-graphqlsource.md index 65b2cfbdc5..6a9728b0a0 100644 --- a/tests/execution/test-graphqlsource.md +++ b/tests/execution/test-graphqlsource.md @@ -5,18 +5,19 @@ identity: true # test-graphqlsource ```graphql @config -schema @server @upstream(baseURL: "http://localhost:8000/graphql") { +schema @server @upstream { query: Query } type Post { id: Int! - user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") + user: User + @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], url: "http://localhost:8000/graphql", 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(url: "http://jsonplaceholder.typicode.com/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-groupby-without-batching.md b/tests/execution/test-groupby-without-batching.md index e1ef65570c..53a82c4fbf 100644 --- a/tests/execution/test-groupby-without-batching.md +++ b/tests/execution/test-groupby-without-batching.md @@ -5,7 +5,7 @@ error: true # test-groupby-without-batching ```graphql @config -schema @upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42) { +schema @upstream(httpCache: 42) { query: Query } @@ -15,6 +15,11 @@ type User { } type Query { - user(id: Int!): User @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}], batchKey: ["id"]) + user(id: Int!): User + @http( + url: "http://jsonplaceholder.typicode.com/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 e0e6092715..397366b11e 100644 --- a/tests/execution/test-grpc-group-by.md +++ b/tests/execution/test-grpc-group-by.md @@ -52,7 +52,7 @@ type Query { newsById(news: NewsInput!): News! @grpc( method: "news.NewsService.GetMultipleNews" - baseURL: "http://localhost:50051" + url: "http://localhost:50051" body: "{{.args.news}}" batchKey: ["id"] ) diff --git a/tests/execution/test-grpc-invalid-method-format.md b/tests/execution/test-grpc-invalid-method-format.md index abee73580c..8553448234 100644 --- a/tests/execution/test-grpc-invalid-method-format.md +++ b/tests/execution/test-grpc-invalid-method-format.md @@ -10,7 +10,7 @@ schema { } type Query { - news: NewsData @grpc(method: "abc.NewsService", baseURL: "http://localhost:4000") + news: NewsData @grpc(method: "abc.NewsService", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc-invalid-proto-id.md b/tests/execution/test-grpc-invalid-proto-id.md index 4927ce1e1e..647a7e8a03 100644 --- a/tests/execution/test-grpc-invalid-proto-id.md +++ b/tests/execution/test-grpc-invalid-proto-id.md @@ -10,7 +10,7 @@ schema { } type Query { - news: NewsData @grpc(method: "abc.NewsService.GetAllNews", baseURL: "http://localhost:4000") + news: NewsData @grpc(method: "abc.NewsService.GetAllNews", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc-missing-fields.md b/tests/execution/test-grpc-missing-fields.md index 0fcbdc9962..c7cd3a6acf 100644 --- a/tests/execution/test-grpc-missing-fields.md +++ b/tests/execution/test-grpc-missing-fields.md @@ -45,7 +45,7 @@ schema @link(id: "news", src: "news.proto", type: Protobuf) { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:4000") + news: NewsData! @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc-nested-data.md b/tests/execution/test-grpc-nested-data.md index e5ca9f2b6d..ec29ca987e 100644 --- a/tests/execution/test-grpc-nested-data.md +++ b/tests/execution/test-grpc-nested-data.md @@ -49,9 +49,9 @@ schema } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") + news: NewsData! @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:50051") newsById(news: NewsInput!): [News]! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") + @grpc(method: "news.NewsService.GetNews", url: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/test-grpc-nested-optional.md b/tests/execution/test-grpc-nested-optional.md index 795dedc5e5..4738c57ef3 100644 --- a/tests/execution/test-grpc-nested-optional.md +++ b/tests/execution/test-grpc-nested-optional.md @@ -46,7 +46,7 @@ schema @link(id: "news", src: "news.proto", type: Protobuf) { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:4000") + news: NewsData! @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc-optional.md b/tests/execution/test-grpc-optional.md index c6640bb8b9..8ab1f9f632 100644 --- a/tests/execution/test-grpc-optional.md +++ b/tests/execution/test-grpc-optional.md @@ -46,7 +46,7 @@ schema @link(id: "news", src: "news.proto", type: Protobuf) { } type Query { - news: NewsData @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:4000") + news: NewsData @grpc(method: "news.NewsService.GetAllNews", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc-proto-path.md b/tests/execution/test-grpc-proto-path.md index f6495105d8..97e39e24e4 100644 --- a/tests/execution/test-grpc-proto-path.md +++ b/tests/execution/test-grpc-proto-path.md @@ -10,7 +10,7 @@ schema @link(id: "news", src: "tailcall/src/grpcnews.proto", type: Protobuf) { } type Query { - news: NewsData @grpc(method: "GetAllNews", baseURL: "http://localhost:4000") + news: NewsData @grpc(method: "GetAllNews", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc-service-method.md b/tests/execution/test-grpc-service-method.md index 3cdcc0deb2..4042cef8da 100644 --- a/tests/execution/test-grpc-service-method.md +++ b/tests/execution/test-grpc-service-method.md @@ -46,7 +46,7 @@ schema @link(id: "news", src: "news.proto", type: Protobuf) { } type Query { - news: NewsData @grpc(method: "news.NewsService.X", baseURL: "http://localhost:4000") + news: NewsData @grpc(method: "news.NewsService.X", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc-service.md b/tests/execution/test-grpc-service.md index 7c309085c2..d3b5e9875d 100644 --- a/tests/execution/test-grpc-service.md +++ b/tests/execution/test-grpc-service.md @@ -46,7 +46,7 @@ schema @link(id: "news", src: "news.proto", type: Protobuf) { } type Query { - news: NewsData @grpc(method: "news.YourServiceName.GetAllNews", baseURL: "http://localhost:4000") + news: NewsData @grpc(method: "news.YourServiceName.GetAllNews", url: "http://localhost:4000") } type NewsData { diff --git a/tests/execution/test-grpc.md b/tests/execution/test-grpc.md index 6751bf336e..92a7cb4f61 100644 --- a/tests/execution/test-grpc.md +++ b/tests/execution/test-grpc.md @@ -43,7 +43,7 @@ message NewsList { ```graphql @config schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 1000}) + @upstream(batch: {delay: 10, headers: [], maxSize: 1000}) @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } @@ -67,9 +67,15 @@ type NewsData { } type Query { - news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + news: NewsData! @grpc(url: "http://localhost:50051", method: "news.NewsService.GetAllNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") newsByIdBatch(news: NewsInput!): News! - @grpc(body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") + @grpc( + url: "http://localhost:50051" + body: "{{.args.news}}" + batchKey: ["news", "id"] + method: "news.NewsService.GetMultipleNews" + ) } ``` diff --git a/tests/execution/test-hostname-faliure.md b/tests/execution/test-hostname-faliure.md index 642822c10a..766a6abd96 100644 --- a/tests/execution/test-hostname-faliure.md +++ b/tests/execution/test-hostname-faliure.md @@ -15,6 +15,6 @@ type User { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(path: "/users/1", url: "http://jsonplaceholder.typicode.com") } ``` diff --git a/tests/execution/test-http-baseurl.md b/tests/execution/test-http-baseurl.md index aa2d1660f2..9f32f44b48 100644 --- a/tests/execution/test-http-baseurl.md +++ b/tests/execution/test-http-baseurl.md @@ -5,12 +5,12 @@ identity: true # test-http-baseurl ```graphql @config -schema @server @upstream(baseURL: "http://abc.com") { +schema @server @upstream { query: Query } type Query { - bar: String @http(path: "/bar") - foo: String @http(baseURL: "http://foo.com", path: "/foo") + bar: String @http(url: "http://abc.com/bar") + foo: String @http(url: "http://foo.com/foo") } ``` diff --git a/tests/execution/test-http-batchKey.md b/tests/execution/test-http-batchKey.md index a502ce6e30..2d952368e6 100644 --- a/tests/execution/test-http-batchKey.md +++ b/tests/execution/test-http-batchKey.md @@ -1,14 +1,12 @@ # Http with args as body ```graphql @config -schema - @server(port: 8000) - @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: {maxSize: 1000, delay: 10}) { +schema @server(port: 8000) @upstream(batch: {maxSize: 1000, delay: 10}) { query: Query } type Query { - foos: FooResponse @http(path: "/foo") + foos: FooResponse @http(url: "http://jsonplaceholder.typicode.com/foo") } type FooResponse { @@ -21,7 +19,7 @@ type Foo { barId: String! bars: [Bar!]! @http( - path: "/bar" + url: "http://jsonplaceholder.typicode.com/bar" query: [ # {key: "baz", value: "static_value"} diff --git a/tests/execution/test-http-headers.md b/tests/execution/test-http-headers.md index 3478aa9a6f..30e7ee81e3 100644 --- a/tests/execution/test-http-headers.md +++ b/tests/execution/test-http-headers.md @@ -5,11 +5,11 @@ identity: true # test-http-headers ```graphql @config -schema @server @upstream(baseURL: "http://localhost:4000") { +schema @server @upstream { query: Query } type Query { - foo: String @http(headers: [{key: "foo", value: "bar"}], path: "/foo") + foo: String @http(url: "http://localhost:4000/foo", headers: [{key: "foo", value: "bar"}]) } ``` diff --git a/tests/execution/test-http-tmpl.md b/tests/execution/test-http-tmpl.md index 3897b3b761..38cccf1537 100644 --- a/tests/execution/test-http-tmpl.md +++ b/tests/execution/test-http-tmpl.md @@ -5,18 +5,18 @@ identity: true # test-http-tmpl ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Post { id: Int - user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) + user: User @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { diff --git a/tests/execution/test-http-with-add-field.md b/tests/execution/test-http-with-add-field.md index 64ce932f30..667ecab7d9 100644 --- a/tests/execution/test-http-with-add-field.md +++ b/tests/execution/test-http-with-add-field.md @@ -5,12 +5,12 @@ error: true # test-http-with-add-field ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } type Query @addField(name: "name", path: ["post", "user", "name"]) { - post: Post @http(path: "/posts/1") + post: Post @http(url: "http://jsonplaceholder.typicode.com/posts/1") } type Post { @@ -18,7 +18,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } type User { diff --git a/tests/execution/test-http-with-inline.md b/tests/execution/test-http-with-inline.md index 5df1233b04..987e950b37 100644 --- a/tests/execution/test-http-with-inline.md +++ b/tests/execution/test-http-with-inline.md @@ -5,12 +5,14 @@ error: true # test-http-with-inline ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } type Query @addField(name: "username", path: ["post", "user", "name"]) { - post: Post @http(path: "/posts/1") @http(path: "/users/{{.value.userId}}") + post: Post + @http(url: "http://jsonplaceholder.typicode.com/posts/1") + @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } type Post { @@ -18,7 +20,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/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 b38dce601f..c8c7fc45a7 100644 --- a/tests/execution/test-http-with-mustache-expr.md +++ b/tests/execution/test-http-with-mustache-expr.md @@ -6,7 +6,7 @@ schema { } type Query { - a: A @http(baseURL: "http://localhost:3000", path: "/a") + a: A @http(url: "http://localhost:3000/a") } type A { diff --git a/tests/execution/test-http.md b/tests/execution/test-http.md index 379a49aecc..7db87c9881 100644 --- a/tests/execution/test-http.md +++ b/tests/execution/test-http.md @@ -5,12 +5,12 @@ identity: true # test-http ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - foo: [User] @http(path: "/users") + foo: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/execution/test-inline-error.md b/tests/execution/test-inline-error.md index 0f9cff3528..4ef115d3f2 100644 --- a/tests/execution/test-inline-error.md +++ b/tests/execution/test-inline-error.md @@ -18,6 +18,6 @@ type Address { } type Query @addField(name: "street", path: ["user", "address", "street"]) { - user: User @http(path: "/user/1", baseURL: "http://localhost:8000") + user: User @http(url: "http://localhost:8000/user/1") } ``` diff --git a/tests/execution/test-inline-list.md b/tests/execution/test-inline-list.md index 76642d7759..77236cb184 100644 --- a/tests/execution/test-inline-list.md +++ b/tests/execution/test-inline-list.md @@ -5,7 +5,7 @@ identity: true # test-inline-list ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,6 +22,6 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") @modify(omit: true) + foo: [Foo] @http(url: "http://jsonplaceholder.typicode.com/foo") @modify(omit: true) } ``` diff --git a/tests/execution/test-inline.md b/tests/execution/test-inline.md index 92b7f4dc67..b71b56bbba 100644 --- a/tests/execution/test-inline.md +++ b/tests/execution/test-inline.md @@ -5,7 +5,7 @@ identity: true # test-inline ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,6 +22,6 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") @modify(omit: true) + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") @modify(omit: true) } ``` diff --git a/tests/execution/test-input-documentation.md b/tests/execution/test-input-documentation.md index ee1293b032..ea4d15697f 100644 --- a/tests/execution/test-input-documentation.md +++ b/tests/execution/test-input-documentation.md @@ -5,7 +5,7 @@ identity: true # test-input-type-documentation ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query mutation: Mutation } @@ -21,7 +21,8 @@ input Foo { } type Mutation { - testDocumentation(input: Foo!): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") + testDocumentation(input: Foo!): Post + @http(url: "http://jsonplaceholder.typicode.com/posts", body: "{{.args.input}}", method: "POST") } type Post { @@ -33,7 +34,7 @@ type Post { Some Documentation """ type Query { - foo: String @http(path: "/foo") - postFromFoo(id: Int!): Post @http(path: "/posts?id={{.args.id}}") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") + postFromFoo(id: Int!): Post @http(url: "http://jsonplaceholder.typicode.com/posts?id={{.args.id}}") } ``` diff --git a/tests/execution/test-input-out.md b/tests/execution/test-input-out.md index f5bfaa141c..e3d5ee7fa1 100644 --- a/tests/execution/test-input-out.md +++ b/tests/execution/test-input-out.md @@ -7,11 +7,7 @@ schema { type Query { queryTest(filter: Filter): [MyType] - @graphQL( - name: "getMyType" - args: [{key: "filter", value: "{{.args.filter}}"}] - baseURL: "http://localhost:8083/mesh" - ) + @graphQL(name: "getMyType", args: [{key: "filter", value: "{{.args.filter}}"}], url: "http://localhost:8083/mesh") } type Filter { diff --git a/tests/execution/test-input-with-arg-out.md b/tests/execution/test-input-with-arg-out.md index f6f6472cca..f4f2e3dc88 100644 --- a/tests/execution/test-input-with-arg-out.md +++ b/tests/execution/test-input-with-arg-out.md @@ -7,11 +7,7 @@ schema { type Query { queryTest(filter: StringFilter): [MyType] - @graphQL( - name: "getMyType" - args: [{key: "filter", value: "{{.args.filter}}"}] - baseURL: "http://localhost:8083/mesh" - ) + @graphQL(name: "getMyType", args: [{key: "filter", value: "{{.args.filter}}"}], url: "http://localhost:8083/mesh") } type StringFilter { diff --git a/tests/execution/test-interface-from-json.md b/tests/execution/test-interface-from-json.md index 9ba7bb9fa8..9d2e25dbb6 100644 --- a/tests/execution/test-interface-from-json.md +++ b/tests/execution/test-interface-from-json.md @@ -2,9 +2,6 @@ ```json @config { - "upstream": { - "baseURL": "http://jsonplaceholder.typicode.com" - }, "schema": { "query": "Query" }, @@ -40,7 +37,7 @@ "name": "B" }, "http": { - "path": "/posts" + "url": "http://jsonplaceholder.typicode.com/posts" } } } diff --git a/tests/execution/test-interface-result.md b/tests/execution/test-interface-result.md index 968a3d34f6..e538790eb8 100644 --- a/tests/execution/test-interface-result.md +++ b/tests/execution/test-interface-result.md @@ -5,7 +5,7 @@ identity: true # test-interface-result ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,6 +19,6 @@ type B implements IA { } type Query { - bar: IA @http(path: "/user") + bar: IA @http(url: "http://jsonplaceholder.typicode.com/user") } ``` diff --git a/tests/execution/test-interface.md b/tests/execution/test-interface.md index 313906d7e4..01459506d4 100644 --- a/tests/execution/test-interface.md +++ b/tests/execution/test-interface.md @@ -5,7 +5,7 @@ identity: true # test-interface ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -19,6 +19,6 @@ type B implements IA { } type Query { - bar: B @http(path: "/user") + bar: B @http(url: "http://jsonplaceholder.typicode.com/user") } ``` diff --git a/tests/execution/test-invalid-add-field.md b/tests/execution/test-invalid-add-field.md index cba10bd145..a66cff16d1 100644 --- a/tests/execution/test-invalid-add-field.md +++ b/tests/execution/test-invalid-add-field.md @@ -5,19 +5,19 @@ error: true # Test invalid add fields ```graphql @config -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) { query: Query } type Query { - postuser: [PostUser] @http(path: "/posts") + postuser: [PostUser] @http(url: "http://jsonplaceholder.typicode.com/posts") } type PostUser @addField(name: "username", path: "{{.value.user.username}}") { id: Int! @modify(name: "postId") title: String! userId: Int! - user: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/{{.value.userId}}") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.userId}}") } type User { diff --git a/tests/execution/test-invalid-query-in-http.md b/tests/execution/test-invalid-query-in-http.md index 9255af50f1..26453a2d3c 100644 --- a/tests/execution/test-invalid-query-in-http.md +++ b/tests/execution/test-invalid-query-in-http.md @@ -15,7 +15,6 @@ type User { } type Query { - user: [User] - @http(path: "/users", query: {key: "id", value: "{{.vars.id}}"}, baseURL: "http://jsonplaceholder.typicode.com") + user: [User] @http(url: "http://jsonplaceholder.typicode.com/users", query: {key: "id", value: "{{.vars.id}}"}) } ``` diff --git a/tests/execution/test-js-multi-onRequest-handlers.md b/tests/execution/test-js-multi-onRequest-handlers.md index dcfea97ae7..94d54c7532 100644 --- a/tests/execution/test-js-multi-onRequest-handlers.md +++ b/tests/execution/test-js-multi-onRequest-handlers.md @@ -29,13 +29,13 @@ function bar({request}) { ``` ```graphql @config -schema @server @upstream(baseURL: "http://localhost:3000", onRequest: "foo") @link(type: Script, src: "test1.js") { +schema @server @upstream(onRequest: "foo") @link(type: Script, src: "test1.js") { query: Query } type Query { - foo: String @http(baseURL: "http://localhost:3000", path: "/foo") - bar: String @http(baseURL: "http://localhost:3000", path: "/bar", onRequest: "bar") + foo: String @http(url: "http://localhost:3000/foo") + bar: String @http(url: "http://localhost:3000/bar", onRequest: "bar") } ``` diff --git a/tests/execution/test-js-multiple-scripts.md b/tests/execution/test-js-multiple-scripts.md index c2c023a452..9fc3038d41 100644 --- a/tests/execution/test-js-multiple-scripts.md +++ b/tests/execution/test-js-multiple-scripts.md @@ -18,7 +18,7 @@ schema @server @link(type: Script, src: "test1.js") @link(type: Script, src: "te } type Query { - hello: String @http(baseURL: "http://localhost:3000", path: "/hello") - hi: String @http(baseURL: "http://localhost:3000", path: "/hi") + hello: String @http(url: "http://localhost:3000/hello") + hi: String @http(url: "http://localhost:3000/hi") } ``` diff --git a/tests/execution/test-js-request-response-2.md b/tests/execution/test-js-request-response-2.md index c9e765ceef..85ca90874f 100644 --- a/tests/execution/test-js-request-response-2.md +++ b/tests/execution/test-js-request-response-2.md @@ -30,8 +30,8 @@ schema @server @upstream(onRequest: "onRequest") @link(type: Script, src: "test. } type Query { - hello: String @http(baseURL: "http://localhost:3000", path: "/hello") - hi: String @http(baseURL: "http://localhost:3000", path: "/hi") + hello: String @http(url: "http://localhost:3000/hello") + hi: String @http(url: "http://localhost:3000/hi") } ``` diff --git a/tests/execution/test-js-request-response.md b/tests/execution/test-js-request-response.md index 200eb27abc..b1173ab755 100644 --- a/tests/execution/test-js-request-response.md +++ b/tests/execution/test-js-request-response.md @@ -28,8 +28,8 @@ schema @server @upstream(onRequest: "onRequest") @link(type: Script, src: "test. } type Query { - hello: String @http(baseURL: "http://localhost:3000", path: "/hello") - hi: String @http(baseURL: "http://localhost:3000", path: "/hi") + hello: String @http(url: "http://localhost:3000/hello") + hi: String @http(url: "http://localhost:3000/hi") } ``` diff --git a/tests/execution/test-lack-resolver.md b/tests/execution/test-lack-resolver.md index 0f22079737..06c915f7ad 100644 --- a/tests/execution/test-lack-resolver.md +++ b/tests/execution/test-lack-resolver.md @@ -5,7 +5,7 @@ error: true # test-lack-resolver ```graphql @config -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) { query: Query } @@ -22,7 +22,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { diff --git a/tests/execution/test-link-support.md b/tests/execution/test-link-support.md index fc9e497887..cba33c2127 100644 --- a/tests/execution/test-link-support.md +++ b/tests/execution/test-link-support.md @@ -27,7 +27,7 @@ message NewsId { ```graphql @config schema @server(port: 8000) - @upstream(baseURL: "http://localhost:50051", batch: {delay: 10, headers: [], maxSize: 1000}) + @upstream(batch: {delay: 10, headers: [], maxSize: 1000}) @link(id: "news", src: "news.proto", meta: {description: "Test"}, type: Protobuf) { query: Query } @@ -45,6 +45,7 @@ type NewsData { } type Query { - newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + newsById(news: NewsInput!): News! + @grpc(url: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } ``` diff --git a/tests/execution/test-list-args.md b/tests/execution/test-list-args.md index 4bddf68e08..b24706da6a 100644 --- a/tests/execution/test-list-args.md +++ b/tests/execution/test-list-args.md @@ -1,12 +1,12 @@ # With List args ```graphql @config -schema @server(queryValidation: true) @upstream(baseURL: "http://localhost:3000") { +schema @server(queryValidation: true) { query: Query } type Query { - f1(q: [Int!]!): T1 @http(path: "/api", query: [{key: "q", value: "{{.args.q}}"}]) + f1(q: [Int!]!): T1 @http(url: "http://localhost:3000/api", query: [{key: "q", value: "{{.args.q}}"}]) } type T1 { diff --git a/tests/execution/test-merge-input.md b/tests/execution/test-merge-input.md index fe7e9e54d9..11deca1961 100644 --- a/tests/execution/test-merge-input.md +++ b/tests/execution/test-merge-input.md @@ -1,7 +1,7 @@ # Test merge input ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } @@ -11,12 +11,12 @@ input Test { } type Query { - foo(x: Test): Boolean @http(path: "/foo") + foo(x: Test): Boolean @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } @@ -26,6 +26,6 @@ input Test { } type Query { - foo(x: Test): Boolean @http(path: "/foo") + foo(x: Test): Boolean @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-merge-invalid.md b/tests/execution/test-merge-invalid.md index 09167f9f74..71cb0b0838 100644 --- a/tests/execution/test-merge-invalid.md +++ b/tests/execution/test-merge-invalid.md @@ -5,7 +5,7 @@ error: true # Test merge error ```graphql @config -schema @server @upstream(baseURL: "http://abc.com") { +schema @server { query: Query } diff --git a/tests/execution/test-merge-nested.md b/tests/execution/test-merge-nested.md index 75fe73e4ac..34aad648af 100644 --- a/tests/execution/test-merge-nested.md +++ b/tests/execution/test-merge-nested.md @@ -1,7 +1,7 @@ # test-merge-nested ```graphql @config -schema @server @upstream(baseURL: "http://abc.com") { +schema @server { query: Query } diff --git a/tests/execution/test-merge-query.md b/tests/execution/test-merge-query.md index 0f424842a5..2ff91c33ba 100644 --- a/tests/execution/test-merge-query.md +++ b/tests/execution/test-merge-query.md @@ -1,7 +1,7 @@ # test-merge-query ```graphql @config -schema @server(port: 3000) @upstream(baseURL: "http://abc.com") { +schema @server(port: 3000) { query: Query } diff --git a/tests/execution/test-merge-server-sdl.md b/tests/execution/test-merge-server-sdl.md index 4468051544..96f777374d 100644 --- a/tests/execution/test-merge-server-sdl.md +++ b/tests/execution/test-merge-server-sdl.md @@ -1,12 +1,12 @@ # test-merge-server-sdl ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } type Query { - foo: [User] @http(path: "/users") + foo: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } type User { diff --git a/tests/execution/test-merge-union.md b/tests/execution/test-merge-union.md index 7c63c15b49..ac69f3872a 100644 --- a/tests/execution/test-merge-union.md +++ b/tests/execution/test-merge-union.md @@ -1,7 +1,7 @@ # test-merge-union ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } @@ -16,12 +16,12 @@ type Foo { } type Query { - foo: FooBar @http(path: "/foo") + foo: FooBar @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } @@ -37,6 +37,6 @@ type Foo { } type Query { - foo: FooBar @http(path: "/foo") + foo: FooBar @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-missing-argument-on-all-resolvers.md b/tests/execution/test-missing-argument-on-all-resolvers.md index 23370c3535..995635d3e5 100644 --- a/tests/execution/test-missing-argument-on-all-resolvers.md +++ b/tests/execution/test-missing-argument-on-all-resolvers.md @@ -41,7 +41,7 @@ message NewsList { ``` ```graphql @config -schema @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(id: "news", src: "news.proto", type: Protobuf) { +schema @link(id: "news", src: "news.proto", type: Protobuf) { query: Query } @@ -61,12 +61,20 @@ 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(url: "http://jsonplaceholder.typicode.com", name: "post", args: [{key: "id", value: "{{.args.id}}"}]) + postGraphQLHeaders: Post + @graphQL(url: "http://jsonplaceholder.typicode.com", name: "post", headers: [{key: "id", value: "{{.args.id}}"}]) + postHttp: Post @http(path: "http://jsonplaceholder.typicode.com/posts/{{.args.id}}") + newsGrpcHeaders: NewsData! + @grpc( + url: "http://jsonplaceholder.typicode.com" + method: "news.NewsService.GetAllNews" + headers: [{key: "id", value: "{{.args.id}}"}] + ) + newsGrpcUrl: NewsData! @grpc(method: "news.NewsService.GetAllNews", url: "{{.args.url}}") + newsGrpcBody: NewsData! + @grpc(url: "http://jsonplaceholder.typicode.com", method: "news.NewsService.GetAllNews", body: "{{.args.id}}") } type User { diff --git a/tests/execution/test-missing-mutation-resolver.md b/tests/execution/test-missing-mutation-resolver.md index 2c6dc4a704..c52e7e29f0 100644 --- a/tests/execution/test-missing-mutation-resolver.md +++ b/tests/execution/test-missing-mutation-resolver.md @@ -11,7 +11,7 @@ schema { } type Query { - user: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/user/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/user/1") } type User { diff --git a/tests/execution/test-modify.md b/tests/execution/test-modify.md index 7d1722cd08..35dbec5c66 100644 --- a/tests/execution/test-modify.md +++ b/tests/execution/test-modify.md @@ -5,7 +5,7 @@ identity: true # test-modify ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -14,6 +14,6 @@ input Foo { } type Query { - foo(input: Foo): String @http(path: "/foo") @modify(name: "data") + foo(input: Foo): String @http(url: "http://jsonplaceholder.typicode.com/foo") @modify(name: "data") } ``` diff --git a/tests/execution/test-multi-interface.md b/tests/execution/test-multi-interface.md index 13fb0aff1c..c0f49847cb 100644 --- a/tests/execution/test-multi-interface.md +++ b/tests/execution/test-multi-interface.md @@ -5,7 +5,7 @@ identity: true # test-multi-interface ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -23,6 +23,6 @@ type B implements IA & IB { } type Query { - bar: B @http(path: "/user") + bar: B @http(url: "http://jsonplaceholder.typicode.com/user") } ``` diff --git a/tests/execution/test-multiple-resolvable-directives-on-field.md b/tests/execution/test-multiple-resolvable-directives-on-field.md index a1286804cb..3be44ee54f 100644 --- a/tests/execution/test-multiple-resolvable-directives-on-field.md +++ b/tests/execution/test-multiple-resolvable-directives-on-field.md @@ -5,7 +5,7 @@ error: true # test-multiple-resolvable-directives-on-field ```graphql @config -schema @server @upstream(baseURL: "https://jsonplaceholder.typicode.com") { +schema @server { query: Query } @@ -15,7 +15,7 @@ type User { } type Query { - user1: User @expr(body: {name: "John"}) @http(path: "/users/1") - user2: User @http(path: "/users/2") @call(steps: [{query: "something"}]) + user1: User @expr(body: {name: "John"}) @http(url: "http://jsonplaceholder.typicode.com/users/1") + user2: User @http(url: "http://jsonplaceholder.typicode.com/users/2") @call(steps: [{query: "something"}]) } ``` diff --git a/tests/execution/test-nested-link.md b/tests/execution/test-nested-link.md index 6b2c2f0b23..19e9ad8fd0 100644 --- a/tests/execution/test-nested-link.md +++ b/tests/execution/test-nested-link.md @@ -5,7 +5,7 @@ identity: true # test-nested-link ```graphql @file:link-enum.graphql -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -15,23 +15,24 @@ enum Foo { } type Query { - foo: Foo @http(path: "/foo") + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` ```graphql @file:graphql-with-link.graphql -schema @server @upstream(baseURL: "http://localhost:8000/graphql") @link(src: "link-enum.graphql", type: Config) { +schema @server @link(src: "link-enum.graphql", type: Config) { query: Query } type Post { id: Int! userId: Int! - user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") + user: User + @graphQL(url: "http://jsonplaceholder.typicode.com", 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(url: "http://jsonplaceholder.typicode.com/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-nested-value.md b/tests/execution/test-nested-value.md index 3e45185610..adbca01b28 100644 --- a/tests/execution/test-nested-value.md +++ b/tests/execution/test-nested-value.md @@ -5,17 +5,17 @@ identity: true # test-nested-value ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Post { id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.id}}"}]) + user: User! @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.value.user.id}}"}]) } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type User { diff --git a/tests/execution/test-no-base-url.md b/tests/execution/test-no-base-url.md index 595eb74657..7cfe23fe58 100644 --- a/tests/execution/test-no-base-url.md +++ b/tests/execution/test-no-base-url.md @@ -14,6 +14,6 @@ type User { } type Query { - user: User @http(path: "/user/1") + user: User @http() } ``` diff --git a/tests/execution/test-null-in-array.md b/tests/execution/test-null-in-array.md index f77fb4d6b0..9eb7fd3abc 100644 --- a/tests/execution/test-null-in-array.md +++ b/tests/execution/test-null-in-array.md @@ -6,7 +6,7 @@ schema @server { } type Query { - hi(id: ID!): [Company] @http(baseURL: "http://localhost:3000", path: "/hi") + hi(id: ID!): [Company] @http(url: "http://localhost:3000/hi") } type Company { name: String diff --git a/tests/execution/test-null-in-object.md b/tests/execution/test-null-in-object.md index da55574d31..de14c23ed1 100644 --- a/tests/execution/test-null-in-object.md +++ b/tests/execution/test-null-in-object.md @@ -6,7 +6,7 @@ schema @server { } type Query { - hi(id: ID!): Company @http(baseURL: "http://localhost:3000", path: "/hi") + hi(id: ID!): Company @http(url: "http://localhost:3000/hi") } type Company { name: String diff --git a/tests/execution/test-omit-list.md b/tests/execution/test-omit-list.md index f41a62d17c..4b3aa019ae 100644 --- a/tests/execution/test-omit-list.md +++ b/tests/execution/test-omit-list.md @@ -5,7 +5,7 @@ identity: true # test-omit-list ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,6 +22,6 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "0", "b"]) { - foo: [Foo] @http(path: "/foo") @omit + foo: [Foo] @http(url: "http://jsonplaceholder.typicode.com/foo") @omit } ``` diff --git a/tests/execution/test-omit.md b/tests/execution/test-omit.md index 1cf4a916ce..690406b899 100644 --- a/tests/execution/test-omit.md +++ b/tests/execution/test-omit.md @@ -5,7 +5,7 @@ identity: true # test-omit ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -22,6 +22,6 @@ type Foo { } type Query @addField(name: "foo", path: ["foo", "a", "b"]) { - foo: Foo @http(path: "/foo") @omit + foo: Foo @http(url: "http://jsonplaceholder.typicode.com/foo") @omit } ``` diff --git a/tests/execution/test-optional-key-skip-empty.md b/tests/execution/test-optional-key-skip-empty.md index ef3156739c..026ca35e16 100644 --- a/tests/execution/test-optional-key-skip-empty.md +++ b/tests/execution/test-optional-key-skip-empty.md @@ -1,12 +1,12 @@ # Setting SkipEmpty ```graphql @config -schema @server(port: 8000) @upstream(baseURL: "http://example.com") { +schema @server(port: 8000) { query: Query } type Query { - foos: [Foo] @http(path: "/foos") + foos: [Foo] @http(url: "http://example.com/foos") } type Foo { @@ -14,7 +14,7 @@ type Foo { tag: String bar: Bar @http( - path: "/bar" + url: "http://example.com/bar" query: [ # Ignores this query param {key: "tagEmpty", value: "{{.value.tag}}", skipEmpty: true} diff --git a/tests/execution/test-params-as-body.md b/tests/execution/test-params-as-body.md index 5d44bd62fa..2dfd14680f 100644 --- a/tests/execution/test-params-as-body.md +++ b/tests/execution/test-params-as-body.md @@ -1,12 +1,13 @@ # Http with args as body ```graphql @config -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) { query: Query } type Query { - firstUser(id: Int, name: String): User @http(method: POST, path: "/users", body: "{{.args}}") + firstUser(id: Int, name: String): User + @http(method: POST, url: "http://jsonplaceholder.typicode.com/users", body: "{{.args}}") } type User { diff --git a/tests/execution/test-query-documentation.md b/tests/execution/test-query-documentation.md index 952e587e56..2054adbc71 100644 --- a/tests/execution/test-query-documentation.md +++ b/tests/execution/test-query-documentation.md @@ -5,7 +5,7 @@ identity: true # test-query-documentation ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } @@ -13,6 +13,6 @@ type Query { """ This is test """ - foo: String @http(path: "/foo") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-query.md b/tests/execution/test-query.md index e3dae6d8c4..0a0c443bb2 100644 --- a/tests/execution/test-query.md +++ b/tests/execution/test-query.md @@ -5,11 +5,11 @@ identity: true # test-query ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server @upstream { query: Query } type Query { - foo: String @http(path: "/foo") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-ref-other.md b/tests/execution/test-ref-other.md index 5d5377e532..b67fadd0f1 100644 --- a/tests/execution/test-ref-other.md +++ b/tests/execution/test-ref-other.md @@ -5,12 +5,12 @@ identity: true # test-ref-other ```graphql @config -schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8000) @upstream { query: Query } type InPost { - get: [Post] @http(path: "/posts") + get: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type Post { diff --git a/tests/execution/test-required-fields.md b/tests/execution/test-required-fields.md index 925051fd58..341c1c1a0a 100644 --- a/tests/execution/test-required-fields.md +++ b/tests/execution/test-required-fields.md @@ -1,33 +1,33 @@ # Test API ```graphql @config -schema @server(enableJIT: true) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(enableJIT: true) { query: Query } type Query { - basicPresent: Foo! @http(path: "/basic-present") - basicFieldMissing: Foo! @http(path: "/basic-field-missing") - basicMissing: Foo! @http(path: "/basic-missing") - relaxedPresent: Foo @http(path: "/relaxed-present") - relaxedFieldMissing: Foo @http(path: "/relaxed-field-missing") - relaxedMissing: Foo @http(path: "/relaxed-missing") - fullPresent: [Foo!]! @http(path: "/full-present") - fullMissing: [Foo!]! @http(path: "/full-missing") - fullFieldMissing: [Foo!]! @http(path: "/full-field-missing") - fullEntryMissing: [Foo!]! @http(path: "/full-entry-missing") - innerPresent: [Foo!] @http(path: "/inner-present") - innerMissing: [Foo!] @http(path: "/inner-missing") - innerFieldMissing: [Foo!] @http(path: "/inner-field-missing") - innerEntryMissing: [Foo!] @http(path: "/inner-entry-missing") - outerPresent: [Foo]! @http(path: "/outer-present") - outerMissing: [Foo]! @http(path: "/outer-missing") - outerFieldMissing: [Foo]! @http(path: "/outer-field-missing") - outerEntryMissing: [Foo]! @http(path: "/outer-entry-missing") - nonePresent: [Foo] @http(path: "/none-present") - noneMissing: [Foo] @http(path: "/none-missing") - noneFieldMissing: [Foo] @http(path: "/none-field-missing") - noneEntryMissing: [Foo] @http(path: "/none-entry-missing") + basicPresent: Foo! @http(url: "http://jsonplaceholder.typicode.com/basic-present") + basicFieldMissing: Foo! @http(url: "http://jsonplaceholder.typicode.com/basic-field-missing") + basicMissing: Foo! @http(url: "http://jsonplaceholder.typicode.com/basic-missing") + relaxedPresent: Foo @http(url: "http://jsonplaceholder.typicode.com/relaxed-present") + relaxedFieldMissing: Foo @http(url: "http://jsonplaceholder.typicode.com/relaxed-field-missing") + relaxedMissing: Foo @http(url: "http://jsonplaceholder.typicode.com/relaxed-missing") + fullPresent: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-present") + fullMissing: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-missing") + fullFieldMissing: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-field-missing") + fullEntryMissing: [Foo!]! @http(url: "http://jsonplaceholder.typicode.com/full-entry-missing") + innerPresent: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-present") + innerMissing: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-missing") + innerFieldMissing: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-field-missing") + innerEntryMissing: [Foo!] @http(url: "http://jsonplaceholder.typicode.com/inner-entry-missing") + outerPresent: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-present") + outerMissing: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-missing") + outerFieldMissing: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-field-missing") + outerEntryMissing: [Foo]! @http(url: "http://jsonplaceholder.typicode.com/outer-entry-missing") + nonePresent: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-present") + noneMissing: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-missing") + noneFieldMissing: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-field-missing") + noneEntryMissing: [Foo] @http(url: "http://jsonplaceholder.typicode.com/none-entry-missing") } type Foo { diff --git a/tests/execution/test-server-base-types.md b/tests/execution/test-server-base-types.md index 81a3a795b0..d67c359d14 100644 --- a/tests/execution/test-server-base-types.md +++ b/tests/execution/test-server-base-types.md @@ -1,7 +1,7 @@ # test-server-base-types ```graphql @config -schema @server(port: 3000) @upstream(baseURL: "http://abc.com") { +schema @server(port: 3000) { query: Query } diff --git a/tests/execution/test-server-vars.md b/tests/execution/test-server-vars.md index 252f37d93b..0a7a4e9fa0 100644 --- a/tests/execution/test-server-vars.md +++ b/tests/execution/test-server-vars.md @@ -5,11 +5,11 @@ identity: true # test-server-vars ```graphql @config -schema @server(vars: [{key: "foo", value: "bar"}]) @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server(vars: [{key: "foo", value: "bar"}]) @upstream { query: Query } type Query { - foo: String @http(path: "/foo") + foo: String @http(url: "http://jsonplaceholder.typicode.com/foo") } ``` diff --git a/tests/execution/test-set-cookie-headers.md b/tests/execution/test-set-cookie-headers.md index 0a59a12b3f..d9cc17c090 100644 --- a/tests/execution/test-set-cookie-headers.md +++ b/tests/execution/test-set-cookie-headers.md @@ -1,14 +1,12 @@ # Set Cookie Header ```graphql @config -schema - @server(port: 8080, hostname: "0.0.0.0", headers: {setCookies: true}) - @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server(port: 8080, hostname: "0.0.0.0", headers: {setCookies: true}) { query: Query } type Query { - user(id: Int!): User @http(path: "/users/{{.args.id}}") + user(id: Int!): User @http(url: "http://jsonplaceholder.typicode.com/users/{{.args.id}}") } type User { id: Int! diff --git a/tests/execution/test-static-value.md b/tests/execution/test-static-value.md index 530afe1298..960a74700e 100644 --- a/tests/execution/test-static-value.md +++ b/tests/execution/test-static-value.md @@ -15,8 +15,7 @@ "name": "User" }, "http": { - "path": "/users/1", - "baseURL": "http://jsonplaceholder.typicode.com" + "url": "http://jsonplaceholder.typicode.com/users/1" }, "cache": null } diff --git a/tests/execution/test-undefined-query.md b/tests/execution/test-undefined-query.md index 22267c3568..12b973d39b 100644 --- a/tests/execution/test-undefined-query.md +++ b/tests/execution/test-undefined-query.md @@ -5,20 +5,29 @@ error: true # test-undefined-query ```graphql @config -schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { +schema @server { query: Query } 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(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.value.test.id}}"}]) + nested: User! + @http(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.value.user.nested.test}}"}]) + innerNested: User! + @http( + url: "http://jsonplaceholder.typicode.com/users" + query: [{key: "id", value: "{{.value.user.nested.inner.test.id}}"}] + ) + innerIdNested: User! + @http( + url: "http://jsonplaceholder.typicode.com/users" + query: [{key: "id", value: "{{.value.user.nested.inner.id.test}}"}] + ) } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type Inner { diff --git a/tests/execution/test-union-ambiguous.md b/tests/execution/test-union-ambiguous.md index a992f2c5d3..f2be51ecb8 100644 --- a/tests/execution/test-union-ambiguous.md +++ b/tests/execution/test-union-ambiguous.md @@ -3,7 +3,7 @@ In some cases, when the resolved data shape does not strongly correspond to GraphQL types, the discriminator may return the first possible type or no possible types at all. ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } @@ -28,13 +28,13 @@ type Nested { } type Query { - arr: [FooBarBaz] @http(path: "/arr") - bar: FooBarBaz @http(path: "/bar") - foo: FooBarBaz @http(path: "/foo") - nested: Nested @http(path: "/nested") - unknown: FooBarBaz @http(path: "/unknown") - wrong: FooBarBaz @http(path: "/wrong") - string: FooBarBaz @http(path: "/string") + arr: [FooBarBaz] @http(url: "http://jsonplaceholder.typicode.com/arr") + bar: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/bar") + foo: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/foo") + nested: Nested @http(url: "http://jsonplaceholder.typicode.com/nested") + unknown: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/unknown") + wrong: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/wrong") + string: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/string") } ``` diff --git a/tests/execution/test-union-many-types.md b/tests/execution/test-union-many-types.md index ec9eae86f7..67f84d6214 100644 --- a/tests/execution/test-union-many-types.md +++ b/tests/execution/test-union-many-types.md @@ -7,7 +7,7 @@ skip: true TODO: snapshot mismatch when running the test on 32bit architecture ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } @@ -339,6 +339,6 @@ union AllTypes = | Type65 type Query { - allTypes: AllTypes @http(path: "/path") + allTypes: AllTypes @http(url: "http://jsonplaceholder.typicode.com/path") } ``` diff --git a/tests/execution/test-union-same-types.md b/tests/execution/test-union-same-types.md index d0c3d08d9f..0f254e5ea4 100644 --- a/tests/execution/test-union-same-types.md +++ b/tests/execution/test-union-same-types.md @@ -7,7 +7,7 @@ error: true In some cases, when the resolved data shape does not strongly correspond to GraphQL types, the discriminator may return the first possible type or no possible types at all. ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } @@ -26,6 +26,6 @@ type Foo { } type Query { - fooBarBaz: FooBarBaz @http(path: "/path") + fooBarBaz: FooBarBaz @http(url: "http://jsonplaceholder.typicode.com/path") } ``` diff --git a/tests/execution/test-union.md b/tests/execution/test-union.md index 907920a1ee..933d80347c 100644 --- a/tests/execution/test-union.md +++ b/tests/execution/test-union.md @@ -5,7 +5,7 @@ identity: true # Test union type resolve ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server @upstream { query: Query } @@ -25,11 +25,11 @@ type Nested { } type Query { - arr: [FooBar] @http(path: "/arr") - bar: FooBar @http(path: "/bar") - foo: FooBar @http(path: "/foo") - nested: Nested @http(path: "/nested") - unknown: FooBar @http(path: "/unknown") + arr: [FooBar] @http(url: "http://jsonplaceholder.typicode.com/arr") + bar: FooBar @http(url: "http://jsonplaceholder.typicode.com/bar") + foo: FooBar @http(url: "http://jsonplaceholder.typicode.com/foo") + nested: Nested @http(url: "http://jsonplaceholder.typicode.com/nested") + unknown: FooBar @http(url: "http://jsonplaceholder.typicode.com/unknown") } ``` diff --git a/tests/execution/test-upstream-headers.md b/tests/execution/test-upstream-headers.md index b36c2aa678..66fd983df6 100644 --- a/tests/execution/test-upstream-headers.md +++ b/tests/execution/test-upstream-headers.md @@ -1,11 +1,11 @@ # test-upstream-headers ```graphql @config -schema @upstream(baseURL: "http://jsonplaceholder.typicode.com", allowedHeaders: ["x-foo", "X-bar"]) { +schema @upstream(allowedHeaders: ["x-foo", "X-bar"]) { query: Query } type Query { - posts: [Post] @http(path: "/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/posts") } type Post { id: Int diff --git a/tests/execution/test-upstream.md b/tests/execution/test-upstream.md index a00bd85656..1eb43f28c1 100644 --- a/tests/execution/test-upstream.md +++ b/tests/execution/test-upstream.md @@ -10,6 +10,6 @@ schema @server @upstream(proxy: {url: "http://localhost:8085"}) { } type Query { - hello: String @http(baseURL: "http://localhost:8000", path: "/hello") + hello: String @http(url: "http://localhost:8000/hello") } ``` diff --git a/tests/execution/undeclared-type-no-base-url.md b/tests/execution/undeclared-type-no-base-url.md index 7095b15385..b4635843c3 100644 --- a/tests/execution/undeclared-type-no-base-url.md +++ b/tests/execution/undeclared-type-no-base-url.md @@ -10,6 +10,6 @@ schema @server { } type Query { - users: [User] @http(path: "/users") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } ``` diff --git a/tests/execution/undeclared-type.md b/tests/execution/undeclared-type.md index abe1af80ed..d0a0aa6280 100644 --- a/tests/execution/undeclared-type.md +++ b/tests/execution/undeclared-type.md @@ -10,6 +10,6 @@ schema @server { } type Query { - users: [User] @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users") + users: [User] @http(url: "http://jsonplaceholder.typicode.com/users") } ``` diff --git a/tests/execution/upstream-batching.md b/tests/execution/upstream-batching.md index b2b62dd5db..e65c735567 100644 --- a/tests/execution/upstream-batching.md +++ b/tests/execution/upstream-batching.md @@ -28,14 +28,13 @@ } }, "http": { - "path": "/users", + "url": "http://jsonplaceholder.typicode.com/users", "query": [ { "key": "id", "value": "{{.args.id}}" } ], - "baseURL": "http://jsonplaceholder.typicode.com", "batchKey": ["id"] }, "cache": null diff --git a/tests/execution/upstream-fail-request.md b/tests/execution/upstream-fail-request.md index 73d20dcd15..72c04a8685 100644 --- a/tests/execution/upstream-fail-request.md +++ b/tests/execution/upstream-fail-request.md @@ -11,7 +11,7 @@ type User { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } ``` diff --git a/tests/execution/with-args-url.md b/tests/execution/with-args-url.md index e5ac5a388c..ccb98f2cc0 100644 --- a/tests/execution/with-args-url.md +++ b/tests/execution/with-args-url.md @@ -3,9 +3,6 @@ ```json @config { "server": {}, - "upstream": { - "baseURL": "http://jsonplaceholder.typicode.com" - }, "schema": { "query": "Query" }, @@ -25,8 +22,7 @@ } }, "http": { - "path": "/users/{{.args.id}}", - "baseURL": "http://jsonplaceholder.typicode.com" + "url": "http://jsonplaceholder.typicode.com/users/{{.args.id}}" }, "cache": null } diff --git a/tests/execution/with-args.md b/tests/execution/with-args.md index 1fad4e79ba..d456d08596 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(url: "http://jsonplaceholder.typicode.com/users", query: [{key: "id", value: "{{.args.id}}"}]) } ``` diff --git a/tests/execution/with-nesting.md b/tests/execution/with-nesting.md index 2711fe5382..3938544b33 100644 --- a/tests/execution/with-nesting.md +++ b/tests/execution/with-nesting.md @@ -1,12 +1,12 @@ # With nesting ```graphql @config -schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { +schema @server { query: Query } type Query { - user: User @http(path: "/users/1") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") } type User { @@ -16,7 +16,7 @@ type User { email: String! phone: String website: String - posts: [Post] @http(path: "/users/{{.value.id}}/posts") + posts: [Post] @http(url: "http://jsonplaceholder.typicode.com/users/{{.value.id}}/posts") } type Post { diff --git a/tests/execution/yaml-nested-unions.md b/tests/execution/yaml-nested-unions.md index c066983f8a..2f3dee7431 100644 --- a/tests/execution/yaml-nested-unions.md +++ b/tests/execution/yaml-nested-unions.md @@ -48,8 +48,7 @@ types: name: U required: true http: - baseURL: http://localhost - path: /users/{{args.u}} + url: http://localhost/users/{{args.u}} unions: U1: diff --git a/tests/execution/yaml-union-in-type.md b/tests/execution/yaml-union-in-type.md index 9b1a73af89..2074c69945 100644 --- a/tests/execution/yaml-union-in-type.md +++ b/tests/execution/yaml-union-in-type.md @@ -60,8 +60,7 @@ types: type: name: NNU http: - baseURL: http://localhost - path: /users/{{args.nu.u}} + url: http://localhost/users/{{args.nu.u}} unions: U: diff --git a/tests/execution/yaml-union.md b/tests/execution/yaml-union.md index ac5db090a1..e15d9eeec9 100644 --- a/tests/execution/yaml-union.md +++ b/tests/execution/yaml-union.md @@ -46,8 +46,7 @@ types: name: U required: true http: - baseURL: http://localhost - path: /users/{{args.u}}/ + url: http://localhost/users/{{args.u}}/ unions: U: diff --git a/tests/http/config/simple.graphql b/tests/http/config/simple.graphql index bafaa0da68..fb1e60ae2b 100644 --- a/tests/http/config/simple.graphql +++ b/tests/http/config/simple.graphql @@ -8,5 +8,5 @@ type User { } type Query { - user: User @http(path: "/users/1", baseURL: "http://jsonplaceholder.typicode.com") + user: User @http(url: "http://jsonplaceholder.typicode.com/users/1") }