forked from tailcallhq/tailcall
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add support for enum args in query encoder (tailcallhq#2994)
- Loading branch information
1 parent
052e037
commit 1679aea
Showing
5 changed files
with
99 additions
and
0 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,17 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: response | ||
--- | ||
{ | ||
"status": 200, | ||
"headers": { | ||
"content-type": "application/json" | ||
}, | ||
"body": { | ||
"data": { | ||
"user": { | ||
"name": "Json Schema" | ||
} | ||
} | ||
} | ||
} |
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,21 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: formatted | ||
--- | ||
type Query { | ||
user(id: Int!, test: Test): User | ||
} | ||
|
||
enum Test { | ||
A | ||
B | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
} | ||
|
||
schema { | ||
query: Query | ||
} |
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,21 @@ | ||
--- | ||
source: tests/core/spec.rs | ||
expression: formatter | ||
--- | ||
schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { | ||
query: Query | ||
} | ||
|
||
enum Test { | ||
A | ||
B | ||
} | ||
|
||
type Query { | ||
user(id: Int!, test: Test): User @http(path: "/users/{{.args.id}}", query: [{key: "enum", value: "{{.args.test}}"}]) | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
} |
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,39 @@ | ||
# test enum as argument | ||
|
||
```graphql @config | ||
schema @server @upstream(baseURL: "http://jsonplaceholder.typicode.com") { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
user(id: Int!, test: Test): User @http(path: "/users/{{.args.id}}", query: [{key: "enum", value: "{{.args.test}}"}]) | ||
} | ||
|
||
enum Test { | ||
A | ||
B | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
} | ||
``` | ||
|
||
```yml @mock | ||
- request: | ||
method: GET | ||
url: http://jsonplaceholder.typicode.com/users/1?enum=A | ||
response: | ||
status: 200 | ||
body: | ||
id: 1 | ||
name: Json Schema | ||
``` | ||
|
||
```yml @test | ||
- method: POST | ||
url: http://localhost:8080/graphql | ||
body: | ||
query: "query { user(id: 1, test: A) { name } }" | ||
``` |