-
Notifications
You must be signed in to change notification settings - Fork 258
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(2818): variance based merging of types (#2927)
Co-authored-by: Tushar Mathur <tusharmath@gmail.com>
- Loading branch information
1 parent
e10eab5
commit d52dcdf
Showing
25 changed files
with
1,069 additions
and
5 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
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,21 @@ | ||
schema { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
a: A | ||
} | ||
|
||
enum enumInput { | ||
A | ||
B | ||
} | ||
|
||
enum enumOutput { | ||
A | ||
B | ||
} | ||
|
||
type A { | ||
a(x: enumInput): enumOutput | ||
} |
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,9 @@ | ||
enum enumInput { | ||
B | ||
C | ||
} | ||
|
||
enum enumOutput { | ||
B | ||
C | ||
} |
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,13 @@ | ||
enum enumInput { | ||
B | ||
C | ||
} | ||
|
||
enum enumOutput { | ||
B | ||
C | ||
} | ||
|
||
type A { | ||
b(x: enumOutput): enumInput | ||
} |
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,9 @@ | ||
schema { | ||
# @link(src: "http://localhost:4000", type: SubGraph, meta: {name: "Users"}) | ||
# @link(src: "http://localhost:5000", type: SubGraph, meta: {name: "Posts"}) | ||
query: Query | ||
} | ||
|
||
type Query { | ||
version: String @expr(body: "test") | ||
} |
43 changes: 43 additions & 0 deletions
43
src/core/config/config_module/fixtures/subgraph-posts.graphql
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,43 @@ | ||
schema | ||
@server(port: 8000) | ||
@upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
posts: [UserPost] @http(path: "/posts") | ||
addComment(postId: Int!, comment: CommentInput!, premium: Boolean): Boolean @http(path: "/add-comment", method: POST) | ||
searchComments(type: CommentSearch): [Comment] @http(path: "/comment") | ||
} | ||
|
||
interface Post { | ||
id: Int! | ||
body: String | ||
} | ||
|
||
enum Role { | ||
ADMIN | ||
EMPLOYEE | ||
} | ||
|
||
type UserPost implements Post { | ||
id: Int! | ||
userId: Int! | ||
title: String! | ||
body: String | ||
} | ||
|
||
input CommentInput { | ||
userId: Int! | ||
body: String! | ||
} | ||
|
||
type Comment { | ||
body: String | ||
} | ||
|
||
enum CommentSearch { | ||
TODAY | ||
WEEK | ||
MONTH | ||
} |
52 changes: 52 additions & 0 deletions
52
src/core/config/config_module/fixtures/subgraph-users.graphql
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,52 @@ | ||
schema | ||
@server(port: 8000) | ||
@upstream(baseURL: "http://jsonplaceholder.typicode.com", httpCache: 42, batch: {delay: 100}) { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
users: [User] @http(path: "/users") | ||
user(id: Int!): User @http(path: "/users/{{.args.id}}") | ||
addComment(postId: Int!, comment: CommentInput!): Boolean @http(path: "/add-comment") | ||
} | ||
|
||
enum Role { | ||
USER | ||
} | ||
|
||
type User { | ||
id: Int! | ||
name: String! | ||
username: String! | ||
email: String! | ||
phone: String | ||
website: String | ||
role: Role | ||
} | ||
|
||
interface Post { | ||
userId: Int! | ||
user: User @http(path: "/users/{{.value.userId}}") | ||
} | ||
|
||
type UserPost implements Post { | ||
userId: Int! | ||
title: String | ||
user: User @http(path: "/users/{{.value.userId}}") | ||
} | ||
|
||
input CommentInput { | ||
userId: Int! | ||
title: String | ||
body: String! | ||
} | ||
|
||
type Comment { | ||
body: String | ||
} | ||
|
||
enum CommentSearch { | ||
WEEK | ||
MONTH | ||
YEAR | ||
} |
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,13 @@ | ||
schema { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
a: A | ||
} | ||
|
||
type A { | ||
a: String | ||
b: Int | ||
c: Boolean | ||
} |
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,5 @@ | ||
type A { | ||
b: Int! | ||
d: Float! | ||
e: 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,6 @@ | ||
type A { | ||
a: Int | ||
b: [Int] | ||
c: Boolean | ||
d: Float | ||
} |
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 @@ | ||
schema { | ||
query: Query | ||
} | ||
|
||
type Query { | ||
b: B | ||
} | ||
|
||
type A { | ||
a: String | ||
} | ||
|
||
type B { | ||
b: String | ||
} | ||
|
||
union Union = A | B |
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,9 @@ | ||
type B { | ||
b: String | ||
} | ||
|
||
type C { | ||
c: Int | ||
} | ||
|
||
union Union = B | C |
Oops, something went wrong.
d52dcdf
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
427634 requests in 30.03s, 800.92MB read
Requests/sec: 14240.95
Transfer/sec: 26.67MB