diff --git a/README.md b/README.md index eae6486f90..646291f793 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,7 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -81,7 +81,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/ci-benchmark/benchmark.graphql b/ci-benchmark/benchmark.graphql index 7543878906..aac44a69ad 100644 --- a/ci-benchmark/benchmark.graphql +++ b/ci-benchmark/benchmark.graphql @@ -22,5 +22,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/auth.graphql b/examples/auth.graphql index fdafd9fe1f..f8d50d242e 100644 --- a/examples/auth.graphql +++ b/examples/auth.graphql @@ -9,11 +9,11 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type Mutation { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User @protected { @@ -30,5 +30,5 @@ type Post { userId: Int! title: String! body: String! @protected - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/call.graphql b/examples/call.graphql index 8849d9b436..76da11d1d0 100644 --- a/examples/call.graphql +++ b/examples/call.graphql @@ -10,13 +10,13 @@ type Post { } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") firstUser: User @call(steps: [{query: "user", args: {id: 1}}]) - postFromUser(userId: Int!): [Post] @http(path: "/posts?userId={{args.userId}}") + postFromUser(userId: Int!): [Post] @http(path: "/posts?userId={{.args.userId}}") } type User { id: Int name: String - posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{.value.id}}"}}]) } diff --git a/examples/graphql-composition.graphql b/examples/graphql-composition.graphql index 008051561c..e7079e1250 100644 --- a/examples/graphql-composition.graphql +++ b/examples/graphql-composition.graphql @@ -17,7 +17,7 @@ type Post { userId: Int! title: String! body: String! - user: User @graphQL(name: "user", args: [{key: "id", value: "{{value.userId}}"}]) + user: User @graphQL(name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type User { diff --git a/examples/grpc.graphql b/examples/grpc.graphql index 6e775b291a..bde011c3ca 100644 --- a/examples/grpc.graphql +++ b/examples/grpc.graphql @@ -8,9 +8,9 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}") + newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{.args.news}}") newsByIdBatch(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetMultipleNews", body: "{{args.news}}", batchKey: ["news", "id"]) + @grpc(method: "news.NewsService.GetMultipleNews", body: "{{.args.news}}", batchKey: ["news", "id"]) } type News { diff --git a/examples/jsonplaceholder.graphql b/examples/jsonplaceholder.graphql index 5a0ede4396..028bc1b047 100644 --- a/examples/jsonplaceholder.graphql +++ b/examples/jsonplaceholder.graphql @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } diff --git a/examples/jsonplaceholder_batch.graphql b/examples/jsonplaceholder_batch.graphql index 979d3d372a..4c5eb45081 100644 --- a/examples/jsonplaceholder_batch.graphql +++ b/examples/jsonplaceholder_batch.graphql @@ -22,5 +22,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}], batchKey: ["id"]) + user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}], batchKey: ["id"]) } diff --git a/examples/jsonplaceholder_http_2.graphql b/examples/jsonplaceholder_http_2.graphql index 2432391877..5ac363643f 100644 --- a/examples/jsonplaceholder_http_2.graphql +++ b/examples/jsonplaceholder_http_2.graphql @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/jsonplaceholder_script.graphql b/examples/jsonplaceholder_script.graphql index b1ad5250c1..ab23e05e47 100644 --- a/examples/jsonplaceholder_script.graphql +++ b/examples/jsonplaceholder_script.graphql @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/rest-api.graphql b/examples/rest-api.graphql index 21ef0c6d80..11191d3586 100644 --- a/examples/rest-api.graphql +++ b/examples/rest-api.graphql @@ -8,7 +8,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -25,5 +25,5 @@ type Post { userId: Int! title: String! body: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } diff --git a/examples/telemetry-otlp.graphql b/examples/telemetry-otlp.graphql index b3725c781e..873130e3c4 100644 --- a/examples/telemetry-otlp.graphql +++ b/examples/telemetry-otlp.graphql @@ -9,7 +9,7 @@ schema url: "https://api.honeycomb.io:443" # gather api key from https://ui.honeycomb.io and set it as env when running tailcall headers: [ - {key: "x-honeycomb-team", value: "{{env.HONEYCOMB_API_KEY}}"} + {key: "x-honeycomb-team", value: "{{.env.HONEYCOMB_API_KEY}}"} {key: "x-honeycomb-dataset", value: "tailcall"} ] } @@ -21,7 +21,7 @@ schema type Query { posts: [Post] @http(path: "/posts") @cache(maxAge: 3000) - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") users: [User] @http(path: "/users") news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") } @@ -40,7 +40,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type News { diff --git a/examples/telemetry-prometheus.graphql b/examples/telemetry-prometheus.graphql index 8b16fd9367..0fe17bd38d 100644 --- a/examples/telemetry-prometheus.graphql +++ b/examples/telemetry-prometheus.graphql @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") @cache(maxAge: 5000) - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/examples/telemetry-stdout.graphql b/examples/telemetry-stdout.graphql index b57997e48d..572d980a1e 100644 --- a/examples/telemetry-stdout.graphql +++ b/examples/telemetry-stdout.graphql @@ -7,7 +7,7 @@ schema type Query { posts: [Post] @http(path: "/posts") @cache(maxAge: 5000) - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -24,5 +24,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/src/mustache.rs b/src/mustache.rs index 51b595544e..7ced733c41 100644 --- a/src/mustache.rs +++ b/src/mustache.rs @@ -1,3 +1,5 @@ +use std::fmt::Display; + use nom::branch::alt; use nom::bytes::complete::{tag, take_until}; use nom::character::complete::char; @@ -92,9 +94,9 @@ impl Mustache { } } -impl ToString for Mustache { - fn to_string(&self) -> String { - match self { +impl Display for Mustache { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let str = match self { Mustache(segments) => segments .iter() .map(|segment| match segment { @@ -103,7 +105,8 @@ impl ToString for Mustache { }) .collect::>() .join(""), - } + }; + write!(f, "{}", str) } } @@ -127,8 +130,11 @@ fn parse_expression(input: &str) -> IResult<&str, Segment> { delimited( tag("{{"), map( - nom::multi::separated_list1(char('.'), parse_name), - Segment::Expression, + nom::sequence::tuple(( + nom::combinator::opt(char('.')), // Optional leading dot + nom::multi::separated_list1(char('.'), parse_name), + )), + |(_, expr_parts)| Segment::Expression(expr_parts), ), tag("}}"), )(input) diff --git a/tailcall-query-plan/tests/config/user-posts.graphql b/tailcall-query-plan/tests/config/user-posts.graphql index a4fa2ba3d3..079c492893 100644 --- a/tailcall-query-plan/tests/config/user-posts.graphql +++ b/tailcall-query-plan/tests/config/user-posts.graphql @@ -7,8 +7,8 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") - post(id: Int!): Post @http(path: "/posts/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") + post(id: Int!): Post @http(path: "/posts/{{.args.id}}") } type User { @@ -17,7 +17,7 @@ type User { username: String! email: String! phone: String - website: String @expr(body: "/users/website/{{value.username}}") + website: String @expr(body: "/users/website/{{.value.username}}") } type Post { @@ -25,5 +25,5 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } diff --git a/tests/execution/batching-default.md b/tests/execution/batching-default.md index 9cb95b52d7..d19cfe9c92 100644 --- a/tests/execution/batching-default.md +++ b/tests/execution/batching-default.md @@ -15,7 +15,11 @@ type Post { body: String userId: Int! user: User - @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}], batchKey: ["id"]) + @http( + path: "/users" + query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] + batchKey: ["id"] + ) } type User { diff --git a/tests/execution/batching-disabled.md b/tests/execution/batching-disabled.md index 357a3ba902..7d8e03c9eb 100644 --- a/tests/execution/batching-disabled.md +++ b/tests/execution/batching-disabled.md @@ -27,7 +27,7 @@ } }, "http": { - "path": "/users/{{args.id}}" + "path": "/users/{{.args.id}}" }, "cache": null } diff --git a/tests/execution/batching-group-by-default.md b/tests/execution/batching-group-by-default.md index 1d61ba0fa7..738f736cf3 100644 --- a/tests/execution/batching-group-by-default.md +++ b/tests/execution/batching-group-by-default.md @@ -17,7 +17,11 @@ type Post { body: String userId: Int! user: User - @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) + @http( + batchKey: ["id"] + path: "/users" + query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] + ) } type User { diff --git a/tests/execution/batching-group-by.md b/tests/execution/batching-group-by.md index b82baa38bd..d5da78701f 100644 --- a/tests/execution/batching-group-by.md +++ b/tests/execution/batching-group-by.md @@ -17,7 +17,11 @@ type Post { body: String userId: Int! user: User - @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}], batchKey: ["id"]) + @http( + path: "/users" + query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}] + batchKey: ["id"] + ) } type User { diff --git a/tests/execution/batching-post.md b/tests/execution/batching-post.md index 8d9e2c25b3..e298206f1b 100644 --- a/tests/execution/batching-post.md +++ b/tests/execution/batching-post.md @@ -20,7 +20,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type User { diff --git a/tests/execution/cache-control.md b/tests/execution/cache-control.md index d6d0e1ab86..efb6a3fd9e 100644 --- a/tests/execution/cache-control.md +++ b/tests/execution/cache-control.md @@ -26,7 +26,7 @@ "query": [ { "key": "id", - "value": "{{args.id}}" + "value": "{{.args.id}}" } ], "baseURL": "http://jsonplaceholder.typicode.com" diff --git a/tests/execution/caching-collision.md b/tests/execution/caching-collision.md index 786096fa91..ede3c014fd 100644 --- a/tests/execution/caching-collision.md +++ b/tests/execution/caching-collision.md @@ -15,7 +15,7 @@ type Foo { type Bar { id: String! - foo: Foo @http(path: "/foo?id={{value.id}}") @cache(maxAge: 300) + foo: Foo @http(path: "/foo?id={{.value.id}}") @cache(maxAge: 300) } ``` diff --git a/tests/execution/call-graphql-datasource.md b/tests/execution/call-graphql-datasource.md index 143dd45bda..bbe28c7dd8 100644 --- a/tests/execution/call-graphql-datasource.md +++ b/tests/execution/call-graphql-datasource.md @@ -10,7 +10,7 @@ schema type Query { posts: [Post] @http(path: "/posts") user(id: Int!): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -27,7 +27,7 @@ type Post { userId: Int! title: String! body: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } ``` diff --git a/tests/execution/call-multiple-steps-piping.md b/tests/execution/call-multiple-steps-piping.md index 5bec224b00..fba8b69b7b 100644 --- a/tests/execution/call-multiple-steps-piping.md +++ b/tests/execution/call-multiple-steps-piping.md @@ -6,18 +6,18 @@ schema { } type Query { - a_input(input: JSON): JSON @expr(body: {input: "{{args.input.a}}"}) - b_input(input: JSON): JSON @expr(body: {input: "{{args.input.b}}"}) - a(input: JSON): JSON @expr(body: "{{args.input.a}}") - b(input: JSON): JSON @expr(body: "{{args.input.b}}") - c(input: JSON): JSON @expr(body: "{{args.input.c}}") - wrap_args: JSON @expr(body: {input: "{{args}}"}) - wrap_input(input: JSON): JSON @expr(body: {input: "{{args.input}}"}) + a_input(input: JSON): JSON @expr(body: {input: "{{.args.input.a}}"}) + b_input(input: JSON): JSON @expr(body: {input: "{{.args.input.b}}"}) + a(input: JSON): JSON @expr(body: "{{.args.input.a}}") + b(input: JSON): JSON @expr(body: "{{.args.input.b}}") + c(input: JSON): JSON @expr(body: "{{.args.input.c}}") + wrap_args: JSON @expr(body: {input: "{{.args}}"}) + wrap_input(input: JSON): JSON @expr(body: {input: "{{.args.input}}"}) abc_input(input: JSON): JSON @call( steps: [ - {query: "wrap_input", args: {input: "{{args.input}}"}} + {query: "wrap_input", args: {input: "{{.args.input}}"}} {query: "a_input"} {query: "wrap_input"} {query: "b_input"} @@ -28,7 +28,7 @@ type Query { abc(input: JSON): JSON @call( steps: [ - {query: "a", args: {input: "{{args.input}}"}} + {query: "a", args: {input: "{{.args.input}}"}} {query: "wrap_args"} {query: "b"} {query: "wrap_args"} diff --git a/tests/execution/call-mutation.md b/tests/execution/call-mutation.md index 118611634f..38b1902190 100644 --- a/tests/execution/call-mutation.md +++ b/tests/execution/call-mutation.md @@ -20,16 +20,16 @@ input PostInputWithoutUserId { type Mutation { attachPostToFirstUser(postId: Int!): User - @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{args.postId}}", userId: 1}}]) + @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{.args.postId}}", userId: 1}}]) attachPostToUser(userId: Int!, postId: Int!): User - @http(body: "{\"postId\":{{args.postId}}}", method: "PATCH", path: "/users/{{args.userId}}") - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + @http(body: "{\"postId\":{{.args.postId}}}", method: "PATCH", path: "/users/{{.args.userId}}") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") insertPostToFirstUser(input: PostInputWithoutUserId): Post - @call(steps: [{mutation: "insertPostToUser", args: {input: "{{args.input}}", userId: 1}}]) + @call(steps: [{mutation: "insertPostToUser", args: {input: "{{.args.input}}", userId: 1}}]) insertMockedPost: Post @call(steps: [{mutation: "insertPost", args: {input: {body: "post-body", title: "post-title", userId: 1}}}]) insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post - @http(body: "{{args.input}}", method: "POST", path: "/users/{{args.userId}}/posts") + @http(body: "{{.args.input}}", method: "POST", path: "/users/{{.args.userId}}/posts") } type Post { @@ -41,13 +41,13 @@ type Post { type Query { firstUser: User @http(method: "GET", path: "/users/1") - postFromUser(userId: Int!): Post @http(path: "/posts?userId={{args.userId}}") + postFromUser(userId: Int!): Post @http(path: "/posts?userId={{.args.userId}}") } type User { id: Int name: String - posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{.value.id}}"}}]) } ``` diff --git a/tests/execution/call-operator.md b/tests/execution/call-operator.md index e5c4453759..f674b5d632 100644 --- a/tests/execution/call-operator.md +++ b/tests/execution/call-operator.md @@ -47,20 +47,20 @@ schema type Query { userId: Int! @expr(body: 2) posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") - userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{args.id}}"}]) + user(id: Int!): User @http(path: "/users/{{.args.id}}") + userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{.args.id}}"}]) user1: User @http(path: "/users/1") - userFromValue: User @http(path: "/users/{{value.userId}}") - userHttpHeaders(id: ID!): User @http(path: "/users", headers: [{key: "id", value: "{{args.id}}"}]) - userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}]) + userFromValue: User @http(path: "/users/{{.value.userId}}") + userHttpHeaders(id: ID!): User @http(path: "/users", headers: [{key: "id", value: "{{.args.id}}"}]) + userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) userGraphQL(id: Int): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) userGraphQLHeaders(id: Int!): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", headers: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", headers: [{key: "id", value: "{{.args.id}}"}]) userWithPosts: UserWithPosts @http(path: "/users/1") news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsWithPortArg(port: Int!): NewsData! - @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:{{args.port}}") + @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:{{.args.port}}") } type NewsData { @@ -77,7 +77,7 @@ type News { type UserWithPosts { id: Int! name: String! - posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{.value.id}}"}}]) } type User { @@ -96,11 +96,11 @@ type Post { body: String user1: User @call(steps: [{query: "user1"}]) userFromValue: User @call(steps: [{query: "userFromValue"}]) - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) - userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{value.userId}}"}}]) - userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{value.userId}}"}}]) - userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{value.userId}}"}}]) - userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) + userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{.value.userId}}"}}]) + userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{.value.userId}}"}}]) + userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{.value.userId}}"}}]) + userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{.value.userId}}"}}]) news: NewsData! @call(steps: [{query: "news"}]) newsWithPortArg: NewsData! @call(steps: [{query: "news", args: {port: 50051}}]) } diff --git a/tests/execution/env-value.md b/tests/execution/env-value.md index 4afa443e79..c34f6b8d4a 100644 --- a/tests/execution/env-value.md +++ b/tests/execution/env-value.md @@ -37,21 +37,21 @@ "post1": { "type": "Post", "http": { - "path": "/posts/{{env.ID}}" + "path": "/posts/{{.env.ID}}" }, "cache": null }, "post2": { "type": "Post", "http": { - "path": "/posts/{{env.POST_ID}}" + "path": "/posts/{{.env.POST_ID}}" }, "cache": null }, "post3": { "type": "Post", "http": { - "path": "/posts/{{env.NESTED_POST_ID}}" + "path": "/posts/{{.env.NESTED_POST_ID}}" }, "cache": null } diff --git a/tests/execution/graphql-dataloader-batch-keys.md b/tests/execution/graphql-dataloader-batch-keys.md index 0d0a64401d..fd98c7e993 100644 --- a/tests/execution/graphql-dataloader-batch-keys.md +++ b/tests/execution/graphql-dataloader-batch-keys.md @@ -20,8 +20,8 @@ type A { id: Int! bid: Int! cid: Int! - b: B @graphQL(name: "b", args: [{key: "id", value: "{{value.bid}}"}], batch: true) - c: C @graphQL(name: "c", args: [{key: "id", value: "{{value.cid}}"}], batch: true) + b: B @graphQL(name: "b", args: [{key: "id", value: "{{.value.bid}}"}], batch: true) + c: C @graphQL(name: "c", args: [{key: "id", value: "{{.value.cid}}"}], batch: true) } type C { diff --git a/tests/execution/graphql-dataloader-batch-request.md b/tests/execution/graphql-dataloader-batch-request.md index 4f8f5cfb64..11b224dee2 100644 --- a/tests/execution/graphql-dataloader-batch-request.md +++ b/tests/execution/graphql-dataloader-batch-request.md @@ -11,7 +11,7 @@ type Post { userId: Int user: User @graphQL( - args: [{key: "id", value: "{{value.userId}}"}] + args: [{key: "id", value: "{{.value.userId}}"}] baseURL: "http://upstream/graphql" batch: true name: "user" diff --git a/tests/execution/graphql-dataloader-no-batch-request.md b/tests/execution/graphql-dataloader-no-batch-request.md index 985f85df0e..abe425285a 100644 --- a/tests/execution/graphql-dataloader-no-batch-request.md +++ b/tests/execution/graphql-dataloader-no-batch-request.md @@ -9,7 +9,7 @@ type Post { id: Int title: String userId: Int - user: User @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{value.userId}}"}]) + user: User @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type User { diff --git a/tests/execution/graphql-datasource-errors.md b/tests/execution/graphql-datasource-errors.md index f0f34005fb..e643247a2e 100644 --- a/tests/execution/graphql-datasource-errors.md +++ b/tests/execution/graphql-datasource-errors.md @@ -12,7 +12,7 @@ type User { type Query { user(id: Int): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) } ``` diff --git a/tests/execution/graphql-datasource-mutation.md b/tests/execution/graphql-datasource-mutation.md index 72b580dd89..5f23315987 100644 --- a/tests/execution/graphql-datasource-mutation.md +++ b/tests/execution/graphql-datasource-mutation.md @@ -17,7 +17,7 @@ type Query { type Mutation { createUser(user: UserInput!): User - @graphQL(baseURL: "http://upstream/graphql", name: "createUser", args: [{key: "user", value: "{{args.user}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "createUser", args: [{key: "user", value: "{{.args.user}}"}]) } type UserInput { diff --git a/tests/execution/graphql-datasource-with-args.md b/tests/execution/graphql-datasource-with-args.md index e932eb4ac3..76aaa8766b 100644 --- a/tests/execution/graphql-datasource-with-args.md +++ b/tests/execution/graphql-datasource-with-args.md @@ -17,9 +17,9 @@ type Post { type Query { user(id: Int): User - @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "user", args: [{key: "id", value: "{{.args.id}}"}]) post(id: Int): Post - @graphQL(baseURL: "http://upstream/graphql", name: "post", args: [{key: "id", value: "{{args.id}}"}]) + @graphQL(baseURL: "http://upstream/graphql", name: "post", args: [{key: "id", value: "{{.args.id}}"}]) } ``` diff --git a/tests/execution/grpc-batch.md b/tests/execution/grpc-batch.md index c6787a083e..2539e8df26 100644 --- a/tests/execution/grpc-batch.md +++ b/tests/execution/grpc-batch.md @@ -50,7 +50,7 @@ type Query { @grpc( method: "news.NewsService.GetMultipleNews" baseURL: "http://localhost:50051" - body: "{{args.news}}" + body: "{{.args.news}}" batchKey: ["news", "id"] ) } diff --git a/tests/execution/grpc-error.md b/tests/execution/grpc-error.md index d518565654..296e9530ed 100644 --- a/tests/execution/grpc-error.md +++ b/tests/execution/grpc-error.md @@ -47,7 +47,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{args.news}}") + @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/grpc-override-url-from-upstream.md b/tests/execution/grpc-override-url-from-upstream.md index a481c7219d..7e55dae589 100644 --- a/tests/execution/grpc-override-url-from-upstream.md +++ b/tests/execution/grpc-override-url-from-upstream.md @@ -47,7 +47,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}", baseURL: "http://localhost:50051") + @grpc(method: "news.NewsService.GetNews", body: "{{.args.news}}", baseURL: "http://localhost:50051") } input NewsInput { id: Int diff --git a/tests/execution/grpc-simple.md b/tests/execution/grpc-simple.md index ac4e808ef9..5fbef81655 100644 --- a/tests/execution/grpc-simple.md +++ b/tests/execution/grpc-simple.md @@ -47,7 +47,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): News! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{args.news}}") + @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/grpc-url-from-upstream.md b/tests/execution/grpc-url-from-upstream.md index 3bf49ea608..e87029e111 100644 --- a/tests/execution/grpc-url-from-upstream.md +++ b/tests/execution/grpc-url-from-upstream.md @@ -46,7 +46,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{args.news}}") + newsById(news: NewsInput!): News! @grpc(method: "news.NewsService.GetNews", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/input-type-protected-error.md b/tests/execution/input-type-protected-error.md index 76431e3d87..fdcbb21c54 100644 --- a/tests/execution/input-type-protected-error.md +++ b/tests/execution/input-type-protected-error.md @@ -16,7 +16,7 @@ type Query { type Mutation { data(input: Input): String @expr(body: "value") - newPost(post: NewPost): Post @http(baseURL: "", path: "/posts", method: POST, body: "{{args.post}}") + newPost(post: NewPost): Post @http(baseURL: "", path: "/posts", method: POST, body: "{{.args.post}}") } input Input @protected { diff --git a/tests/execution/io-cache.md b/tests/execution/io-cache.md index 0338142463..a4906aabb1 100644 --- a/tests/execution/io-cache.md +++ b/tests/execution/io-cache.md @@ -21,7 +21,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/tests/execution/jsonplaceholder-call-post.md b/tests/execution/jsonplaceholder-call-post.md index 43c0a967a4..9348c93593 100644 --- a/tests/execution/jsonplaceholder-call-post.md +++ b/tests/execution/jsonplaceholder-call-post.md @@ -10,7 +10,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -22,7 +22,7 @@ type Post { id: Int! userId: Int! title: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) } ``` diff --git a/tests/execution/mutation-put.md b/tests/execution/mutation-put.md index 899abbfe16..3dd6f6eb31 100644 --- a/tests/execution/mutation-put.md +++ b/tests/execution/mutation-put.md @@ -14,7 +14,7 @@ input PostInput { } type Mutation { - insertPost(input: PostInput!): Post @http(body: "{{args.input}}", method: "PUT", path: "/posts/{{args.input.id}}") + insertPost(input: PostInput!): Post @http(body: "{{.args.input}}", method: "PUT", path: "/posts/{{.args.input.id}}") } type Post { diff --git a/tests/execution/mutation.md b/tests/execution/mutation.md index 6d36eb80bf..277dc6e225 100644 --- a/tests/execution/mutation.md +++ b/tests/execution/mutation.md @@ -13,7 +13,7 @@ input PostInput { } type Mutation { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") } type Post { diff --git a/tests/execution/n-plus-one-list.md b/tests/execution/n-plus-one-list.md index 07e3655c77..50c8be80cd 100644 --- a/tests/execution/n-plus-one-list.md +++ b/tests/execution/n-plus-one-list.md @@ -13,13 +13,13 @@ type Query { type Foo { id: Int! name: String! - bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}], batchKey: ["fooId"]) + bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}], batchKey: ["fooId"]) } type Bar { id: Int! fooId: Int! - foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}], batchKey: ["id"]) + foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}], batchKey: ["id"]) } ``` diff --git a/tests/execution/n-plus-one.md b/tests/execution/n-plus-one.md index 52e1c0b2a6..da96ec58c3 100644 --- a/tests/execution/n-plus-one.md +++ b/tests/execution/n-plus-one.md @@ -13,13 +13,13 @@ type Query { type Foo { id: Int! name: String! - bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}], batchKey: ["fooId"]) + bar: Bar @http(path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}], batchKey: ["fooId"]) } type Bar { id: Int! fooId: Int! - foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}], batchKey: ["id"]) + foo: [Foo] @http(path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}], batchKey: ["id"]) } ``` diff --git a/tests/execution/nesting-level3.md b/tests/execution/nesting-level3.md index 02c44abdc3..5356278ca9 100644 --- a/tests/execution/nesting-level3.md +++ b/tests/execution/nesting-level3.md @@ -19,7 +19,7 @@ type User { email: String! phone: String website: String - todos: [Todo] @http(path: "/users/{{value.id}}/todos") + todos: [Todo] @http(path: "/users/{{.value.id}}/todos") } type Post { @@ -27,7 +27,7 @@ type Post { title: String userId: Int! body: String - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/tests/execution/nullable-arg-query.md b/tests/execution/nullable-arg-query.md index 6a0b191a55..0b6d06c1d2 100644 --- a/tests/execution/nullable-arg-query.md +++ b/tests/execution/nullable-arg-query.md @@ -7,7 +7,7 @@ schema { type Query { users(id: ID): [User] - @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") } type User { diff --git a/tests/execution/request-to-upstream-batching.md b/tests/execution/request-to-upstream-batching.md index bc02588b20..eaf6e253c8 100644 --- a/tests/execution/request-to-upstream-batching.md +++ b/tests/execution/request-to-upstream-batching.md @@ -31,7 +31,7 @@ "query": [ { "key": "id", - "value": "{{args.id}}" + "value": "{{.args.id}}" } ], "baseURL": "http://jsonplaceholder.typicode.com", diff --git a/tests/execution/resolve-with-headers.md b/tests/execution/resolve-with-headers.md index 27b13df5bc..d1ab78cb3f 100644 --- a/tests/execution/resolve-with-headers.md +++ b/tests/execution/resolve-with-headers.md @@ -13,7 +13,7 @@ type Post { } type Query { - post1: Post @http(path: "/posts/{{headers.authorization}}", baseURL: "http://jsonplaceholder.typicode.com") + post1: Post @http(path: "/posts/{{.headers.authorization}}", baseURL: "http://jsonplaceholder.typicode.com") } ``` diff --git a/tests/execution/resolve-with-vars.md b/tests/execution/resolve-with-vars.md index cf68e32bb9..1fa40c396a 100644 --- a/tests/execution/resolve-with-vars.md +++ b/tests/execution/resolve-with-vars.md @@ -12,7 +12,7 @@ type User { type Query { user: [User] - @http(path: "/users", query: [{key: "id", value: "{{vars.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: [{key: "id", value: "{{.vars.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") } ``` diff --git a/tests/execution/rest-api-error.md b/tests/execution/rest-api-error.md index a1f711f9e9..39640447c4 100644 --- a/tests/execution/rest-api-error.md +++ b/tests/execution/rest-api-error.md @@ -18,7 +18,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/execution/rest-api-post.md b/tests/execution/rest-api-post.md index 317013751b..987c759bf9 100644 --- a/tests/execution/rest-api-post.md +++ b/tests/execution/rest-api-post.md @@ -18,7 +18,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/execution/rest-api.md b/tests/execution/rest-api.md index 6d4f5175af..05a1cfbeda 100644 --- a/tests/execution/rest-api.md +++ b/tests/execution/rest-api.md @@ -18,7 +18,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/execution/test-batching-group-by.md b/tests/execution/test-batching-group-by.md index 66703f204a..64deab3b2a 100644 --- a/tests/execution/test-batching-group-by.md +++ b/tests/execution/test-batching-group-by.md @@ -13,7 +13,7 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } diff --git a/tests/execution/test-call-operator-errors.md b/tests/execution/test-call-operator-errors.md index dbcdd68867..bce233cdb6 100644 --- a/tests/execution/test-call-operator-errors.md +++ b/tests/execution/test-call-operator-errors.md @@ -12,9 +12,9 @@ schema @server @upstream(baseURL: "http://localhost:3000") { type Query { posts: [Post] @http(path: "/posts") userWithoutResolver(id: Int!): User - user(id: Int!): User @http(path: "/users/{{args.id}}") - userWithGraphQLResolver(id: Int!): User @graphQL(name: "user", args: [{key: "id", value: "{{args.id}}"}]) - userWithGraphQLHeaders(id: Int!): User @graphQL(name: "user", headers: [{key: "id", value: "{{args.id}}"}]) + user(id: Int!): User @http(path: "/users/{{.args.id}}") + userWithGraphQLResolver(id: Int!): User @graphQL(name: "user", args: [{key: "id", value: "{{.args.id}}"}]) + userWithGraphQLHeaders(id: Int!): User @graphQL(name: "user", headers: [{key: "id", value: "{{.args.id}}"}]) } type User { @@ -23,8 +23,8 @@ type User { type Post { userId: Int! - withoutResolver: User @call(steps: [{query: "userWithoutResolver", args: {id: "{{value.userId}}"}}]) - withoutOperator: User @call(steps: [{args: {id: "{{value.userId}}"}}]) + withoutResolver: User @call(steps: [{query: "userWithoutResolver", args: {id: "{{.value.userId}}"}}]) + withoutOperator: User @call(steps: [{args: {id: "{{.value.userId}}"}}]) urlMismatchHttp: User @call(steps: [{query: "user"}]) argumentMismatchGraphQL: User @call(steps: [{query: "userWithGraphQLResolver"}]) headersMismatchGraphQL: User @call(steps: [{query: "userWithGraphQLResolver"}]) diff --git a/tests/execution/test-custom-types.md b/tests/execution/test-custom-types.md index 70fce38d65..b1af08f697 100644 --- a/tests/execution/test-custom-types.md +++ b/tests/execution/test-custom-types.md @@ -17,7 +17,7 @@ input PostInput { } type Mut { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") } type Post { diff --git a/tests/execution/test-dbl-usage-many.md b/tests/execution/test-dbl-usage-many.md index 00a3de447a..febc4cddbc 100644 --- a/tests/execution/test-dbl-usage-many.md +++ b/tests/execution/test-dbl-usage-many.md @@ -20,7 +20,7 @@ input Post { } type Query { - user(input: User!): User @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") - post(input: Post!): Post @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") + user(input: User!): User @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") + post(input: Post!): Post @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-dbl-usage.md b/tests/execution/test-dbl-usage.md index 906910d463..44757aa281 100644 --- a/tests/execution/test-dbl-usage.md +++ b/tests/execution/test-dbl-usage.md @@ -15,6 +15,6 @@ type User { } type Query { - user(input: User!): User @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") + user(input: User!): User @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-directives-undef-null-fields.md b/tests/execution/test-directives-undef-null-fields.md index 2caeff85a7..b4af313819 100644 --- a/tests/execution/test-directives-undef-null-fields.md +++ b/tests/execution/test-directives-undef-null-fields.md @@ -21,37 +21,37 @@ type User { type Query { userAccessHeadersVars(id: ID!): User - @http(path: "/user/{{args.id}}/{{headers.garbage}}/{{vars.garbage}}", baseURL: "http://localhost:8080") - userListArg(id: [ID]): User @http(path: "/user/{{args.id}}", baseURL: "http://localhost:8080") - userNullableArg(id: ID): User @http(path: "/user/{{args.id}}", baseURL: "http://localhost:8080") - userUndefinedArg(id: ID): User @http(path: "/user/{{args.uid}}", baseURL: "http://localhost:8080") + @http(path: "/user/{{.args.id}}/{{.headers.garbage}}/{{.vars.garbage}}", baseURL: "http://localhost:8080") + userListArg(id: [ID]): User @http(path: "/user/{{.args.id}}", baseURL: "http://localhost:8080") + userNullableArg(id: ID): User @http(path: "/user/{{.args.id}}", baseURL: "http://localhost:8080") + userUndefinedArg(id: ID): User @http(path: "/user/{{.args.uid}}", baseURL: "http://localhost:8080") } type Post { id: Int! userId: Int - user: User @http(path: "/users/{{value.id}}", baseURL: "http://localhost:8080") - nonNullableUser: User! @http(path: "/users/{{value.id}}", baseURL: "http://localhost:8080") - userArg: User @http(path: "/users/{{args.id}}", baseURL: "http://localhost:8080") - userInvalidDirective: User @http(path: "/users/{{Vale.userId}}", baseURL: "http://localhost:8080") - userNonScalar: User @http(path: "/users/{{value.nonNullableUser}}", baseURL: "http://localhost:8080") - userNullable: User @http(path: "/users/{{value.user.id}}", baseURL: "http://localhost:8080") + user: User @http(path: "/users/{{.value.id}}", baseURL: "http://localhost:8080") + nonNullableUser: User! @http(path: "/users/{{.value.id}}", baseURL: "http://localhost:8080") + userArg: User @http(path: "/users/{{.args.id}}", baseURL: "http://localhost:8080") + userInvalidDirective: User @http(path: "/users/{{.Vale.userId}}", baseURL: "http://localhost:8080") + userNonScalar: User @http(path: "/users/{{.value.nonNullableUser}}", baseURL: "http://localhost:8080") + userNullable: User @http(path: "/users/{{.value.user.id}}", baseURL: "http://localhost:8080") nestedUserNullable: User - @http(path: "/users/{{value.nonNullableUser.nestedUser.id}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nestedUser.id}}", baseURL: "http://localhost:8080") nestedNonScalar: User - @http(path: "/users/{{value.nonNullableUser.nonNullableNestedUser}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nonNullableNestedUser}}", baseURL: "http://localhost:8080") nestedUndefinedValue: User - @http(path: "/users/{{value.nonNullableUser.nonNullableNestedUser.userId}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nonNullableNestedUser.userId}}", baseURL: "http://localhost:8080") nestedNullable: User - @http(path: "/users/{{value.nonNullableUser.nonNullableNestedUser.id}}", baseURL: "http://localhost:8080") - userNullValue: User @http(path: "/users/{{value.userId}}", baseURL: "http://localhost:8080") + @http(path: "/users/{{.value.nonNullableUser.nonNullableNestedUser.id}}", baseURL: "http://localhost:8080") + userNullValue: User @http(path: "/users/{{.value.userId}}", baseURL: "http://localhost:8080") # nullable values are allowed in queries userNullValueQuery: User - @http(path: "/users", query: [{key: "id", value: "{{value.id}}"}], baseURL: "http://localhost:8080") - userUndefinedValue: User @http(path: "/users/{{value.userid}}", baseURL: "http://localhost:8080") + @http(path: "/users", query: [{key: "id", value: "{{.value.id}}"}], baseURL: "http://localhost:8080") + userUndefinedValue: User @http(path: "/users/{{.value.userid}}", baseURL: "http://localhost:8080") # but not undefined values userUndefinedValueQuery: User - @http(path: "/users", query: [{key: "id", value: "{{value.userid}}"}], baseURL: "http://localhost:8080") - userVars: User @http(path: "/users/{{vars.a}}", baseURL: "http://localhost:8080") + @http(path: "/users", query: [{key: "id", value: "{{.value.userid}}"}], baseURL: "http://localhost:8080") + userVars: User @http(path: "/users/{{.vars.a}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-duplicated-link.md b/tests/execution/test-duplicated-link.md index c3fbb2277c..82440af786 100644 --- a/tests/execution/test-duplicated-link.md +++ b/tests/execution/test-duplicated-link.md @@ -14,7 +14,7 @@ schema type Query { posts: [Post] @http(path: "/posts") users: [User] @http(path: "/users") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -31,7 +31,7 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` @@ -47,7 +47,7 @@ schema type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -64,6 +64,6 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/tests/execution/test-empty-link.md b/tests/execution/test-empty-link.md index ea99a3843b..ba78293dc3 100644 --- a/tests/execution/test-empty-link.md +++ b/tests/execution/test-empty-link.md @@ -11,7 +11,7 @@ schema @upstream(baseURL: "https://jsonplaceholder.typicode.com") @link(type: Co type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { @@ -28,6 +28,6 @@ type Post { userId: Int! title: String! body: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } ``` diff --git a/tests/execution/test-enum.md b/tests/execution/test-enum.md index ee7fd4409b..c47c8d3c73 100644 --- a/tests/execution/test-enum.md +++ b/tests/execution/test-enum.md @@ -15,7 +15,7 @@ enum Foo { } type Query { - foo(val: String!): Foo @expr(body: "{{args.val}}") + foo(val: String!): Foo @expr(body: "{{.args.val}}") } ``` diff --git a/tests/execution/test-expr-with-mustache.md b/tests/execution/test-expr-with-mustache.md index a4d79e8ead..289e63d8cf 100644 --- a/tests/execution/test-expr-with-mustache.md +++ b/tests/execution/test-expr-with-mustache.md @@ -15,7 +15,7 @@ type A { c: String @modify(omit: true) g: Boolean @modify(omit: true) d: D @modify(omit: true) - bc: BC @expr(body: {b: "{{value.b}}", c: "{{value.c}}", d: "{{value.d.e}}", f: "{{value.d}}", g: "{{value.g}}"}) + bc: BC @expr(body: {b: "{{.value.b}}", c: "{{.value.c}}", d: "{{.value.d.e}}", f: "{{.value.d}}", g: "{{.value.g}}"}) } type BC { diff --git a/tests/execution/test-field-already-implemented-from-Interface.md b/tests/execution/test-field-already-implemented-from-Interface.md index a72e9869ad..af7558c25a 100644 --- a/tests/execution/test-field-already-implemented-from-Interface.md +++ b/tests/execution/test-field-already-implemented-from-Interface.md @@ -19,6 +19,6 @@ type User implements IUser { } type Query { - user: User @http(path: "/user/{{args.input.id}}", baseURL: "http://localhost:8080") + user: User @http(path: "/user/{{.args.input.id}}", baseURL: "http://localhost:8080") } ``` diff --git a/tests/execution/test-graphqlsource-no-base-url.md b/tests/execution/test-graphqlsource-no-base-url.md index e9b3bb3203..075202869c 100644 --- a/tests/execution/test-graphqlsource-no-base-url.md +++ b/tests/execution/test-graphqlsource-no-base-url.md @@ -11,11 +11,11 @@ schema { type Post { id: Int! - user: User @graphQL(name: "user", args: [{key: "id", value: "{{value.userId}}"}]) + user: User @graphQL(name: "user", args: [{key: "id", value: "{{.value.userId}}"}]) } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{args.id}}") + post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-graphqlsource.md b/tests/execution/test-graphqlsource.md index 9a91667da9..575866c642 100644 --- a/tests/execution/test-graphqlsource.md +++ b/tests/execution/test-graphqlsource.md @@ -11,12 +11,12 @@ schema @server @upstream(baseURL: "http://localhost:8000/graphql") { type Post { id: Int! - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], name: "user") + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") userId: Int! } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{args.id}}") + post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-groupby-without-batching.md b/tests/execution/test-groupby-without-batching.md index ed084206a7..f1243b765a 100644 --- a/tests/execution/test-groupby-without-batching.md +++ b/tests/execution/test-groupby-without-batching.md @@ -15,6 +15,6 @@ type User { } type Query { - user(id: Int!): User @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}], batchKey: ["id"]) + user(id: Int!): User @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}], batchKey: ["id"]) } ``` diff --git a/tests/execution/test-grpc-group-by.md b/tests/execution/test-grpc-group-by.md index c35a619608..368808f3b8 100644 --- a/tests/execution/test-grpc-group-by.md +++ b/tests/execution/test-grpc-group-by.md @@ -53,7 +53,7 @@ type Query { @grpc( method: "news.NewsService.GetMultipleNews" baseURL: "http://localhost:50051" - body: "{{args.news}}" + body: "{{.args.news}}" batchKey: ["id"] ) } diff --git a/tests/execution/test-grpc-nested-data.md b/tests/execution/test-grpc-nested-data.md index cd65342add..6a601f3e14 100644 --- a/tests/execution/test-grpc-nested-data.md +++ b/tests/execution/test-grpc-nested-data.md @@ -51,7 +51,7 @@ schema type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "http://localhost:50051") newsById(news: NewsInput!): [News]! - @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{args.news}}") + @grpc(method: "news.NewsService.GetNews", baseURL: "http://localhost:50051", body: "{{.args.news}}") } input NewsInput { id: Int diff --git a/tests/execution/test-grpc.md b/tests/execution/test-grpc.md index 69da3f81a4..9394cae654 100644 --- a/tests/execution/test-grpc.md +++ b/tests/execution/test-grpc.md @@ -65,7 +65,7 @@ type NewsData { type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{args.news}}", method: "news.NewsService.GetNews") - newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") + newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") } ``` diff --git a/tests/execution/test-http-tmpl.md b/tests/execution/test-http-tmpl.md index 04186d1167..9d7fda2f98 100644 --- a/tests/execution/test-http-tmpl.md +++ b/tests/execution/test-http-tmpl.md @@ -11,7 +11,7 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) + user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } diff --git a/tests/execution/test-http-with-add-field.md b/tests/execution/test-http-with-add-field.md index 215b8fc33a..c9d6814564 100644 --- a/tests/execution/test-http-with-add-field.md +++ b/tests/execution/test-http-with-add-field.md @@ -18,7 +18,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type User { diff --git a/tests/execution/test-http-with-inline.md b/tests/execution/test-http-with-inline.md index 53c347ecd6..b66ddb1a59 100644 --- a/tests/execution/test-http-with-inline.md +++ b/tests/execution/test-http-with-inline.md @@ -10,7 +10,7 @@ schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { } type Query @addField(name: "username", path: ["post", "user", "name"]) { - post: Post @http(path: "/posts/1") @http(path: "/users/{{value.userId}}") + post: Post @http(path: "/posts/1") @http(path: "/users/{{.value.userId}}") } type Post { @@ -18,7 +18,7 @@ type Post { title: String body: String userId: Int! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") } type User { diff --git a/tests/execution/test-http-with-mustache-expr.md b/tests/execution/test-http-with-mustache-expr.md index 9fc8600794..e549128f7b 100644 --- a/tests/execution/test-http-with-mustache-expr.md +++ b/tests/execution/test-http-with-mustache-expr.md @@ -12,7 +12,7 @@ type Query { type A { a: Int d: D @modify(omit: true) - bc: BC @expr(body: {d: "{{value.d}}", f: "{{value.f}}"}) + bc: BC @expr(body: {d: "{{.value.d}}", f: "{{.value.f}}"}) } type BC { diff --git a/tests/execution/test-invalid-query-in-http.md b/tests/execution/test-invalid-query-in-http.md index effaf8eefa..0fc9da4e29 100644 --- a/tests/execution/test-invalid-query-in-http.md +++ b/tests/execution/test-invalid-query-in-http.md @@ -16,6 +16,6 @@ type User { type Query { user: [User] - @http(path: "/users", query: {key: "id", value: "{{vars.id}}"}, baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: {key: "id", value: "{{.vars.id}}"}, baseURL: "http://jsonplaceholder.typicode.com") } ``` diff --git a/tests/execution/test-missing-argument-on-all-resolvers.md b/tests/execution/test-missing-argument-on-all-resolvers.md index 4bda8bab29..5e4b65168c 100644 --- a/tests/execution/test-missing-argument-on-all-resolvers.md +++ b/tests/execution/test-missing-argument-on-all-resolvers.md @@ -61,12 +61,12 @@ type NewsData { } type Query { - postGraphQLArgs: Post @graphQL(name: "post", args: [{key: "id", value: "{{args.id}}"}]) - postGraphQLHeaders: Post @graphQL(name: "post", headers: [{key: "id", value: "{{args.id}}"}]) - postHttp: Post @http(path: "/posts/{{args.id}}") - newsGrpcHeaders: NewsData! @grpc(method: "news.NewsService.GetAllNews", headers: [{key: "id", value: "{{args.id}}"}]) - newsGrpcUrl: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "{{args.url}}") - newsGrpcBody: NewsData! @grpc(method: "news.NewsService.GetAllNews", body: "{{args.id}}") + postGraphQLArgs: Post @graphQL(name: "post", args: [{key: "id", value: "{{.args.id}}"}]) + postGraphQLHeaders: Post @graphQL(name: "post", headers: [{key: "id", value: "{{.args.id}}"}]) + postHttp: Post @http(path: "/posts/{{.args.id}}") + newsGrpcHeaders: NewsData! @grpc(method: "news.NewsService.GetAllNews", headers: [{key: "id", value: "{{.args.id}}"}]) + newsGrpcUrl: NewsData! @grpc(method: "news.NewsService.GetAllNews", baseURL: "{{.args.url}}") + newsGrpcBody: NewsData! @grpc(method: "news.NewsService.GetAllNews", body: "{{.args.id}}") } type User { diff --git a/tests/execution/test-nested-link.md b/tests/execution/test-nested-link.md index 4dc775ee09..259c1b4f71 100644 --- a/tests/execution/test-nested-link.md +++ b/tests/execution/test-nested-link.md @@ -27,11 +27,11 @@ schema @server @upstream(baseURL: "http://localhost:8000/graphql") @link(src: "l type Post { id: Int! userId: Int! - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], name: "user") + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{args.id}}") + post(id: Int!): Post @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{.args.id}}") } type User { diff --git a/tests/execution/test-nested-value.md b/tests/execution/test-nested-value.md index f49cc6b6b4..5bc1b6a4a5 100644 --- a/tests/execution/test-nested-value.md +++ b/tests/execution/test-nested-value.md @@ -11,7 +11,7 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.id}}"}]) + user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.id}}"}]) } type Query { diff --git a/tests/execution/test-params-as-body.md b/tests/execution/test-params-as-body.md index f5d72b0a37..a1f75f0acc 100644 --- a/tests/execution/test-params-as-body.md +++ b/tests/execution/test-params-as-body.md @@ -6,7 +6,7 @@ schema @server(port: 8000, graphiql: true) @upstream(baseURL: "http://jsonplaceh } type Query { - firstUser(id: Int, name: String): User @http(method: POST, path: "/users", body: "{{args}}") + firstUser(id: Int, name: String): User @http(method: POST, path: "/users", body: "{{.args}}") } type User { diff --git a/tests/execution/test-scalars.md b/tests/execution/test-scalars.md index 6f012dcd6c..ec54cd9ca5 100644 --- a/tests/execution/test-scalars.md +++ b/tests/execution/test-scalars.md @@ -11,10 +11,10 @@ schema @server(port: 8000, graphiql: true, hostname: "localhost") { } type Query { - email(value: Email!): Email! @expr(body: "{{args.value}}") - phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{args.value}}") - date(value: Date!): Date! @expr(body: "{{args.value}}") - url(value: Url!): Url! @expr(body: "{{args.value}}") + email(value: Email!): Email! @expr(body: "{{.args.value}}") + phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{.args.value}}") + date(value: Date!): Date! @expr(body: "{{.args.value}}") + url(value: Url!): Url! @expr(body: "{{.args.value}}") } ``` diff --git a/tests/execution/test-set-cookie-headers.md b/tests/execution/test-set-cookie-headers.md index b576c18437..bd5a1e7344 100644 --- a/tests/execution/test-set-cookie-headers.md +++ b/tests/execution/test-set-cookie-headers.md @@ -8,7 +8,7 @@ schema } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { id: Int! diff --git a/tests/execution/test-undefined-query.md b/tests/execution/test-undefined-query.md index 448c69b885..e94e6225d9 100644 --- a/tests/execution/test-undefined-query.md +++ b/tests/execution/test-undefined-query.md @@ -11,10 +11,10 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{value.test.id}}"}]) - nested: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.nested.test}}"}]) - innerNested: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.nested.inner.test.id}}"}]) - innerIdNested: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.nested.inner.id.test}}"}]) + user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.test.id}}"}]) + nested: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.nested.test}}"}]) + innerNested: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.nested.inner.test.id}}"}]) + innerIdNested: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.nested.inner.id.test}}"}]) } type Query { diff --git a/tests/execution/upstream-batching.md b/tests/execution/upstream-batching.md index 2cbc337692..3d4741c7b6 100644 --- a/tests/execution/upstream-batching.md +++ b/tests/execution/upstream-batching.md @@ -28,7 +28,7 @@ "query": [ { "key": "id", - "value": "{{args.id}}" + "value": "{{.args.id}}" } ], "baseURL": "http://jsonplaceholder.typicode.com", diff --git a/tests/execution/with-args-url.md b/tests/execution/with-args-url.md index b494e1082c..242b886c91 100644 --- a/tests/execution/with-args-url.md +++ b/tests/execution/with-args-url.md @@ -21,7 +21,7 @@ } }, "http": { - "path": "/users/{{args.id}}", + "path": "/users/{{.args.id}}", "baseURL": "http://jsonplaceholder.typicode.com" }, "cache": null diff --git a/tests/execution/with-args.md b/tests/execution/with-args.md index bd02d28d47..512383cb87 100644 --- a/tests/execution/with-args.md +++ b/tests/execution/with-args.md @@ -11,7 +11,7 @@ type User { type Query { user(id: Int!): [User] - @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") + @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://jsonplaceholder.typicode.com") } ``` diff --git a/tests/execution/with-nesting.md b/tests/execution/with-nesting.md index 6fb90ee23e..5b0ef08034 100644 --- a/tests/execution/with-nesting.md +++ b/tests/execution/with-nesting.md @@ -16,7 +16,7 @@ type User { email: String! phone: String website: String - posts: [Post] @http(path: "/users/{{value.id}}/posts") + posts: [Post] @http(path: "/users/{{.value.id}}/posts") } type Post { diff --git a/tests/expression_spec.rs b/tests/expression_spec.rs index dd9255d305..45e07d2b3e 100644 --- a/tests/expression_spec.rs +++ b/tests/expression_spec.rs @@ -1,26 +1,71 @@ -use async_graphql::Value; -use pretty_assertions::assert_eq; -use serde_json::json; -use tailcall::blueprint::{Blueprint, DynamicValue}; -use tailcall::http::RequestContext; -use tailcall::lambda::{Concurrent, EmptyResolverContext, Eval, EvaluationContext, Expression}; -use tailcall::mustache::Mustache; - -async fn eval(expr: &Expression) -> anyhow::Result { - let runtime = tailcall::cli::runtime::init(&Blueprint::default()); - let req_ctx = RequestContext::new(runtime); - let res_ctx = EmptyResolverContext {}; - let eval_ctx = EvaluationContext::new(&req_ctx, &res_ctx); - expr.eval(eval_ctx, &Concurrent::Parallel).await -} +#[cfg(test)] +mod tests { + use async_graphql::Value; + use pretty_assertions::assert_eq; + use serde_json::json; + use tailcall::blueprint::{Blueprint, DynamicValue}; + use tailcall::http::RequestContext; + use tailcall::lambda::{Concurrent, EmptyResolverContext, Eval, EvaluationContext, Expression}; + use tailcall::mustache::Mustache; -#[tokio::test] -async fn test_and_then() { - let abcde = DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(); - let expr = Expression::Dynamic(abcde) - .and_then(Expression::Dynamic(DynamicValue::Mustache( + async fn eval(expr: &Expression) -> anyhow::Result { + let runtime = tailcall::cli::runtime::init(&Blueprint::default()); + let req_ctx = RequestContext::new(runtime); + let res_ctx = EmptyResolverContext {}; + let eval_ctx = EvaluationContext::new(&req_ctx, &res_ctx); + expr.eval(eval_ctx, &Concurrent::Parallel).await + } + + #[tokio::test] + async fn test_and_then() { + let abcde = DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(); + let expr = Expression::Dynamic(abcde) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.a}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.b}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.c}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.d}}").unwrap(), + ))); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual, expected); + } + + #[tokio::test] + async fn test_with_args() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.a.b.c.d}}").unwrap(), + )) + .with_args(args); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual, expected); + } + + #[tokio::test] + async fn test_with_args_piping() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( Mustache::parse("{{args.a}}").unwrap(), - ))) + )) + .with_args(args) .and_then(Expression::Dynamic(DynamicValue::Mustache( Mustache::parse("{{args.b}}").unwrap(), ))) @@ -31,51 +76,85 @@ async fn test_and_then() { Mustache::parse("{{args.d}}").unwrap(), ))); - let actual = eval(&expr).await.unwrap(); - let expected = Value::from_json(json!("e")).unwrap(); + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); - assert_eq!(actual, expected); -} + assert_eq!(actual, expected); + } -#[tokio::test] -async fn test_with_args() { - let args = Expression::Dynamic( - DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), - ); + #[tokio::test] + async fn test_optional_dot_in_expression() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); - let expr = Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.a.b.c.d}}").unwrap(), - )) - .with_args(args); + let expr_with_dot = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.a.b.c.d}}").unwrap(), + )) + .with_args(args.clone()); - let actual = eval(&expr).await.unwrap(); - let expected = Value::from_json(json!("e")).unwrap(); + let expr_without_dot = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.a.b.c.d}}").unwrap(), + )) + .with_args(args); - assert_eq!(actual, expected); -} + let actual_with_dot = eval(&expr_with_dot).await.unwrap(); + let actual_without_dot = eval(&expr_without_dot).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual_with_dot, expected); + assert_eq!(actual_without_dot, expected); + } + + #[tokio::test] + async fn test_optional_dot_piping() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.a}}").unwrap(), + )) + .with_args(args) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.b}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.c}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.d}}").unwrap(), + ))); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); + + assert_eq!(actual, expected); + } + + #[tokio::test] + async fn test_mixed_dot_usages() { + let args = Expression::Dynamic( + DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), + ); + + let expr = Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.a}}").unwrap(), + )) + .with_args(args) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.b}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{.args.c}}").unwrap(), + ))) + .and_then(Expression::Dynamic(DynamicValue::Mustache( + Mustache::parse("{{args.d}}").unwrap(), + ))); + + let actual = eval(&expr).await.unwrap(); + let expected = Value::from_json(json!("e")).unwrap(); -#[tokio::test] -async fn test_with_args_piping() { - let args = Expression::Dynamic( - DynamicValue::try_from(&json!({"a": {"b": {"c": {"d": "e"}}}})).unwrap(), - ); - - let expr = Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.a}}").unwrap(), - )) - .with_args(args) - .and_then(Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.b}}").unwrap(), - ))) - .and_then(Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.c}}").unwrap(), - ))) - .and_then(Expression::Dynamic(DynamicValue::Mustache( - Mustache::parse("{{args.d}}").unwrap(), - ))); - - let actual = eval(&expr).await.unwrap(); - let expected = Value::from_json(json!("e")).unwrap(); - - assert_eq!(actual, expected); + assert_eq!(actual, expected); + } } diff --git a/tests/graphql/todo/test-batched-query.graphql b/tests/graphql/todo/test-batched-query.graphql index 0d36ab391a..7985db56b9 100644 --- a/tests/graphql/todo/test-batched-query.graphql +++ b/tests/graphql/todo/test-batched-query.graphql @@ -14,8 +14,10 @@ type User { email: String! phone: String website: String - postsBatched: [Post] @http(path: "/posts", query: {userId: "{{parent.value.id}}"}) @batch(key: "id", path: ["userId"]) - firstPost: Post @http(path: "/firstPost", query: {userId: "{{parent.value.id}}"}) @batch(key: "id", path: ["userId"]) + postsBatched: [Post] + @http(path: "/posts", query: {userId: "{{.parent.value.id}}"}) + @batch(key: "id", path: ["userId"]) + firstPost: Post @http(path: "/firstPost", query: {userId: "{{.parent.value.id}}"}) @batch(key: "id", path: ["userId"]) } type Post { diff --git a/tests/graphql/todo/test-nesting-array-ctx.graphql b/tests/graphql/todo/test-nesting-array-ctx.graphql index a3813511ad..8c7a08ec44 100644 --- a/tests/graphql/todo/test-nesting-array-ctx.graphql +++ b/tests/graphql/todo/test-nesting-array-ctx.graphql @@ -4,7 +4,7 @@ schema { } type Bar { - value: Int @http(path: "/withNestingArrayCtxValue", query: {data: "{{value}}"}, baseURL: "https://foo.com") + value: Int @http(path: "/withNestingArrayCtxValue", query: {data: "{{.value}}"}, baseURL: "https://foo.com") } type Foo { diff --git a/tests/graphql/todo/test-no-modified-input-field.graphql b/tests/graphql/todo/test-no-modified-input-field.graphql index 7257b51edb..3919f430d7 100644 --- a/tests/graphql/todo/test-no-modified-input-field.graphql +++ b/tests/graphql/todo/test-no-modified-input-field.graphql @@ -13,7 +13,7 @@ type Identity { type Query { identity(input: IdentityInput): Identity - @http(path: "/noModifiedInputField", query: {data: "{{args.input.a}}"}, baseURL: "https://foo.com") + @http(path: "/noModifiedInputField", query: {data: "{{.args.input.a}}"}, baseURL: "https://foo.com") } #> client-query diff --git a/tests/graphql/todo/test-rename-argument.graphql b/tests/graphql/todo/test-rename-argument.graphql index 56f55b1a6b..48059a924a 100644 --- a/tests/graphql/todo/test-rename-argument.graphql +++ b/tests/graphql/todo/test-rename-argument.graphql @@ -9,7 +9,7 @@ type Bar { type Query { foo(input: Int @modify(name: "data")): Bar - @http(path: "/renameArgument", query: {data: "{{args.data}}"}, baseURL: "https://foo.com") + @http(path: "/renameArgument", query: {data: "{{.args.data}}"}, baseURL: "https://foo.com") } #> client-query diff --git a/tests/snapshots/execution_spec__batching-default.md_merged.snap b/tests/snapshots/execution_spec__batching-default.md_merged.snap index d39f18fde7..20184ded3e 100644 --- a/tests/snapshots/execution_spec__batching-default.md_merged.snap +++ b/tests/snapshots/execution_spec__batching-default.md_merged.snap @@ -10,7 +10,7 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}]) userId: Int! } diff --git a/tests/snapshots/execution_spec__batching-disabled.md_merged.snap b/tests/snapshots/execution_spec__batching-disabled.md_merged.snap index e6e793cb7c..1d1421b372 100644 --- a/tests/snapshots/execution_spec__batching-disabled.md_merged.snap +++ b/tests/snapshots/execution_spec__batching-disabled.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com", batch: } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/snapshots/execution_spec__batching-group-by-default.md_merged.snap b/tests/snapshots/execution_spec__batching-group-by-default.md_merged.snap index 63dd14da32..e0746b8214 100644 --- a/tests/snapshots/execution_spec__batching-group-by-default.md_merged.snap +++ b/tests/snapshots/execution_spec__batching-group-by-default.md_merged.snap @@ -10,7 +10,7 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}]) userId: Int! } diff --git a/tests/snapshots/execution_spec__batching-group-by.md_merged.snap b/tests/snapshots/execution_spec__batching-group-by.md_merged.snap index a6a89380c8..a315e11c63 100644 --- a/tests/snapshots/execution_spec__batching-group-by.md_merged.snap +++ b/tests/snapshots/execution_spec__batching-group-by.md_merged.snap @@ -10,7 +10,7 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}, {key: "foo", value: "bar"}]) + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}, {key: "foo", value: "bar"}]) userId: Int! } diff --git a/tests/snapshots/execution_spec__batching-post.md_merged.snap b/tests/snapshots/execution_spec__batching-post.md_merged.snap index ace737fb85..9233c413bd 100644 --- a/tests/snapshots/execution_spec__batching-post.md_merged.snap +++ b/tests/snapshots/execution_spec__batching-post.md_merged.snap @@ -10,7 +10,7 @@ type Post { body: String id: Int title: String - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") userId: Int! } diff --git a/tests/snapshots/execution_spec__cache-control.md_merged.snap b/tests/snapshots/execution_spec__cache-control.md_merged.snap index 7d26f247b3..14b21d132d 100644 --- a/tests/snapshots/execution_spec__cache-control.md_merged.snap +++ b/tests/snapshots/execution_spec__cache-control.md_merged.snap @@ -7,7 +7,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}}"}]) + user(id: Int): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/snapshots/execution_spec__caching-collision.md_merged.snap b/tests/snapshots/execution_spec__caching-collision.md_merged.snap index 0e0ac7e319..7f298ffb61 100644 --- a/tests/snapshots/execution_spec__caching-collision.md_merged.snap +++ b/tests/snapshots/execution_spec__caching-collision.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, header } type Bar { - foo: Foo @http(path: "/foo?id={{value.id}}") @cache(maxAge: 300) + foo: Foo @http(path: "/foo?id={{.value.id}}") @cache(maxAge: 300) id: String! } diff --git a/tests/snapshots/execution_spec__call-graphql-datasource.md_merged.snap b/tests/snapshots/execution_spec__call-graphql-datasource.md_merged.snap index 5317f0d432..691c98df60 100644 --- a/tests/snapshots/execution_spec__call-graphql-datasource.md_merged.snap +++ b/tests/snapshots/execution_spec__call-graphql-datasource.md_merged.snap @@ -10,13 +10,13 @@ type Post { body: String! id: Int! title: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) userId: Int! } type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @graphQL(args: [{key: "id", value: "{{args.id}}"}], baseURL: "http://upstream/graphql", name: "user") + user(id: Int!): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_merged.snap b/tests/snapshots/execution_spec__call-multiple-steps-piping.md_merged.snap index ece3bee836..bef1dfcb25 100644 --- a/tests/snapshots/execution_spec__call-multiple-steps-piping.md_merged.snap +++ b/tests/snapshots/execution_spec__call-multiple-steps-piping.md_merged.snap @@ -7,13 +7,13 @@ schema @server @upstream { } type Query { - a(input: JSON): JSON @expr(body: "{{args.input.a}}") - a_input(input: JSON): JSON @expr(body: {input: "{{args.input.a}}"}) - abc(input: JSON): JSON @call(steps: [{query: "a", args: {input: "{{args.input}}"}}, {query: "wrap_args"}, {query: "b"}, {query: "wrap_args"}, {query: "c"}]) - abc_input(input: JSON): JSON @call(steps: [{query: "wrap_input", args: {input: "{{args.input}}"}}, {query: "a_input"}, {query: "wrap_input"}, {query: "b_input"}, {query: "wrap_input"}, {query: "c"}]) - b(input: JSON): JSON @expr(body: "{{args.input.b}}") - b_input(input: JSON): JSON @expr(body: {input: "{{args.input.b}}"}) - c(input: JSON): JSON @expr(body: "{{args.input.c}}") - wrap_args: JSON @expr(body: {input: "{{args}}"}) - wrap_input(input: JSON): JSON @expr(body: {input: "{{args.input}}"}) + a(input: JSON): JSON @expr(body: "{{.args.input.a}}") + a_input(input: JSON): JSON @expr(body: {input: "{{.args.input.a}}"}) + abc(input: JSON): JSON @call(steps: [{query: "a", args: {input: "{{.args.input}}"}}, {query: "wrap_args"}, {query: "b"}, {query: "wrap_args"}, {query: "c"}]) + abc_input(input: JSON): JSON @call(steps: [{query: "wrap_input", args: {input: "{{.args.input}}"}}, {query: "a_input"}, {query: "wrap_input"}, {query: "b_input"}, {query: "wrap_input"}, {query: "c"}]) + b(input: JSON): JSON @expr(body: "{{.args.input.b}}") + b_input(input: JSON): JSON @expr(body: {input: "{{.args.input.b}}"}) + c(input: JSON): JSON @expr(body: "{{.args.input.c}}") + wrap_args: JSON @expr(body: {input: "{{.args}}"}) + wrap_input(input: JSON): JSON @expr(body: {input: "{{.args.input}}"}) } diff --git a/tests/snapshots/execution_spec__call-mutation.md_merged.snap b/tests/snapshots/execution_spec__call-mutation.md_merged.snap index c85f7067b6..8f65b57362 100644 --- a/tests/snapshots/execution_spec__call-mutation.md_merged.snap +++ b/tests/snapshots/execution_spec__call-mutation.md_merged.snap @@ -20,12 +20,12 @@ input PostInputWithoutUserId { } type Mutation { - attachPostToFirstUser(postId: Int!): User @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{args.postId}}", userId: 1}}]) - attachPostToUser(postId: Int!, userId: Int!): User @http(body: "{\"postId\":{{args.postId}}}", method: "PATCH", path: "/users/{{args.userId}}") + attachPostToFirstUser(postId: Int!): User @call(steps: [{mutation: "attachPostToUser", args: {postId: "{{.args.postId}}", userId: 1}}]) + attachPostToUser(postId: Int!, userId: Int!): User @http(body: "{\"postId\":{{.args.postId}}}", method: "PATCH", path: "/users/{{.args.userId}}") insertMockedPost: Post @call(steps: [{mutation: "insertPost", args: {input: {body: "post-body", title: "post-title", userId: 1}}}]) - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") - insertPostToFirstUser(input: PostInputWithoutUserId): Post @call(steps: [{mutation: "insertPostToUser", args: {input: "{{args.input}}", userId: 1}}]) - insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post @http(body: "{{args.input}}", method: "POST", path: "/users/{{args.userId}}/posts") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") + insertPostToFirstUser(input: PostInputWithoutUserId): Post @call(steps: [{mutation: "insertPostToUser", args: {input: "{{.args.input}}", userId: 1}}]) + insertPostToUser(input: PostInputWithoutUserId!, userId: Int!): Post @http(body: "{{.args.input}}", method: "POST", path: "/users/{{.args.userId}}/posts") } type Post { @@ -37,11 +37,11 @@ type Post { type Query { firstUser: User @http(path: "/users/1") - postFromUser(userId: Int!): Post @http(path: "/posts?userId={{args.userId}}") + postFromUser(userId: Int!): Post @http(path: "/posts?userId={{.args.userId}}") } type User { id: Int name: String - posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "postFromUser", args: {userId: "{{.value.id}}"}}]) } diff --git a/tests/snapshots/execution_spec__call-operator.md_merged.snap b/tests/snapshots/execution_spec__call-operator.md_merged.snap index 21fa63dad4..1308ff5d7b 100644 --- a/tests/snapshots/execution_spec__call-operator.md_merged.snap +++ b/tests/snapshots/execution_spec__call-operator.md_merged.snap @@ -23,29 +23,29 @@ type Post { news: NewsData! @call(steps: [{query: "news"}]) newsWithPortArg: NewsData! @call(steps: [{query: "news", args: {port: 50051}}]) title: String - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) user1: User @call(steps: [{query: "user1"}]) userFromValue: User @call(steps: [{query: "userFromValue"}]) - userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{value.userId}}"}}]) - userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{value.userId}}"}}]) - userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{value.userId}}"}}]) - userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{value.userId}}"}}]) + userGraphQL: User @call(steps: [{query: "userGraphQL", args: {id: "{{.value.userId}}"}}]) + userGraphQLHeaders: User @call(steps: [{query: "userGraphQLHeaders", args: {id: "{{.value.userId}}"}}]) + userHttpHeaders: User @call(steps: [{query: "userHttpHeaders", args: {id: "{{.value.userId}}"}}]) + userHttpQuery: User @call(steps: [{query: "userHttpQuery", args: {id: "{{.value.userId}}"}}]) userId: Int! } type Query { news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") - newsWithPortArg(port: Int!): NewsData! @grpc(baseURL: "http://localhost:{{args.port}}", method: "news.NewsService.GetAllNews") + 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}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") user1: User @http(path: "/users/1") - userFromValue: User @http(path: "/users/{{value.userId}}") - userGraphQL(id: Int): User @graphQL(args: [{key: "id", value: "{{args.id}}"}], baseURL: "http://upstream/graphql", name: "user") - userGraphQLHeaders(id: Int!): User @graphQL(baseURL: "http://upstream/graphql", headers: [{key: "id", value: "{{args.id}}"}], name: "user") - userHttpHeaders(id: ID!): User @http(headers: [{key: "id", value: "{{args.id}}"}], path: "/users") - userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{args.id}}"}]) + userFromValue: User @http(path: "/users/{{.value.userId}}") + userGraphQL(id: Int): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") + userGraphQLHeaders(id: Int!): User @graphQL(baseURL: "http://upstream/graphql", headers: [{key: "id", value: "{{.args.id}}"}], name: "user") + userHttpHeaders(id: ID!): User @http(headers: [{key: "id", value: "{{.args.id}}"}], path: "/users") + userHttpQuery(id: ID!): User @http(path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) userId: Int! @expr(body: 2) - userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{args.id}}"}]) + userPosts(id: ID!): [Post] @http(path: "/posts", query: [{key: "userId", value: "{{.args.id}}"}]) userWithPosts: UserWithPosts @http(path: "/users/1") } @@ -61,5 +61,5 @@ type User { type UserWithPosts { id: Int! name: String! - posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{value.id}}"}}]) + posts: [Post] @call(steps: [{query: "userPosts", args: {id: "{{.value.id}}"}}]) } diff --git a/tests/snapshots/execution_spec__env-value.md_merged.snap b/tests/snapshots/execution_spec__env-value.md_merged.snap index ca15fd8859..2d23ab3ce3 100644 --- a/tests/snapshots/execution_spec__env-value.md_merged.snap +++ b/tests/snapshots/execution_spec__env-value.md_merged.snap @@ -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(path: "/posts/{{.env.ID}}") + post2: Post @http(path: "/posts/{{.env.POST_ID}}") + post3: Post @http(path: "/posts/{{.env.NESTED_POST_ID}}") } diff --git a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_merged.snap b/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_merged.snap index 74daf11a50..47f1d039d4 100644 --- a/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_merged.snap +++ b/tests/snapshots/execution_spec__graphql-dataloader-batch-request.md_merged.snap @@ -9,7 +9,7 @@ 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", batch: true, name: "user") + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], baseURL: "http://upstream/graphql", batch: true, name: "user") userId: Int } diff --git a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_merged.snap b/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_merged.snap index e6e804c473..51de60d0a5 100644 --- a/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_merged.snap +++ b/tests/snapshots/execution_spec__graphql-dataloader-no-batch-request.md_merged.snap @@ -9,7 +9,7 @@ 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}}"}], baseURL: "http://upstream/graphql", name: "user") userId: Int } diff --git a/tests/snapshots/execution_spec__graphql-datasource-errors.md_merged.snap b/tests/snapshots/execution_spec__graphql-datasource-errors.md_merged.snap index abe03e4cc6..466f43fe72 100644 --- a/tests/snapshots/execution_spec__graphql-datasource-errors.md_merged.snap +++ b/tests/snapshots/execution_spec__graphql-datasource-errors.md_merged.snap @@ -7,7 +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}}"}], baseURL: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_merged.snap b/tests/snapshots/execution_spec__graphql-datasource-mutation.md_merged.snap index 53e6c764c7..fff4739cac 100644 --- a/tests/snapshots/execution_spec__graphql-datasource-mutation.md_merged.snap +++ b/tests/snapshots/execution_spec__graphql-datasource-mutation.md_merged.snap @@ -14,7 +14,7 @@ input UserInput { } type Mutation { - createUser(user: UserInput!): User @graphQL(args: [{key: "user", value: "{{args.user}}"}], baseURL: "http://upstream/graphql", name: "createUser") + createUser(user: UserInput!): User @graphQL(args: [{key: "user", value: "{{.args.user}}"}], baseURL: "http://upstream/graphql", name: "createUser") } type Query { diff --git a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_merged.snap b/tests/snapshots/execution_spec__graphql-datasource-with-args.md_merged.snap index 1d09478d9d..f0617c3429 100644 --- a/tests/snapshots/execution_spec__graphql-datasource-with-args.md_merged.snap +++ b/tests/snapshots/execution_spec__graphql-datasource-with-args.md_merged.snap @@ -12,8 +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}}"}], baseURL: "http://upstream/graphql", name: "post") + user(id: Int): User @graphQL(args: [{key: "id", value: "{{.args.id}}"}], baseURL: "http://upstream/graphql", name: "user") } type User { diff --git a/tests/snapshots/execution_spec__grpc-batch.md_merged.snap b/tests/snapshots/execution_spec__grpc-batch.md_merged.snap index 67656f63d4..e2ce486579 100644 --- a/tests/snapshots/execution_spec__grpc-batch.md_merged.snap +++ b/tests/snapshots/execution_spec__grpc-batch.md_merged.snap @@ -26,5 +26,5 @@ type NewsData { type Query { news: NewsData! @grpc(baseURL: "http://localhost:50051", method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") } diff --git a/tests/snapshots/execution_spec__grpc-error.md_merged.snap b/tests/snapshots/execution_spec__grpc-error.md_merged.snap index 716b0fd75b..9e1de964db 100644 --- a/tests/snapshots/execution_spec__grpc-error.md_merged.snap +++ b/tests/snapshots/execution_spec__grpc-error.md_merged.snap @@ -26,5 +26,5 @@ type NewsData { 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") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } diff --git a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_merged.snap b/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_merged.snap index 3a36c31492..6daa62a280 100644 --- a/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_merged.snap +++ b/tests/snapshots/execution_spec__grpc-override-url-from-upstream.md_merged.snap @@ -26,5 +26,5 @@ type NewsData { 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") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } diff --git a/tests/snapshots/execution_spec__grpc-simple.md_merged.snap b/tests/snapshots/execution_spec__grpc-simple.md_merged.snap index 716b0fd75b..9e1de964db 100644 --- a/tests/snapshots/execution_spec__grpc-simple.md_merged.snap +++ b/tests/snapshots/execution_spec__grpc-simple.md_merged.snap @@ -26,5 +26,5 @@ type NewsData { 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") + newsById(news: NewsInput!): News! @grpc(baseURL: "http://localhost:50051", body: "{{.args.news}}", method: "news.NewsService.GetNews") } diff --git a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_merged.snap b/tests/snapshots/execution_spec__grpc-url-from-upstream.md_merged.snap index d3762f1df7..c2dcaef997 100644 --- a/tests/snapshots/execution_spec__grpc-url-from-upstream.md_merged.snap +++ b/tests/snapshots/execution_spec__grpc-url-from-upstream.md_merged.snap @@ -26,5 +26,5 @@ type NewsData { type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{args.news}}", method: "news.NewsService.GetNews") + newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") } diff --git a/tests/snapshots/execution_spec__io-cache.md_merged.snap b/tests/snapshots/execution_spec__io-cache.md_merged.snap index 4688153cc2..6929ce8a9d 100644 --- a/tests/snapshots/execution_spec__io-cache.md_merged.snap +++ b/tests/snapshots/execution_spec__io-cache.md_merged.snap @@ -10,7 +10,7 @@ type Post { body: String! id: Int! title: String! - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") userId: Int! } diff --git a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_merged.snap b/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_merged.snap index c9faa3df1a..a063169729 100644 --- a/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_merged.snap +++ b/tests/snapshots/execution_spec__jsonplaceholder-call-post.md_merged.snap @@ -9,13 +9,13 @@ schema @server(graphiql: true, hostname: "0.0.0.0", port: 8000) @upstream(baseUR type Post { id: Int! title: String! - user: User @call(steps: [{query: "user", args: {id: "{{value.userId}}"}}]) + user: User @call(steps: [{query: "user", args: {id: "{{.value.userId}}"}}]) userId: Int! } type Query { posts: [Post] @http(path: "/posts") - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") users: [User] @http(path: "/users") } diff --git a/tests/snapshots/execution_spec__mutation-put.md_merged.snap b/tests/snapshots/execution_spec__mutation-put.md_merged.snap index 3061fe7b2a..4024b6fdc8 100644 --- a/tests/snapshots/execution_spec__mutation-put.md_merged.snap +++ b/tests/snapshots/execution_spec__mutation-put.md_merged.snap @@ -15,7 +15,7 @@ input PostInput { } type Mutation { - insertPost(input: PostInput!): Post @http(body: "{{args.input}}", method: "PUT", path: "/posts/{{args.input.id}}") + insertPost(input: PostInput!): Post @http(body: "{{.args.input}}", method: "PUT", path: "/posts/{{.args.input.id}}") } type Post { diff --git a/tests/snapshots/execution_spec__mutation.md_merged.snap b/tests/snapshots/execution_spec__mutation.md_merged.snap index 488a313c2f..235d2494bd 100644 --- a/tests/snapshots/execution_spec__mutation.md_merged.snap +++ b/tests/snapshots/execution_spec__mutation.md_merged.snap @@ -14,7 +14,7 @@ input PostInput { } type Mutation { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") } type Post { diff --git a/tests/snapshots/execution_spec__n-plus-one-list.md_merged.snap b/tests/snapshots/execution_spec__n-plus-one-list.md_merged.snap index 3c74034cd3..e87c02bc48 100644 --- a/tests/snapshots/execution_spec__n-plus-one-list.md_merged.snap +++ b/tests/snapshots/execution_spec__n-plus-one-list.md_merged.snap @@ -7,13 +7,13 @@ schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, header } type Bar { - foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}]) + foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}]) fooId: Int! id: Int! } type Foo { - bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}]) + bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}]) id: Int! name: String! } diff --git a/tests/snapshots/execution_spec__n-plus-one.md_merged.snap b/tests/snapshots/execution_spec__n-plus-one.md_merged.snap index 3c74034cd3..e87c02bc48 100644 --- a/tests/snapshots/execution_spec__n-plus-one.md_merged.snap +++ b/tests/snapshots/execution_spec__n-plus-one.md_merged.snap @@ -7,13 +7,13 @@ schema @server @upstream(baseURL: "http://example.com", batch: {delay: 1, header } type Bar { - foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{value.fooId}}"}]) + foo: [Foo] @http(batchKey: ["id"], path: "/foos", query: [{key: "id", value: "{{.value.fooId}}"}]) fooId: Int! id: Int! } type Foo { - bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{value.id}}"}]) + bar: Bar @http(batchKey: ["fooId"], path: "/bars", query: [{key: "fooId", value: "{{.value.id}}"}]) id: Int! name: String! } diff --git a/tests/snapshots/execution_spec__nesting-level3.md_merged.snap b/tests/snapshots/execution_spec__nesting-level3.md_merged.snap index 2fa45e9cbc..d918d257fb 100644 --- a/tests/snapshots/execution_spec__nesting-level3.md_merged.snap +++ b/tests/snapshots/execution_spec__nesting-level3.md_merged.snap @@ -10,7 +10,7 @@ type Post { body: String id: Int title: String - user: User @http(path: "/users/{{value.userId}}") + user: User @http(path: "/users/{{.value.userId}}") userId: Int! } @@ -27,7 +27,7 @@ type User { id: Int! name: String! phone: String - todos: [Todo] @http(path: "/users/{{value.id}}/todos") + todos: [Todo] @http(path: "/users/{{.value.id}}/todos") username: String! website: String } diff --git a/tests/snapshots/execution_spec__nullable-arg-query.md_merged.snap b/tests/snapshots/execution_spec__nullable-arg-query.md_merged.snap index 7093385843..9472d30879 100644 --- a/tests/snapshots/execution_spec__nullable-arg-query.md_merged.snap +++ b/tests/snapshots/execution_spec__nullable-arg-query.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - users(id: ID): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{args.id}}"}]) + users(id: ID): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/snapshots/execution_spec__request-to-upstream-batching.md_merged.snap b/tests/snapshots/execution_spec__request-to-upstream-batching.md_merged.snap index 0c8e929999..26e703dfec 100644 --- a/tests/snapshots/execution_spec__request-to-upstream-batching.md_merged.snap +++ b/tests/snapshots/execution_spec__request-to-upstream-batching.md_merged.snap @@ -7,7 +7,7 @@ schema @server(batchRequests: true) @upstream(batch: {delay: 1, headers: [], max } type Query { - user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{args.id}}"}]) + user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/snapshots/execution_spec__resolve-with-headers.md_merged.snap b/tests/snapshots/execution_spec__resolve-with-headers.md_merged.snap index e4bebb84dd..0a81622568 100644 --- a/tests/snapshots/execution_spec__resolve-with-headers.md_merged.snap +++ b/tests/snapshots/execution_spec__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(baseURL: "http://jsonplaceholder.typicode.com", path: "/posts/{{.headers.authorization}}") } diff --git a/tests/snapshots/execution_spec__resolve-with-vars.md_merged.snap b/tests/snapshots/execution_spec__resolve-with-vars.md_merged.snap index fc0b2852de..fce4f2eaa2 100644 --- a/tests/snapshots/execution_spec__resolve-with-vars.md_merged.snap +++ b/tests/snapshots/execution_spec__resolve-with-vars.md_merged.snap @@ -7,7 +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(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.vars.id}}"}]) } type User { diff --git a/tests/snapshots/execution_spec__rest-api-error.md_merged.snap b/tests/snapshots/execution_spec__rest-api-error.md_merged.snap index f44325ce69..82c5c02b37 100644 --- a/tests/snapshots/execution_spec__rest-api-error.md_merged.snap +++ b/tests/snapshots/execution_spec__rest-api-error.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(s } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/snapshots/execution_spec__rest-api-post.md_merged.snap b/tests/snapshots/execution_spec__rest-api-post.md_merged.snap index f44325ce69..82c5c02b37 100644 --- a/tests/snapshots/execution_spec__rest-api-post.md_merged.snap +++ b/tests/snapshots/execution_spec__rest-api-post.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(s } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/snapshots/execution_spec__rest-api.md_merged.snap b/tests/snapshots/execution_spec__rest-api.md_merged.snap index f44325ce69..82c5c02b37 100644 --- a/tests/snapshots/execution_spec__rest-api.md_merged.snap +++ b/tests/snapshots/execution_spec__rest-api.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") @link(s } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/snapshots/execution_spec__test-batching-group-by.md_merged.snap b/tests/snapshots/execution_spec__test-batching-group-by.md_merged.snap index b726378054..ef9d73c5ea 100644 --- a/tests/snapshots/execution_spec__test-batching-group-by.md_merged.snap +++ b/tests/snapshots/execution_spec__test-batching-group-by.md_merged.snap @@ -10,7 +10,7 @@ type Post { body: String id: Int title: String - user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) + user: User @http(batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } diff --git a/tests/snapshots/execution_spec__test-custom-types.md_merged.snap b/tests/snapshots/execution_spec__test-custom-types.md_merged.snap index c4e8b04f55..6ec581a1d0 100644 --- a/tests/snapshots/execution_spec__test-custom-types.md_merged.snap +++ b/tests/snapshots/execution_spec__test-custom-types.md_merged.snap @@ -14,7 +14,7 @@ input PostInput { } type Mut { - insertPost(input: PostInput): Post @http(body: "{{args.input}}", method: "POST", path: "/posts") + insertPost(input: PostInput): Post @http(body: "{{.args.input}}", method: "POST", path: "/posts") } type Post { diff --git a/tests/snapshots/execution_spec__test-enum.md_merged.snap b/tests/snapshots/execution_spec__test-enum.md_merged.snap index 32c044fffc..23b88305d1 100644 --- a/tests/snapshots/execution_spec__test-enum.md_merged.snap +++ b/tests/snapshots/execution_spec__test-enum.md_merged.snap @@ -12,5 +12,5 @@ enum Foo { } type Query { - foo(val: String!): Foo @expr(body: "{{args.val}}") + foo(val: String!): Foo @expr(body: "{{.args.val}}") } diff --git a/tests/snapshots/execution_spec__test-expr-with-mustache.md_merged.snap b/tests/snapshots/execution_spec__test-expr-with-mustache.md_merged.snap index 0f3f2892c9..fcacfe4956 100644 --- a/tests/snapshots/execution_spec__test-expr-with-mustache.md_merged.snap +++ b/tests/snapshots/execution_spec__test-expr-with-mustache.md_merged.snap @@ -9,7 +9,7 @@ schema @server @upstream { type A { a: Int b: [Int] @modify(omit: true) - bc: BC @expr(body: {b: "{{value.b}}", c: "{{value.c}}", d: "{{value.d.e}}", f: "{{value.d}}", g: "{{value.g}}"}) + bc: BC @expr(body: {b: "{{.value.b}}", c: "{{.value.c}}", d: "{{.value.d.e}}", f: "{{.value.d}}", g: "{{.value.g}}"}) c: String @modify(omit: true) d: D @modify(omit: true) g: Boolean @modify(omit: true) diff --git a/tests/snapshots/execution_spec__test-graphqlsource.md_merged.snap b/tests/snapshots/execution_spec__test-graphqlsource.md_merged.snap index 62b80c8bae..4a4e706f31 100644 --- a/tests/snapshots/execution_spec__test-graphqlsource.md_merged.snap +++ b/tests/snapshots/execution_spec__test-graphqlsource.md_merged.snap @@ -8,12 +8,12 @@ schema @server @upstream(baseURL: "http://localhost:8000/graphql") { type Post { id: Int! - user: User @graphQL(args: [{key: "id", value: "{{value.userId}}"}], name: "user") + user: User @graphQL(args: [{key: "id", value: "{{.value.userId}}"}], name: "user") userId: Int! } type Query { - post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{args.id}}") + post(id: Int!): Post @http(baseURL: "http://jsonplacheholder.typicode.com", path: "/posts/{{.args.id}}") } type User { diff --git a/tests/snapshots/execution_spec__test-grpc.md_merged.snap b/tests/snapshots/execution_spec__test-grpc.md_merged.snap index 32aafcea20..3adb497b75 100644 --- a/tests/snapshots/execution_spec__test-grpc.md_merged.snap +++ b/tests/snapshots/execution_spec__test-grpc.md_merged.snap @@ -26,6 +26,6 @@ type NewsData { type Query { news: NewsData! @grpc(method: "news.NewsService.GetAllNews") - newsById(news: NewsInput!): News! @grpc(body: "{{args.news}}", method: "news.NewsService.GetNews") - newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") + newsById(news: NewsInput!): News! @grpc(body: "{{.args.news}}", method: "news.NewsService.GetNews") + newsByIdBatch(news: NewsInput!): News! @grpc(body: "{{.args.news}}", batchKey: ["news", "id"], method: "news.NewsService.GetMultipleNews") } diff --git a/tests/snapshots/execution_spec__test-http-tmpl.md_merged.snap b/tests/snapshots/execution_spec__test-http-tmpl.md_merged.snap index 0467ee6e47..deb80e3441 100644 --- a/tests/snapshots/execution_spec__test-http-tmpl.md_merged.snap +++ b/tests/snapshots/execution_spec__test-http-tmpl.md_merged.snap @@ -8,7 +8,7 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User @http(path: "/users", query: [{key: "id", value: "{{value.userId}}"}]) + user: User @http(path: "/users", query: [{key: "id", value: "{{.value.userId}}"}]) userId: Int! } diff --git a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_merged.snap b/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_merged.snap index 95962747c2..b7b1b080e8 100644 --- a/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_merged.snap +++ b/tests/snapshots/execution_spec__test-http-with-mustache-expr.md_merged.snap @@ -8,7 +8,7 @@ schema @server @upstream { type A { a: Int - bc: BC @expr(body: {d: "{{value.d}}", f: "{{value.f}}"}) + bc: BC @expr(body: {d: "{{.value.d}}", f: "{{.value.f}}"}) d: D @modify(omit: true) } diff --git a/tests/snapshots/execution_spec__test-nested-value.md_merged.snap b/tests/snapshots/execution_spec__test-nested-value.md_merged.snap index 3d2ff5dcbc..e2f70ce7e5 100644 --- a/tests/snapshots/execution_spec__test-nested-value.md_merged.snap +++ b/tests/snapshots/execution_spec__test-nested-value.md_merged.snap @@ -8,7 +8,7 @@ schema @server @upstream(baseURL: "http://jsonplacheholder.typicode.com") { type Post { id: Int - user: User! @http(path: "/users", query: [{key: "id", value: "{{value.user.id}}"}]) + user: User! @http(path: "/users", query: [{key: "id", value: "{{.value.user.id}}"}]) } type Query { diff --git a/tests/snapshots/execution_spec__test-params-as-body.md_merged.snap b/tests/snapshots/execution_spec__test-params-as-body.md_merged.snap index 43208953b7..fdd1b67bac 100644 --- a/tests/snapshots/execution_spec__test-params-as-body.md_merged.snap +++ b/tests/snapshots/execution_spec__test-params-as-body.md_merged.snap @@ -7,7 +7,7 @@ schema @server(graphiql: true, port: 8000) @upstream(baseURL: "http://jsonplaceh } type Query { - firstUser(id: Int, name: String): User @http(body: "{{args}}", method: "POST", path: "/users") + firstUser(id: Int, name: String): User @http(body: "{{.args}}", method: "POST", path: "/users") } type User { diff --git a/tests/snapshots/execution_spec__test-scalars.md_merged.snap b/tests/snapshots/execution_spec__test-scalars.md_merged.snap index aaad5c76cd..0c1d7d83a1 100644 --- a/tests/snapshots/execution_spec__test-scalars.md_merged.snap +++ b/tests/snapshots/execution_spec__test-scalars.md_merged.snap @@ -15,8 +15,8 @@ scalar PhoneNumber scalar Url type Query { - date(value: Date!): Date! @expr(body: "{{args.value}}") - email(value: Email!): Email! @expr(body: "{{args.value}}") - phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{args.value}}") - url(value: Url!): Url! @expr(body: "{{args.value}}") + date(value: Date!): Date! @expr(body: "{{.args.value}}") + email(value: Email!): Email! @expr(body: "{{.args.value}}") + phone(value: PhoneNumber!): PhoneNumber! @expr(body: "{{.args.value}}") + url(value: Url!): Url! @expr(body: "{{.args.value}}") } diff --git a/tests/snapshots/execution_spec__test-set-cookie-headers.md_merged.snap b/tests/snapshots/execution_spec__test-set-cookie-headers.md_merged.snap index e85a406976..b97ade4116 100644 --- a/tests/snapshots/execution_spec__test-set-cookie-headers.md_merged.snap +++ b/tests/snapshots/execution_spec__test-set-cookie-headers.md_merged.snap @@ -7,7 +7,7 @@ schema @server(headers: {setCookies: true}, graphiql: true, hostname: "0.0.0.0", } type Query { - user(id: Int!): User @http(path: "/users/{{args.id}}") + user(id: Int!): User @http(path: "/users/{{.args.id}}") } type User { diff --git a/tests/snapshots/execution_spec__upstream-batching.md_merged.snap b/tests/snapshots/execution_spec__upstream-batching.md_merged.snap index 8e89795dc2..5aa162b29f 100644 --- a/tests/snapshots/execution_spec__upstream-batching.md_merged.snap +++ b/tests/snapshots/execution_spec__upstream-batching.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream(batch: {delay: 1, headers: [], maxSize: 100}) { } type Query { - user(id: Int): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{args.id}}"}]) + user(id: Int): User @http(baseURL: "http://jsonplaceholder.typicode.com", batchKey: ["id"], path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/snapshots/execution_spec__with-args-url.md_merged.snap b/tests/snapshots/execution_spec__with-args-url.md_merged.snap index 3fadbfe68f..44df311d08 100644 --- a/tests/snapshots/execution_spec__with-args-url.md_merged.snap +++ b/tests/snapshots/execution_spec__with-args-url.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { } type Query { - user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/{{args.id}}") + user(id: Int!): User @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users/{{.args.id}}") } type User { diff --git a/tests/snapshots/execution_spec__with-args.md_merged.snap b/tests/snapshots/execution_spec__with-args.md_merged.snap index b91da6e13a..4b29d398a0 100644 --- a/tests/snapshots/execution_spec__with-args.md_merged.snap +++ b/tests/snapshots/execution_spec__with-args.md_merged.snap @@ -7,7 +7,7 @@ schema @server @upstream { } type Query { - user(id: Int!): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{args.id}}"}]) + user(id: Int!): [User] @http(baseURL: "http://jsonplaceholder.typicode.com", path: "/users", query: [{key: "id", value: "{{.args.id}}"}]) } type User { diff --git a/tests/snapshots/execution_spec__with-nesting.md_merged.snap b/tests/snapshots/execution_spec__with-nesting.md_merged.snap index ce41127c54..99a69a6c1c 100644 --- a/tests/snapshots/execution_spec__with-nesting.md_merged.snap +++ b/tests/snapshots/execution_spec__with-nesting.md_merged.snap @@ -22,7 +22,7 @@ type User { id: Int! name: String! phone: String - posts: [Post] @http(path: "/users/{{value.id}}/posts") + posts: [Post] @http(path: "/users/{{.value.id}}/posts") username: String! website: String }