-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Incorrect Field Path Specification in
@addfield
(#2895)
- Loading branch information
Showing
3 changed files
with
58 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: errors | ||
--- | ||
[ | ||
{ | ||
"message": "Parsing failed because of invalid type: string \"{{.value.user.username}}\", expected a sequence", | ||
"trace": [ | ||
"PostUser", | ||
"@addField", | ||
"path" | ||
], | ||
"description": null | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
error: true | ||
--- | ||
|
||
# Test invalid add fields | ||
|
||
```graphql @config | ||
schema @server(port: 8000) @upstream(baseURL: "http://jsonplaceholder.typicode.com") { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
postuser: [PostUser] @http(path: "/posts") | ||
} | ||
|
||
type PostUser @addField(name: "username", path: "{{.value.user.username}}") { | ||
id: Int! @modify(name: "postId") | ||
title: String! | ||
userId: Int! | ||
user: User @http(baseURL: "https://jsonplaceholder.typicode.com", path: "/users/{{.value.userId}}") | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
username: String! | ||
email: String! | ||
phone: String | ||
website: String | ||
} | ||
``` |
49d925e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Running 30s test @ http://localhost:8000/graphql
4 threads and 100 connections
258670 requests in 30.02s, 1.30GB read
Requests/sec: 8615.51
Transfer/sec: 44.22MB